From 6d019615d041d4a532ea3c1dff946e1202d70b0e Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Wed, 22 Feb 2023 10:17:34 +0100 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B05865=20-=20Restore=20DoCheckToWrite?= =?UTF-8?q?=20error=20messages=20in=20portal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../itop-portal-base/portal/src/Form/ObjectFormManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php index 550366661..40fa93b99 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php @@ -31,6 +31,7 @@ use Combodo\iTop\Form\Field\LabelField; use Combodo\iTop\Form\Form; use Combodo\iTop\Form\FormManager; use Combodo\iTop\Portal\Helper\ApplicationHelper; +use CoreCannotSaveObjectException; use DBObject; use DBObjectSearch; use DBObjectSet; @@ -1145,6 +1146,9 @@ class ObjectFormManager extends FormManager { $this->oObject->DBWrite(); } + catch (CoreCannotSaveObjectException $e) { + throw new Exception($e->getHtmlMessage()); + } catch (Exception $e) { if ($bIsNew) { throw new Exception(Dict::S('Portal:Error:ObjectCannotBeCreated')); From cac7e94a673384bde3871f81a0c59159469f587a Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Wed, 22 Feb 2023 15:42:20 +0100 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B05729=20-=20Fix=20disabled=20button?= =?UTF-8?q?=20in=20bulk=20update/transition=20when=20picking=20a=20value?= =?UTF-8?q?=20in=20a=20drop-down=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/wizardhelper.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/js/wizardhelper.js b/js/wizardhelper.js index 51ddf39ae..f13d7216e 100644 --- a/js/wizardhelper.js +++ b/js/wizardhelper.js @@ -151,7 +151,7 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) var sString = "$('#"+aRefreshed[i]+"').trigger('change').trigger('update');"; window.setTimeout(sString, 1); // Synchronous 'trigger' does nothing, call it asynchronously } - if($('.blockUI').length == 0) { + if($('[data-field-status="blocked"]').length === 0) { $('.disabledDuringFieldLoading').prop("disabled", false).removeClass('disabledDuringFieldLoading'); } }; @@ -181,9 +181,11 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) { operation: 'wizard_helper', json_obj: this.ToJSON() }, function(html){ $('#ajax_content').html(html); - $('.blockUI').parent().unblock(); + $('[data-field-status="blocked"]') + .attr('data-field-status', 'ready') + .unblock(); - if($('.blockUI').length == 0) { + if($('[data-field-status="blocked"]').length === 0) { $('.disabledDuringFieldLoading').prop("disabled", false).removeClass('disabledDuringFieldLoading'); } //console.log('data received:', oWizardHelper); @@ -229,16 +231,18 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) sFieldId = this.GetFieldId(sAttCode); if (sFieldId !== undefined) { $('#fstatus_' + sFieldId).html(''); - $('#field_' + sFieldId).find('div').block({ - message: '', - overlayCSS: {backgroundColor: '#f1f1f1', opacity: 0.3} + $('#field_' + sFieldId).find('div') + .attr('data-field-status', 'blocked') + .block({ + message: '', + overlayCSS: {backgroundColor: '#f1f1f1', opacity: 0.3} }); fieldForm = $('#field_' + sFieldId).closest('form'); this.RequestAllowedValues(sAttCode); } index++; } - if ((fieldForm !== null) && ($('.blockUI').length > 0)) { + if ((fieldForm !== null) && ($('[data-field-status="blocked"]').length > 0)) { fieldForm.find('button[type=submit]:not(:disabled)').prop("disabled", true).addClass('disabledDuringFieldLoading'); } this.AjaxQueryServer();