From c5e4af397a0244c5556613bfd42ef850848a489b Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 1 Aug 2023 16:49:16 -0600 Subject: [PATCH] Api: Fix adding links did not always work after triggering a form reload --- api/js/etemplate/Et2Link/Et2LinkTo.ts | 2 +- api/src/Etemplate/Widget/Link.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Link/Et2LinkTo.ts b/api/js/etemplate/Et2Link/Et2LinkTo.ts index f62a1f590a..8e454aa124 100644 --- a/api/js/etemplate/Et2Link/Et2LinkTo.ts +++ b/api/js/etemplate/Et2Link/Et2LinkTo.ts @@ -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})); } diff --git a/api/src/Etemplate/Widget/Link.php b/api/src/Etemplate/Widget/Link.php index 8ea81b78d1..ae53918a80 100644 --- a/api/src/Etemplate/Widget/Link.php +++ b/api/src/Etemplate/Widget/Link.php @@ -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']))