mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Enhancement: Date and time formats are now configurable in iTop !! (beta version, beware!)
SVN:trunk[4011]
This commit is contained in:
@@ -97,7 +97,7 @@ $aPageParams = array
|
||||
'mandatory' => false,
|
||||
'modes' => 'http,cli',
|
||||
'default' => '',
|
||||
'description' => 'Input date format (used both for dates and datetimes) - Examples: %Y-%m-%d, %d/%m/%Y (Europe) - no transformation is applied if the argument is omitted',
|
||||
'description' => 'Input date format (used both for dates and datetimes) - Examples: Y-m-d, d/m/Y (Europe) - no transformation is applied if the argument is omitted. (note: old format specification using %Y %m %d is also supported for backward compatibility)',
|
||||
),
|
||||
'separator' => array
|
||||
(
|
||||
@@ -217,10 +217,10 @@ function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter)
|
||||
function ChangeDateFormat($sProposedDate, $sDateFormat)
|
||||
{
|
||||
// Make sure this is a valid MySQL datetime
|
||||
$iTime = utils::StringToTime($sProposedDate, $sDateFormat);
|
||||
if ($iTime !== false)
|
||||
$oDate = DateTime::createFromFormat($sDateFormat, $sProposedDate);
|
||||
if ($oDate !== false)
|
||||
{
|
||||
$sDate = date('Y-m-d H:i:s', $iTime);
|
||||
$sDate = $oDate->format(AttributeDateTime::GetInternalFormat());
|
||||
return $sDate;
|
||||
}
|
||||
else
|
||||
@@ -311,6 +311,10 @@ try
|
||||
$sQualifier = ReadParam($oP, 'qualifier', 'raw_data');
|
||||
$sCharSet = ReadParam($oP, 'charset', 'raw_data');
|
||||
$sDateFormat = ReadParam($oP, 'date_format', 'raw_data');
|
||||
if (strpos($sDateFormat, '%') !== false)
|
||||
{
|
||||
$sDateFormat = utils::DateTimeFormatToPHP($sDateFormat);
|
||||
}
|
||||
$sOutput = ReadParam($oP, 'output');
|
||||
// $sReportLevel = ReadParam($oP, 'reportlevel');
|
||||
$sSimulate = ReadParam($oP, 'simulate');
|
||||
|
||||
@@ -1862,7 +1862,7 @@ class SynchroReplica extends DBObject implements iDisplay
|
||||
{
|
||||
$oStatLog->Inc($sStatsCode.'_updated');
|
||||
}
|
||||
$this->Set('info_last_modified', date('Y-m-d H:i:s'));
|
||||
$this->Set('info_last_modified', date(AttributeDateTime::GetSQLFormat()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1912,7 +1912,7 @@ class SynchroReplica extends DBObject implements iDisplay
|
||||
$this->Set('status_dest_creator', true);
|
||||
$this->Set('status_last_error', '');
|
||||
$this->Set('status', 'synchronized');
|
||||
$this->Set('info_creation_date', date('Y-m-d H:i:s'));
|
||||
$this->Set('info_creation_date', date(AttributeDateTime::GetSQLFormat()));
|
||||
$bCreated = true;
|
||||
|
||||
$oStatLog->AddTrace("Created (".implode(', ', $aValueTrace).")", $this);
|
||||
@@ -1950,7 +1950,7 @@ class SynchroReplica extends DBObject implements iDisplay
|
||||
}
|
||||
$oDestObj->Set($sAttCode, $value);
|
||||
}
|
||||
$this->Set('info_last_modified', date('Y-m-d H:i:s'));
|
||||
$this->Set('info_last_modified', date(AttributeDateTime::GetSQLFormat()));
|
||||
$oDestObj->DBUpdateTracked($oChange);
|
||||
$oStatLog->AddTrace("Replica marked as obsolete", $this);
|
||||
$oStatLog->Inc('stats_nb_obj_obsoleted');
|
||||
|
||||
Reference in New Issue
Block a user