Ver Fonte

#697: properly export NULL dates in "spreadsheet" format.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2662 a333f486-631f-4898-b8df-5754b55c2be0
dflaven há 12 anos atrás
pai
commit
f5d8aa4a9e
1 ficheiros alterados com 12 adições e 3 exclusões
  1. 12 3
      application/cmdbabstract.class.inc.php

+ 12 - 3
application/cmdbabstract.class.inc.php

@@ -1186,9 +1186,18 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
 						$oFinalAttDef = $oAttDef->GetFinalAttDef();
 						if (get_class($oFinalAttDef) == 'AttributeDateTime')
 						{
-							$iDate = AttributeDateTime::GetAsUnixSeconds($oObj->Get($sAttCodeEx));
-							$aRow[] = '<td>'.date('Y-m-d', $iDate).'</td>';
-							$aRow[] = '<td>'.date('H:i:s', $iDate).'</td>';
+							$sDate = $oObj->Get($sAttCodeEx);
+							if ($sDate === null)
+							{
+								$aRow[] = '<td></td>';
+								$aRow[] = '<td></td>';
+							}
+							else
+							{
+								$iDate = AttributeDateTime::GetAsUnixSeconds($sDate);
+								$aRow[] = '<td>'.date('Y-m-d', $iDate).'</td>';
+								$aRow[] = '<td>'.date('H:i:s', $iDate).'</td>';								
+							}
 						}
 						else
 						{