Api: Fix adding links did not always work after triggering a form reload

This commit is contained in:
nathan 2023-08-01 16:49:16 -06:00
parent 780f16702f
commit c5e4af397a
2 changed files with 2 additions and 2 deletions

View File

@ -330,7 +330,7 @@ export class Et2LinkTo extends Et2InputWidget(ScopedElementsMixin(FormControlMix
}
else
{
this.validators.push(new ManualMessage(success));
this.validators.push(new ManualMessage(this.egw().lang("failed")));
}
this.dispatchEvent(new CustomEvent('link.et2_link_to', {bubbles: true, detail: success}));
}

View File

@ -427,7 +427,7 @@ class Link extends Etemplate\Widget
// Look for files - normally handled by ajax
$files = self::get_array($content, self::form_name($cname, $this->id . '_file'));
if(is_array($files) && !(is_array($value) && $value['to_id']))
if(is_array($files) && count($files) > 0 && !(is_array($value) && $value['to_id']))
{
$value = array();
if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir']))