diff --git a/admin/inc/class.admin_customfields.inc.php b/admin/inc/class.admin_customfields.inc.php index c8fc382c7b..4d77cd927c 100644 --- a/admin/inc/class.admin_customfields.inc.php +++ b/admin/inc/class.admin_customfields.inc.php @@ -377,6 +377,13 @@ class admin_customfields { $values['@'] = substr($content['cf_values'], $content['cf_values'][1] === '=' ? 2:1); } + elseif (isset($GLOBALS['egw_info']['apps'][$content['cf_type']])) + { + if (!empty($content['cf_values']) && ($content['cf_values'][0] !== '{' || ($values=json_decode($content['cf_values'])) === null)) + { + Api\Etemplate::set_validation_error('cf_values', lang('Invalid JSON object!')); + } + } else { foreach(explode("\n",trim($content['cf_values'])) as $idx => $line) @@ -459,7 +466,10 @@ class admin_customfields { $readonlys['cf_name'] = true; } - $content['cf_values'] = json_decode($content['cf_values'], true); + if (!isset($GLOBALS['egw_info']['apps'][$content['cf_type']])) + { + $content['cf_values'] = json_decode($content['cf_values'], true); + } } else { diff --git a/api/js/etemplate/Et2Link/Et2LinkEntry.ts b/api/js/etemplate/Et2Link/Et2LinkEntry.ts index 55a030fc5c..14b64651d1 100644 --- a/api/js/etemplate/Et2Link/Et2LinkEntry.ts +++ b/api/js/etemplate/Et2Link/Et2LinkEntry.ts @@ -73,7 +73,13 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(SlotMixin(LitE /** * Displayed in the search / select when no value is selected */ - placeholder: {type: String} + placeholder: {type: String}, + + /** + * Additional search parameters that are passed to the server + * when we query searchUrl + */ + searchOptions: {type: Object} } } @@ -219,6 +225,19 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(SlotMixin(LitE return this._appNode?.value || ""; } + set searchOptions(options) + { + this.updateComplete.then(() => + { + this._searchNode.searchOptions = options; + }); + } + + get searchOptions() + { + return this._searchNode.searchOptions; + } + get _appNode() : Et2LinkAppSelect { return this.querySelector("[slot='app']"); diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index a8a4360649..d4abbc01ad 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -284,7 +284,8 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac const type = attrs.type ? attrs.type : field.type; // Set any additional attributes set in options, but not for widgets that pass actual options - if(['select','radio','radiogroup','checkbox','button'].indexOf(field.type) == -1 && !jQuery.isEmptyObject(field.values)) + if(['select','radio','radiogroup','checkbox','button'].indexOf(field.type) == -1 && + setup_function !== '_setup_link_entry' && !jQuery.isEmptyObject(field.values)) { const w = et2_registry[type]; const wc = window.customElements.get('et2-' + type); @@ -769,6 +770,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac attrs.type = "link-entry"; attrs[attrs.readonly ? "app" : "only_app"] = typeof field.only_app == "undefined" ? field.type : field.only_app; + attrs.searchOptions = {filter: field.values || {}}; return true; }