diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 9dda44bdf..9cc27ac98 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -112,9 +112,11 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage $sSearchNbSelected = addslashes(Dict::S('UI:SearchValue:NbSelected')); $this->add_dict_entry('UI:FillAllMandatoryFields'); - $this->add_dict_entries('UI:Search:'); - $this->add_dict_entries('UI:Button:'); $this->add_dict_entries('Error:'); + $this->add_dict_entries('UI:Button:'); + $this->add_dict_entries('UI:Search:'); + $this->add_dict_entry('UI:UndefinedObject'); + $this->add_dict_entries('Enum:Undefined'); if (!$this->IsPrintableVersion()) diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index 7abb41dcd..fda9b2c3a 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -15,11 +15,11 @@ $(function() 'values': [], 'oql': '', 'is_removable': true, // Not used for now. If we come to show locked criterion they will need to have this flag set to false. - 'is_null_allowed': false, 'field': { 'label': '', 'allowed_values': null, + 'is_null_allowed': false, }, // Available operators. They can be extended or restricted by derivated widgets (see this._initOperators() for more informations) 'available_operators': { diff --git a/js/search/search_form_criteria_enum.js b/js/search/search_form_criteria_enum.js index eae65f3c1..ead3d7d7f 100644 --- a/js/search/search_form_criteria_enum.js +++ b/js/search/search_form_criteria_enum.js @@ -18,7 +18,15 @@ $(function() 'code': 'in', 'rank': 10, }, - '=': null, // Remove this one from enum widget. + '=': null, // Remove this one from enum widget. + 'empty': null, // Remove as it will be handle by the "null" value in the "IN" operator + 'not_empty': null, // Remove as it will be handle by the "null" value in the "IN" operator + }, + + // Null value + 'null_value': { + 'code': null, + 'label': Dict.S('Enum:Undefined'), }, }, @@ -93,6 +101,18 @@ $(function() // - Allowed values var oAllowedValuesElem = $('
'); + // - Null value is allowed + // TODO: We might want to move this into the allowed_values for a standard behavior. But that needs to know how to send the "null" value to the server. + if(this.options.field.is_null_allowed === true) + { + var sItemId = 'value_' + sOpId + '_null'; + var sValCode = this.options.null_value.code; + var sValLabel = this.options.null_value.label; + var oValueElem = $('
') + .append('') + .appendTo(oAllowedValuesElem); + } + // - Regular allowed values if(this.options.field.allowed_values.values !== undefined) { var aSortedValues = this._sortValuesByLabel(this.options.field.allowed_values.values); diff --git a/js/search/search_form_criteria_external_key.js b/js/search/search_form_criteria_external_key.js index ff31806be..1513cb24e 100644 --- a/js/search/search_form_criteria_external_key.js +++ b/js/search/search_form_criteria_external_key.js @@ -9,6 +9,10 @@ $(function() // default options options: { + // Null value + 'null_value': { + 'label': Dict.S('UI:UndefinedObject'), + } }, diff --git a/js/search/search_form_handler.js b/js/search/search_form_handler.js index 48702ea26..d4bcf11f5 100644 --- a/js/search/search_form_handler.js +++ b/js/search/search_form_handler.js @@ -446,6 +446,7 @@ $(function() code: oFieldDef.code, widget: oFieldDef.widget, allowed_values: oFieldDef.allowed_values, + is_null_allowed: oFieldDef.is_null_allowed, }; }