[otrs-cvs] otrs/Kernel/System/ProcessManagement/DB Process.pm, 1.35, 1.36
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/System/ProcessManagement/DB
In directory lancelot:/tmp/cvs-serv17524/Kernel/System/ProcessManagement/DB
Modified Files:
Process.pm
Log Message:
Fixed bug#9031 - ProcessManagement Transition condition with regexp fails.
Author: cr
Index: Process.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/ProcessManagement/DB/Process.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -2 -u -d -r1.35 -r1.36
--- Process.pm 19 Dec 2012 10:10:27 -0000 1.35
+++ Process.pm 11 Jan 2013 04:40:24 -0000 1.36
@@ -1,5 +1,5 @@
# --
# Kernel/System/ProcessManagement/Process.pm - Process Management DB Process backend
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -921,4 +921,8 @@
ResultType => 'SCALAR' # 'SCALAR' || 'HASH' || 'FILE'
Location => '/opt/otrs/var/myfile.txt' # mandatry for ResultType = 'FILE'
+ QuoteRegexp => 1, # or 0, default 1. converts regular expresions
+ # in Transition Conditions from scalar to
+ # to regular expresion objects
+ # (e.g. from 'Regexp' to qr{Regexp}msx)
UserID => 1,
);
@@ -1259,4 +1263,53 @@
next TRANSITION if !IsHashRefWithData($TransitionData);
+ my $ConditionConfig = $TransitionData->{Config}->{Condition} || {};
+
+ # check if regular expressions needs to be quoted
+ # regular expressions are sotred as plain text in the Database, but the cache file needs
+ # that regular epresiones to be quoted as from 'Regexp' to qr{Regexp}msx
+ # or qr/(?msx-i:Regexp)/ see bug# 9031
+ if ( $Param{QuoteRegexp} ) {
+
+ # check if conditions contains regular expressions
+ CONDITION:
+ for my $Condition ( sort keys %{$ConditionConfig} ) {
+
+ # skip invalids
+ next CONDITION if !$Condition;
+
+ # skype the Condition Type
+ next CONDITION if $Condition eq 'Type';
+
+ # skip invalids
+ next CONDITION if ref $ConditionConfig->{$Condition} ne 'HASH';
+
+ # skip conditions without fields
+ next CONDITION if !IsHashRefWithData( $ConditionConfig->{$Condition}->{Fields} );
+
+ my $FieldConfig = $ConditionConfig->{$Condition}->{Fields};
+ FIELD:
+ for my $Field ( sort keys %{$FieldConfig} ) {
+
+ # skip invalids
+ next FIELD if !$Field;
+ next FIELD if !IsHashRefWithData( $FieldConfig->{$Field} );
+
+ # skip non regular expresion match fields
+ next FIELD if !IsStringWithData( $FieldConfig->{$Field}->{Type} );
+ next FIELD if $FieldConfig->{$Field}->{Type} ne 'Regexp';
+
+ # skip fields that it's valis is already a regular expression
+ next FIELD if ref $FieldConfig->{$Field}->{Match} eq 'Regexp';
+
+ # convert value to Regexp
+ my $Match
+ = $TransitionData->{Config}->{Condition}->{$Condition}->{Fields}->{$Field}
+ ->{Match};
+ $TransitionData->{Config}->{Condition}->{$Condition}->{Fields}->{$Field}
+ ->{Match} = qr{$Match}msx;
+ }
+ }
+ }
+
$TransitionDump{ $TransitionData->{EntityID} } = {
Name => $TransitionData->{Name},
@@ -1398,4 +1451,5 @@
my $Output = $Self->{MainObject}->Dump(
$Param{Value},
+ 'ascii',
);
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log