mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
Compare commits
1 Commits
develop
...
feature/61
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e48d945e2 |
@@ -3266,13 +3266,16 @@ EOF
|
|||||||
if (array_key_exists($sAttCode, $aExpectedAttributes)) {
|
if (array_key_exists($sAttCode, $aExpectedAttributes)) {
|
||||||
$iExpectCode = $aExpectedAttributes[$sAttCode];
|
$iExpectCode = $aExpectedAttributes[$sAttCode];
|
||||||
|
|
||||||
|
$bIsPrompt=false;
|
||||||
|
$aAttrib = [];
|
||||||
|
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||||
// Prompt for an attribute if
|
// Prompt for an attribute if
|
||||||
// - the attribute must be changed or must be displayed to the user for confirmation
|
// - the attribute must be changed or must be displayed to the user for confirmation
|
||||||
// - or the field is mandatory and currently empty
|
// - or the field is mandatory and currently empty
|
||||||
if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) ||
|
if (($iExpectCode & (OPT_ATT_MUSTCHANGE | OPT_ATT_MUSTPROMPT)) ||
|
||||||
(($iExpectCode & OPT_ATT_MANDATORY) && (false === $this->HasAValue($sAttCode)))) {
|
(($iExpectCode & OPT_ATT_MANDATORY) && (false === $this->HasAValue($sAttCode)))) {
|
||||||
|
$bIsPrompt = true;
|
||||||
$aArgs = array('this' => $this);
|
$aArgs = array('this' => $this);
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
||||||
// If the field is mandatory, set it to the only possible value
|
// If the field is mandatory, set it to the only possible value
|
||||||
if ((!$oAttDef->IsNullAllowed()) || ($iExpectCode & OPT_ATT_MANDATORY)) {
|
if ((!$oAttDef->IsNullAllowed()) || ($iExpectCode & OPT_ATT_MANDATORY)) {
|
||||||
if ($oAttDef->IsExternalKey()) {
|
if ($oAttDef->IsExternalKey()) {
|
||||||
@@ -3283,8 +3286,7 @@ EOF
|
|||||||
$oRemoteObj = $oAllowedValues->Fetch();
|
$oRemoteObj = $oAllowedValues->Fetch();
|
||||||
$this->Set($sAttCode, $oRemoteObj->GetKey());
|
$this->Set($sAttCode, $oRemoteObj->GetKey());
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
if ($oAttDef instanceof \AttributeCaseLog) {
|
if ($oAttDef instanceof \AttributeCaseLog) {
|
||||||
// Add JS files for display caselog
|
// Add JS files for display caselog
|
||||||
// Dummy collapsible section created in order to get JS files
|
// Dummy collapsible section created in order to get JS files
|
||||||
@@ -3294,8 +3296,7 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
|
$aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
|
||||||
if (is_array($aAllowedValues) && count($aAllowedValues) == 1)
|
if (is_array($aAllowedValues) && count($aAllowedValues) == 1) {
|
||||||
{
|
|
||||||
$aValues = array_keys($aAllowedValues);
|
$aValues = array_keys($aAllowedValues);
|
||||||
$this->Set($sAttCode, $aValues[0]);
|
$this->Set($sAttCode, $aValues[0]);
|
||||||
}
|
}
|
||||||
@@ -3316,15 +3317,22 @@ EOF
|
|||||||
$sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef,
|
$sHTMLValue = cmdbAbstractObject::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef,
|
||||||
$value, $sDisplayValue, $sInputId, '', $iExpectCode,
|
$value, $sDisplayValue, $sInputId, '', $iExpectCode,
|
||||||
$aArgs, true, $sInputType);
|
$aArgs, true, $sInputType);
|
||||||
|
$aAttrib = array(
|
||||||
|
'label' => '<span>'.$oAttDef->GetLabel().'</span>',
|
||||||
|
'value' => "<span id=\"field_att_$iFieldIndex\">$sHTMLValue</span>",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (($iExpectCode & OPT_ATT_READONLY) ){
|
||||||
|
$bIsPrompt = true;
|
||||||
|
$sHTMLValue = $this->GetAsHTML($sAttCode);
|
||||||
$aAttrib = array(
|
$aAttrib = array(
|
||||||
'label' => '<span>'.$oAttDef->GetLabel().'</span>',
|
'label' => '<span>'.$oAttDef->GetLabel().'</span>',
|
||||||
'value' => "<span id=\"field_att_$iFieldIndex\">$sHTMLValue</span>",
|
'value' => "<span id=\"field_att_$iFieldIndex\">$sHTMLValue</span>",
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
if($bIsPrompt) {
|
||||||
//add attrib for data-attribute
|
//add attrib for data-attribute
|
||||||
// Prepare metadata attributes
|
// Prepare metadata attributes
|
||||||
$sAttCode = $oAttDef->GetCode();
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
||||||
$sAttDefClass = get_class($oAttDef);
|
$sAttDefClass = get_class($oAttDef);
|
||||||
$sAttLabel = MetaModel::GetLabel($sClass, $sAttCode);
|
$sAttLabel = MetaModel::GetLabel($sClass, $sAttCode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user