Ver código fonte

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 anos atrás
pai
commit
9b7c85402f
1 arquivos alterados com 9 adições e 1 exclusões
  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;