diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index b81fa21d3..82524ea29 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -2804,7 +2804,7 @@ $('.state_select_{$this->m_iFormId}').change( function() { } }); JAVASCRIPT - ); + ); } } @@ -2847,6 +2847,18 @@ EOF $oPage->p($sStatesSelection); $aFieldsMap = $this->DisplayBareProperties($oPage, true, $sPrefix, $aExtraParams); + //if we are in bulk modify : Special case to display the case log, if any... + // WARNING: if you modify the loop below, also check the corresponding code in UpdateObject and DisplayModifyForm + if (isset($aExtraParams['nbBulkObj'])) { + foreach (MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeCaseLog) { + $sComment = (isset($aExtraParams['fieldsComments'][$sAttCode])) ? $aExtraParams['fieldsComments'][$sAttCode] : ''; + $this->DisplayCaseLogForBulkModify($oPage, $sAttCode, $sComment, $sPrefix); + $aFieldsMap[$sAttCode] = $this->m_iFormId.'_'.$sAttCode; + } + } + } + if (!is_array($aFieldsMap)) { $aFieldsMap = array(); } @@ -4507,6 +4519,72 @@ HTML } } + /** + * Special display where the case log uses the whole "screen" at the bottom of the "Properties" tab + * + * @param \WebPage $oPage + * @param string $sAttCode + * @param string $sComment + * @param string $sPrefix + * + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \DictExceptionMissingString + * @throws \MySQLException + * @throws \OQLException + * @throws \Exception + */ + public function DisplayCaseLogForBulkModify(WebPage $oPage, $sAttCode, $sComment = '', $sPrefix = '') + { + $sClass = get_class($this); + + $iFlags = $this->GetAttributeFlags($sAttCode); + + if ($iFlags & (OPT_ATT_HIDDEN | OPT_ATT_READONLY | OPT_ATT_SLAVE)) { + // The case log can not be updated + } else { + $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode); + $sAttDefClass = get_class($oAttDef); + $sAttLabel = $oAttDef->GetLabel(); + $sAttMetaDataLabel = utils::HtmlEntities($sAttLabel); + $sAttMetaDataFlagMandatory = (($iFlags & OPT_ATT_MANDATORY) === OPT_ATT_MANDATORY) ? 'true' : 'false'; + $sAttMetaDataFlagMustChange = (($iFlags & OPT_ATT_MUSTCHANGE) === OPT_ATT_MUSTCHANGE) ? 'true' : 'false'; + $sAttMetaDataFlagMustPrompt = (($iFlags & OPT_ATT_MUSTPROMPT) === OPT_ATT_MUSTPROMPT) ? 'true' : 'false'; + + $sInputId = $this->m_iFormId.'_'.$sAttCode; + + $sValue = $this->Get($sAttCode); + $sDisplayValue = $this->GetEditValue($sAttCode); + $aArgs = array('this' => $this, 'formPrefix' => $sPrefix); + + $sCommentAsHtml = ($sComment != '') ? ''.$sComment.'
' : ''; + $sFieldAsHtml = self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs); + $sHTMLValue = << +
+ $sCommentAsHtml + $sFieldAsHtml +
+ +HTML; + + $aFieldsMap[$sAttCode] = $sInputId; + + $oPage->add(<< + {$sAttLabel} +
+ {$sHTMLValue} +
+ +HTML + ); + } + } + /** * @param $sCurrentState * @param $sStimulus diff --git a/js/utils.js b/js/utils.js index 67159f307..c26ecdf6e 100644 --- a/js/utils.js +++ b/js/utils.js @@ -277,8 +277,15 @@ function CheckAll(sSelector, bValue) { function ToggleField(value, field_id) { if (value) { $('#'+field_id).prop('disabled', false); - // In case the field is rendered as a div containing several inputs (e.g. RedundancySettings) - $('#'+field_id+' :input').prop('disabled', false); + if ($('#'+field_id).hasClass('selectized')) { + $('#'+field_id)[0].selectize.enable(); + } else if ($('#'+field_id).parent().find('.ibo-input-select-autocomplete').length > 0) { + $('#'+field_id).parent().find('.ibo-input-select-autocomplete').prop('disabled', false); + $('#'+field_id).parent().find('.ibo-input-select--action-buttons').removeClass('ibo-is-hidden'); + } else { + // In case the field is rendered as a div containing several inputs (e.g. RedundancySettings) + $('#'+field_id+' :input').prop('disabled', false); + } } else { $('#'+field_id).prop('disabled', true); if ($('#'+field_id).hasClass('selectized')) {