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 3f811a29e..eed3deb3d 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 @@ -32,6 +32,7 @@ use Combodo\iTop\Form\Form; use Combodo\iTop\Form\FormManager; use Combodo\iTop\Portal\Helper\ApplicationHelper; use Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper; +use CoreCannotSaveObjectException; use DBObject; use DBObjectSearch; use DBObjectSet; @@ -1132,6 +1133,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')); diff --git a/js/wizardhelper.js b/js/wizardhelper.js index 5877e7562..a3eac2478 100644 --- a/js/wizardhelper.js +++ b/js/wizardhelper.js @@ -176,7 +176,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'); } }; @@ -203,9 +203,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'); } } @@ -247,21 +249,22 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) { { sAttCode = aFieldNames[index]; sFieldId = this.GetFieldId(sAttCode); - if (sFieldId !== undefined) - { + if (sFieldId !== undefined) { nbOfFieldsToUpdate++; - $('#fstatus_'+sFieldId).html(''); - $('#field_'+sFieldId).find('div').block({ - message: '', - overlayCSS: {backgroundColor: '#f1f1f1', opacity: 0.3} + $('#fstatus_' + sFieldId).html(''); + $('#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'); }