Portal : Finished integration of Date & DateTime attributes in forms

SVN:trunk[4031]
This commit is contained in:
Guillaume Lajarige
2016-05-04 10:04:06 +00:00
parent 3c4845cf99
commit aa788a7aad

View File

@@ -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;