소스 검색

Fixed Trac #345: hidden or read-only parameters in a form were not taken into account for computing the allowed values.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1050 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 년 전
부모
커밋
5625df7d39
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      application/cmdbabstract.class.inc.php

+ 6 - 2
application/cmdbabstract.class.inc.php

@@ -1317,9 +1317,12 @@ EOF
 								else
 								{
 									$iFlags = $this->GetAttributeFlags($sAttCode);				
+									$sInputId = $this->m_iFormId.'_'.$sAttCode;
 									if ($iFlags & OPT_ATT_HIDDEN)
 									{
-										// Attribute is hidden, do nothing
+										// Attribute is hidden, add a hidden input
+										$oPage->add('<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>');
+										$aFieldsMap[$sAttCode] = $sInputId;
 									}
 									else
 									{
@@ -1327,13 +1330,14 @@ EOF
 										{
 											// Attribute is read-only
 											$sHTMLValue = $this->GetAsHTML($sAttCode);
+											$sHTMLValue .= '<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>';
+											$aFieldsMap[$sAttCode] = $sInputId;
 										}
 										else
 										{
 											$sValue = $this->Get($sAttCode);
 											$sDisplayValue = $this->GetEditValue($sAttCode);
 											$aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
-											$sInputId = $this->m_iFormId.'_'.$sAttCode;
 											$sHTMLValue = "<span id=\"field_{$sInputId}\">".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'</span>';
 											$aFieldsMap[$sAttCode] = $sInputId;