RT::Condition::Complex - build complex conditions out of other conditions
This extension adds new type of conditions to the RT. It's like User Defined condition, shipped with RT, but you don't have to write any code, but instead you use simple syntax to check properties of the ticket and transaction or run other conditions you have.
There are several goals this extension tries to solve:
Since version 0.02 this extension depends on RT::Extension::ColumnMap, first of all install it.
# install RT::Extension::ColumnMap perl Makefile.PL make make install # in RT_SiteConfig.pm Set( @Plugins, ... more plugin ... RT::Extension::ColumnMap RT::Condition::Complex );
You open the web interface in a browser, goto configuration, the global or to specific queue and then scrips. Create a new scrip, on the creation page you select 'Complex' condition and in the 'Custom is applicable code' text box you write a pseudo code. For example:
Type = 'Create' OR StatusChange{open}
Below you can read details on the syntax.
Syntax is similar to TicketSQL and you can use AND/OR and parentheses "(" and ")" to group checks and build custom logic of your condition. As checks you can use either "Expressions" or "Calls".
Expression is comparision of a field with a constant. For example "is type of a transaction equal to "Create" can be writen as:
Type = 'Create'
On the left you write field you want to check, then goes comparision function and a constant.
At this moment the following comparision functions are supported:
Fields are based on RT::Extension::ColumnMap. At this moment not many fields are available, but it's easy to add more. Patches for the RT::Extension::ColumnMap are welcome.
The current transaction has no prefix, so 'Type' is type of the current transaction. 'Ticket.' is prefix for the current ticket.
Constant is a number or a quoted string. Strings can be quoted using ' or " characters. Character you're using for quoting should be escaped with \ and \ should be escaped as well. For example:
"Don't need to escape ' when string is quoted with double quotes." 'But can escape \' with \\.'
It's possible to call another module based condition. For example you have RT::Conditon::XXX that implements some complex condition then you can use the following syntax to call 'XXX':
XXX !XXX
If the condition is controlled by its argument then you can use:
XXX{'quoted argument'} !XXX{'negation with argument'}
As you can see argument should be quoted, you can read about quoting rules above in </Constants> section.
Ruslan Zakirov <Ruslan.Zakirov@gmail.com>
Under the same terms as perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install RT::Condition::Complex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RT::Condition::Complex
CPAN shell
perl -MCPAN -e shell install RT::Condition::Complex
For more information on module installation, please visit the detailed CPAN module installation guide.