#854 Flag Is null allowed not working on attributes Date and DateTime + the default value is now operant

SVN:trunk[3185]
This commit is contained in:
Romain Quetiez
2014-06-02 14:35:28 +00:00
parent df09182878
commit 2d0ca37f27
9 changed files with 12 additions and 14 deletions

View File

@@ -2510,18 +2510,16 @@ class AttributeDateTime extends AttributeDBField
return $iUnixSeconds;
}
// This has been done at the time when itop was using TIMESTAMP columns,
// now that iTop is using DATETIME columns, it seems possible to have IsNullAllowed returning false... later when this is needed
public function IsNullAllowed() {return true;}
public function GetDefaultValue()
{
$default = parent::GetDefaultValue();
if (!parent::IsNullAllowed())
if (!empty($default))
{
if (empty($default))
$iDate = strtotime($default);
if ($iDate !== false)
{
$default = date($this->GetDateFormat());
$default = date($this->GetDateFormat(), $iDate);
}
}