Selaa lähdekoodia

Fixed bug: could not empty a field

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@156 a333f486-631f-4898-b8df-5754b55c2be0
romainq 15 vuotta sitten
vanhempi
commit
e6650b772a
2 muutettua tiedostoa jossa 12 lisäystä ja 4 poistoa
  1. 6 2
      pages/UI.php
  2. 6 2
      pages/incident.php

+ 6 - 2
pages/UI.php

@@ -410,6 +410,10 @@ switch($operation)
 					{
 						// Non-visible, or read-only attribute, do nothing
 					}
+					else if ($sAttCode == 'finalclass')
+					{
+						// This very specific field is read-only
+					}
 					else if ($oAttDef->IsLinkSet())
 					{
 						// Link set, the data is a set of link objects, encoded in JSON
@@ -424,9 +428,9 @@ switch($operation)
 					}
 					else if (!$oAttDef->IsExternalField())
 					{
-						$aAttributes[$sAttCode] = trim(utils::ReadPostedParam("attr_$sAttCode", ''));
+						$aAttributes[$sAttCode] = trim(utils::ReadPostedParam("attr_$sAttCode", null));
 						$previousValue = $oObj->Get($sAttCode);
-						if (!empty($aAttributes[$sAttCode]) && ($previousValue != $aAttributes[$sAttCode]))
+						if (!is_null($aAttributes[$sAttCode]) && ($previousValue != $aAttributes[$sAttCode]))
 						{
 							$oObj->Set($sAttCode, $aAttributes[$sAttCode]);
 							$bObjectModified = true;

+ 6 - 2
pages/incident.php

@@ -712,11 +712,15 @@ switch($operation)
 				{
 					// Non-visible, or read-only attribute, do nothing
 				}
+				else if ($sAttCode == 'finalclass')
+				{
+					// This very specific field is read-only
+				}
 				else if (!$oAttDef->IsExternalField())
 				{
-					$aAttributes[$sAttCode] = trim(utils::ReadPostedParam("attr_$sAttCode", ''));
+					$aAttributes[$sAttCode] = trim(utils::ReadPostedParam("attr_$sAttCode", null));
 					$previousValue = $oObj->Get($sAttCode);
-					if (!empty($aAttributes[$sAttCode]) && ($previousValue != $aAttributes[$sAttCode]))
+					if (!is_null($aAttributes[$sAttCode]) && ($previousValue != $aAttributes[$sAttCode]))
 					{
 						$oObj->Set($sAttCode, $aAttributes[$sAttCode]);
 						$bObjectModified = true;