1

Topic: GLPI business rules - using AND and OR in the same rule

I am new to this forum so I apologize if this is posted already and I was not able to find it.

We are using GLPI 0.80.4.

In the Assistance, Ticket search, you can use AND and OR several times in the search criteria.

We would like the ability to use AND and OR in the same business rule, so that we can have fewer rules.  Currently we have 383 business rules setup.  Can this functionality be added in a new version or do you have any ideas on how to do this?

Here is an example of our rules:

If category is “PC” AND requestor_group is “ABC” then assigned_group is “USA”
If category is “PC” AND requestor_group is “ABD” then assigned_group is “USA”
If category is “PC” AND requestor_group is “ABE” then assigned_group is “USA”
If category is “PC” AND requestor_group is “OBE” then assigned_group is “EUR”
If category is “PC” AND requestor_group is “SIN” then assigned_group is “APO”

If we could use AND and OR in the same rule, then the above 3 rules would become 1 rule.

If category is “PC” AND (requestor_group is “ABC” or requestor_group is “ABD” or requestor_group is “ABE”) then assigned_group is “USA”

Any ideas?

2

Re: GLPI business rules - using AND and OR in the same rule

Not possible.
But there is a ticket on the roadmap.

Dév. Fedora 19/20 - PHP 5.6.0-dev - MariaDB 5.5.36 - OCS 2.1 - GLPI SVN
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur http://blog.famillecollet.com/

3

Re: GLPI business rules - using AND and OR in the same rule

We encounter similar issues in the filter with several criteria in multiple fields.

We have for example the following tickets:

  • Ticket A : Assigned to - Group1 et Group2

  • Ticket B : Assigned to - Group1

  • Ticket C : Assigned to - Group2

With the following search:

  • Criteria 1 : "Statut" is "no solved"

  • Criteria 2 : And "Assigned to - Group" contains "Group1"

  • Criteria 3 : And not "Assigned to - Group" contains "Group2"

We get a wrong result with "Ticket A" and "Ticket B" while only "ticket B" should appear.

Which issue of roadmap solves this problem?

4 (edited by LaDenrée 2014-03-03 11:23:08)

Re: GLPI business rules - using AND and OR in the same rule

I have quite the same bug using "AND NOT" : the results are the same as with "AND".
in debug mode, looking at the sql request in the where clause i have "where criteria 1 and criteria 2" whatever the operator is set to "AND" or "AND NOT".

looks like a bug.
my criteria :
ticket date >01-02-2014
AND ticket date<01-03-2014
AND NOT closedate<01-03-2014

i expect to get all the tickets created in february and not closed in february.



here is the sql WhereClause :
WHERE `glpi_tickets`.`is_deleted` = '0' AND ( `glpi_tickets`.`entities_id` IN ('2', '3', '6', '4') ) AND ( `glpi_tickets`.`date` > '2014-02-01 00:00:00' AND `glpi_tickets`.`date` < '2014-03-01 00:00:00' AND `glpi_tickets`.`closedate` < '2014-03-01 00:00:00' )

what i need :
WHERE `glpi_tickets`.`is_deleted` = '0' AND ( `glpi_tickets`.`entities_id` IN ('2', '3', '6', '4') ) AND ( `glpi_tickets`.`date` > '2014-02-01 00:00:00' AND `glpi_tickets`.`date` < '2014-03-01 00:00:00' AND NOT `glpi_tickets`.`closedate` < '2014-03-01 00:00:00' )

Trouver la panne avant de réparer...
**************************************
GLPI 0.83.8-Operating system : Linux-PHP 5.2.6-1+lenny16 -Apache/2.2.9 (Debian)-MySQL: 5.0.51a-24+lenny5