From 3fa3bfc260488110b772922c680dd441363a961d Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 14 Sep 2009 08:40:28 +0000 Subject: [PATCH] Fixed bug: could not empty a field SVN:code[156] --- trunk/pages/UI.php | 8 ++++++-- trunk/pages/incident.php | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/trunk/pages/UI.php b/trunk/pages/UI.php index 0de789f0d8..6a02f911c8 100644 --- a/trunk/pages/UI.php +++ b/trunk/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; diff --git a/trunk/pages/incident.php b/trunk/pages/incident.php index bea0a89511..ff9fe3df97 100644 --- a/trunk/pages/incident.php +++ b/trunk/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;