瀏覽代碼

Portal : Finished integration of Date & DateTime attributes in forms

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4031 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 年之前
父節點
當前提交
9b7c85402f
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      core/attributedef.class.inc.php

+ 9 - 1
core/attributedef.class.inc.php

@@ -3643,9 +3643,17 @@ class AttributeDateTime extends AttributeDBField
 	 */
 	public function MakeFormField(DBObject $oObject, $oFormField = null)
 	{
-		$oFormField = parent::MakeFormField($oObject, $oFormField);
+		if ($oFormField === null)
+		{
+			$sFormFieldClass = static::GetFormFieldClass();
+			$oFormField = new $sFormFieldClass($this->GetCode());
+		}
 		$oFormField->SetPHPDateTimeFormat((string) $this->GetFormat());
 		$oFormField->SetJSDateTimeFormat($this->GetFormat()->ToMomentJS());
+
+		$oFormField = parent::MakeFormField($oObject, $oFormField);
+
+		// After call to the parent as it sets the current value
 		$oFormField->SetCurrentValue($this->GetFormat()->Format($oObject->Get($this->GetCode())));
 
 		return $oFormField;