From 2ef359f0d035742381b0de6d374dc24d1acd1f9d Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 16 Sep 2020 09:14:36 -0600 Subject: [PATCH] Etemplate: Fix selectAccount deprecated legacy option of putting account type in empty label --- api/js/etemplate/et2_widget_selectAccount.js | 12 ++++++------ api/js/etemplate/et2_widget_selectAccount.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/js/etemplate/et2_widget_selectAccount.js b/api/js/etemplate/et2_widget_selectAccount.js index 8d537335b2..e50fe03d39 100644 --- a/api/js/etemplate/et2_widget_selectAccount.js +++ b/api/js/etemplate/et2_widget_selectAccount.js @@ -55,10 +55,10 @@ var et2_selectAccount = /** @class */ (function (_super) { function et2_selectAccount(_parent, _attrs, _child) { var _this = _super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {})) || this; // Type in rows or somewhere else? - if (jQuery.inArray(_attrs['empty_label'], et2_selectAccount.account_types) > 0 && (jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0 || - _attrs['account_type'] == et2_selectAccount._attributes.account_type['default'])) { - _attrs['account_type'] = _attrs['empty_label']; - _attrs['empty_label'] = ''; + if (et2_selectAccount.account_types.indexOf(_this.options.empty_label) >= 0 && (et2_selectAccount.account_types.indexOf(_this.options.account_type) < 0 || + _this.options.account_type == et2_selectAccount._attributes.account_type.default)) { + _this.options.account_type = _attrs['empty_label']; + _this.options.empty_label = ''; } if (jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0) { _this.egw().debug("warn", "Invalid account_type: %s Valid options:", _attrs['account_type'], et2_selectAccount.account_types); @@ -69,8 +69,8 @@ var et2_selectAccount = /** @class */ (function (_super) { _this.dialog = null; // Reference to widget within dialog _this.widgets = null; - if (!_attrs.empty_label && !_attrs.readonly && _attrs.multiple) { - _attrs.empty_label = _this.egw().lang('Select user or group'); + if (!_this.options.empty_label && !_this.options.readonly && _this.options.multiple) { + _this.options.empty_label = _this.egw().lang('Select user or group'); } // Allow certain widgets inside this one _this.supportedWidgetClasses = [et2_widget_link_1.et2_link_entry]; diff --git a/api/js/etemplate/et2_widget_selectAccount.ts b/api/js/etemplate/et2_widget_selectAccount.ts index 13ce0c0434..e3ac4937a3 100644 --- a/api/js/etemplate/et2_widget_selectAccount.ts +++ b/api/js/etemplate/et2_widget_selectAccount.ts @@ -62,13 +62,13 @@ export class et2_selectAccount extends et2_selectbox super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_selectAccount._attributes, _child || {})); // Type in rows or somewhere else? - if(jQuery.inArray(_attrs['empty_label'], et2_selectAccount.account_types) > 0 && ( - jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0 || - _attrs['account_type'] == et2_selectAccount._attributes.account_type['default']) + if(et2_selectAccount.account_types.indexOf(this.options.empty_label) >= 0 && ( + et2_selectAccount.account_types.indexOf(this.options.account_type) < 0 || + this.options.account_type == et2_selectAccount._attributes.account_type.default) ) { - _attrs['account_type'] = _attrs['empty_label']; - _attrs['empty_label'] = ''; + this.options.account_type = _attrs['empty_label']; + this.options.empty_label = ''; } if(jQuery.inArray(_attrs['account_type'], et2_selectAccount.account_types) < 0) { @@ -84,9 +84,9 @@ export class et2_selectAccount extends et2_selectbox // Reference to widget within dialog this.widgets = null; - if(!_attrs.empty_label && !_attrs.readonly && _attrs.multiple) + if(!this.options.empty_label && !this.options.readonly && this.options.multiple) { - _attrs.empty_label = this.egw().lang('Select user or group'); + this.options.empty_label = this.egw().lang('Select user or group'); } // Allow certain widgets inside this one