[otrs-cvs] otrs/Kernel/System/ProcessManagement Process.pm, 1.10, 1.11 ActivityDialog.pm, 1.5, 1.6

"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
In directory lancelot:/tmp/cvs-serv14207/Kernel/System/ProcessManagement

Modified Files:
	Process.pm ActivityDialog.pm 
Log Message:
Fixed bug#9049 - Process Management: process with a starting AD for CustomerInterface only breaks in AgentInterface.

Author: cr

Index: Process.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/ProcessManagement/Process.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -2 -u -d -r1.10 -r1.11
--- Process.pm	15 Jan 2013 18:36:41 -0000	1.10
+++ Process.pm	15 Jan 2013 23:02:44 -0000	1.11
@@ -230,5 +230,6 @@
 
     my $ProcessList = $ProcessObject->ProcessList(
-        ProcessState => ['Active'] # Active, FadeAway, Inactive
+        ProcessState => ['Active'],           # Active, FadeAway, Inactive
+        Interface    => ['AgentInterface'],   # optional, ['AgentInterface'] or ['CustomerInterface'] or ['AgentInterface', 'CustomerInterface'] or 'all'
     );
 
@@ -280,5 +281,41 @@
         }
     }
-    return \%ProcessList;
+
+    # set Interface parameter to 'all' by default if parameter was not set
+    if ( !defined $Param{Interface} ) {
+        $Param{Interface} = 'all';
+    }
+
+    # if Interface is 'all' return all processes without interface restrictions
+    if ( $Param{Interface} eq 'all' ) {
+        return \%ProcessList;
+    }
+
+    # otherwise return only processes where the initial activity dialog matches given interface
+    my %ReducedProcessList;
+    PROCESS:
+    for my $ProcessEntityID ( sort keys %ProcessList ) {
+
+        # get process start point for each process we already got
+        my $Start = $Self->ProcessStartpointGet( ProcessEntityID => $ProcessEntityID );
+
+        # skip processes if they does not have a valid start point
+        next PROCESS if !IsHashRefWithData($Start);
+        next PROCESS if !IsStringWithData( $Start->{ActivityDialog} );
+
+        # try to get the start ActivityDialog for the given interface
+        my $ActivityDialog = $Self->{ActivityDialogObject}->ActivityDialogGet(
+            ActivityDialogEntityID => $Start->{ActivityDialog},
+            Interface              => $Param{Interface},
+            Silent                 => 1,
+        );
+
+        # skip process if first activity dialog could not be got for the given interface
+        next PROCESS if !IsHashRefWithData($ActivityDialog);
+
+        $ReducedProcessList{$ProcessEntityID} = $ProcessList{$ProcessEntityID};
+    }
+
+    return \%ReducedProcessList;
 }
 

Author: cr

Index: ActivityDialog.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/ProcessManagement/ActivityDialog.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -2 -u -d -r1.5 -r1.6
--- ActivityDialog.pm	20 Nov 2012 15:52:41 -0000	1.5
+++ ActivityDialog.pm	15 Jan 2013 23:02:44 -0000	1.6
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/ProcessManagement/ActivityDialog.pm - all activity dialog functions
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -82,4 +82,5 @@
         ActivityDialogEntityID => 'AD1',
         Interface              => ['AgentInterface'],   # ['AgentInterface'] or ['CustomerInterface'] or ['AgentInterface', 'CustomerInterface'] or 'all'
+        Silent                 => 1,    # 1 or 0, default 0, if set to 1, will not log errors about not matching interfaces
     );
 
@@ -189,11 +190,13 @@
 
         if ( !$Success ) {
-            $Self->{LogObject}->Log(
-                Priority => 'error',
-                Message =>
-                    "Not permitted Interface(s) '"
-                    . join( '\', \'', @{ $Param{Interface} } )
-                    . "' for ActivityDialog '$Param{ActivityDialogEntityID}'!"
-            );
+            if ( !$Param{Silent} ) {
+                $Self->{LogObject}->Log(
+                    Priority => 'error',
+                    Message =>
+                        "Not permitted Interface(s) '"
+                        . join( '\', \'', @{ $Param{Interface} } )
+                        . "' for ActivityDialog '$Param{ActivityDialogEntityID}'!"
+                );
+            }
             return;
         }
---------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.