mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
Advanced search: fix date time i18n and 1 second/day add/remove on > and <
SVN:trunk[5781]
This commit is contained in:
@@ -527,16 +527,18 @@ class CriterionToSearchForm extends CriterionConversionAbstract
|
||||
if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE)
|
||||
{
|
||||
$sDelta = '1 day';
|
||||
$sAttributeClass = AttributeDate::class;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sDelta = '1 second';
|
||||
$sAttributeClass = AttributeDateTime::class;
|
||||
}
|
||||
$oFormat = AttributeDate::GetFormat();
|
||||
$oFormat = $sAttributeClass::GetFormat();
|
||||
$sFirstDate = $aCriterion['values'][0]['value'];
|
||||
$oDate = new DateTime($sFirstDate);
|
||||
$oDate->add(DateInterval::createFromDateString($sDelta));
|
||||
$sFirstDateValue = $oDate->format(AttributeDate::GetSQLFormat());
|
||||
$sFirstDateValue = $oDate->format($sAttributeClass::GetSQLFormat());
|
||||
try
|
||||
{
|
||||
$sFirstDateLabel = $oFormat->format($oDate);
|
||||
@@ -550,16 +552,18 @@ class CriterionToSearchForm extends CriterionConversionAbstract
|
||||
if ($sWidget == AttributeDefinition::SEARCH_WIDGET_TYPE_DATE)
|
||||
{
|
||||
$sDelta = '1 day';
|
||||
$sAttributeClass = AttributeDate::class;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sDelta = '1 second';
|
||||
$sAttributeClass = AttributeDateTime::class;
|
||||
}
|
||||
$oFormat = AttributeDate::GetFormat();
|
||||
$oFormat = $sAttributeClass::GetFormat();
|
||||
$sFirstDate = $aCriterion['values'][0]['value'];
|
||||
$oDate = new DateTime($sFirstDate);
|
||||
$oDate->sub(DateInterval::createFromDateString($sDelta));
|
||||
$sFirstDateValue = $oDate->format(AttributeDate::GetSQLFormat());
|
||||
$sFirstDateValue = $oDate->format($sAttributeClass::GetSQLFormat());
|
||||
try
|
||||
{
|
||||
$sFirstDateLabel = $oFormat->format($oDate);
|
||||
|
||||
@@ -438,8 +438,8 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
'ExpectedCriterion' => array(array('widget' => 'hierarchical_key')),
|
||||
),
|
||||
'IP range' => array(
|
||||
'OQL' => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip_name) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip_name) < INET_ATON('10.22.32.255')",
|
||||
'ExpectedOQL' => "SELECT `dev` FROM DatacenterDevice AS `dev` WHERE ((INET_ATON(`dev`.`managementip_name`) < INET_ATON('10.22.32.255')) AND (INET_ATON(`dev`.`managementip_name`) > INET_ATON('10.22.32.224')))",
|
||||
'OQL' => "SELECT DatacenterDevice AS dev WHERE INET_ATON(dev.managementip) > INET_ATON('10.22.32.224') AND INET_ATON(dev.managementip) < INET_ATON('10.22.32.255')",
|
||||
'ExpectedOQL' => "SELECT `dev` FROM DatacenterDevice AS `dev` WHERE ((INET_ATON(`dev`.`managementip`) < INET_ATON('10.22.32.255')) AND (INET_ATON(`dev`.`managementip`) > INET_ATON('10.22.32.224')))",
|
||||
'ExpectedCriterion' => array(array('widget' => 'raw')),
|
||||
),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user