mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
Advanced Search: Undefined for enums and unit tests
SVN:b1162[5517]
This commit is contained in:
@@ -442,10 +442,15 @@ class CriterionToSearchForm extends CriterionConversionAbstract
|
||||
case 'IN':
|
||||
break;
|
||||
case 'OR':
|
||||
case 'ISNULL':
|
||||
// Special case when undefined and other values are selected
|
||||
$aCriteria['operator'] = CriterionConversionAbstract::OP_IN;
|
||||
if (isset($aCriteria['has_undefined']) && $aCriteria['has_undefined'])
|
||||
{
|
||||
if (!isset($aCriteria['values']))
|
||||
{
|
||||
$aCriteria['values'] = array();
|
||||
}
|
||||
$aCriteria['values'][] = array('value' => 'null', 'label' => 'null');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -356,6 +356,7 @@ class CriterionConversionTest extends ItopDataTestCase
|
||||
'enum NOT IN' => array('OQL' => "SELECT Contact WHERE status NOT IN ('active')"),
|
||||
'enum undefined' => array('OQL' => "SELECT FunctionalCI WHERE ((business_criticity = 'high') OR ISNULL(business_criticity)) AND 1"),
|
||||
'enum undefined1' => array('OQL' => "SELECT FunctionalCI WHERE ((business_criticity IN ('high', 'medium')) OR ISNULL(business_criticity)) AND 1"),
|
||||
'enum undefined2' => array('OQL' => "SELECT FunctionalCI WHERE ISNULL(business_criticity)"),
|
||||
'key NOT IN' => array('OQL' => "SELECT Contact WHERE org_id NOT IN ('1')"),
|
||||
'key IN' => array('OQL' => "SELECT Contact WHERE org_id IN ('1')"),
|
||||
'key empty' => array('OQL' => "SELECT Person WHERE location_id = '0'"),
|
||||
|
||||
@@ -109,6 +109,11 @@ class SearchFormTest extends ItopDataTestCase
|
||||
array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 00:00:00' >= start_date", 1),
|
||||
array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-01 01:00:00' > start_date", 1),
|
||||
array('OQL' => "SELECT UserRequest WHERE start_date >= '2017-01-01 00:00:00' AND '2017-01-02 00:00:00' > start_date", 1),
|
||||
array(
|
||||
'OQL' => "SELECT FunctionalCI WHERE ((business_criticity IN ('high', 'medium')) OR ISNULL(business_criticity)) AND 1",
|
||||
1
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user