瀏覽代碼

Portal: Some fields were no longer mandatory due to a regression introduced by the flags on lifecycle

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4826 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 8 年之前
父節點
當前提交
bc7cf92fb6
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php

+ 9 - 5
datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php

@@ -628,17 +628,21 @@ class ObjectFormManager extends FormManager
 					}
 					else
 					{
-						// Normal field
-                        $oField->SetReadOnly(false);
-                        $oField->SetHidden(false);
-                        $oField->SetMandatory(false);
+						// Normal field, use "flags" set by AttDef::MakeFormField()
+                        // Except if we are in a transition be cause $oAttDef doesn't know if the form is for a transition
+                        if($this->IsTransitionForm())
+                        {
+                            $oField->SetReadOnly(false);
+                            $oField->SetHidden(false);
+                            $oField->SetMandatory(false);
+                        }
 					}
 
                     // Finally, if it's mandatory ...
                     if (($iFieldFlags & OPT_ATT_MANDATORY) === OPT_ATT_MANDATORY)
                     {
                         // ... and when in a transition, we force it as mandatory
-                        if($this->IsTransitionForm())
+                        if($this->IsTransitionForm() && $oAttDef->IsNull($this->oObject->Get($sAttCode)))
                         {
                             $oField->SetMandatory(true);
                         }