[otrs-cvs] otrs/Kernel/System/ProcessManagement/TransitionAction StateSet.pm, 1.4, 1.5

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

Modified Files:
	StateSet.pm 
Log Message:
Removed DynamicField support for StateSet.

Author: cr

Index: StateSet.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/ProcessManagement/TransitionAction/StateSet.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -2 -u -d -r1.4 -r1.5
--- StateSet.pm	20 Nov 2012 15:55:45 -0000	1.4
+++ StateSet.pm	4 Jan 2013 17:03:54 -0000	1.5
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/ProcessManagement/TransitionAction/StateSet.pm - A Module to set the ticket state
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -130,16 +130,4 @@
             # or
             StateID => 3,
-
-            #OR (DynamicField state mapping)
-            DynamicField        => 'MasterSlave', # or DynamicField_MasterSlave
-            DynamicFieldMapping => {
-                Master           => {
-                    State => 'open'
-                }
-                # or
-                Master           => {
-                    StateID => 3
-                }
-            },
         }
     );
@@ -185,17 +173,8 @@
     }
 
-    if (
-        !$Param{Config}->{StateID}
-        && !$Param{Config}->{State}
-        &&
-        (
-            !$Param{Config}->{DynamicField}
-            && !IsHashRefWithData( $Param{Config}->{DynamicFieldMapping} )
-        )
-        )
-    {
+    if ( !$Param{Config}->{StateID} && !$Param{Config}->{State} ) {
         $Self->{LogObject}->Log(
             Priority => 'error',
-            Message  => "No StateID/State or DynamicField and DynamicFieldMapping configured!",
+            Message  => "No State or StateID configured!",
         );
         return;
@@ -271,144 +250,4 @@
         }
     }
-    elsif (
-        defined $Param{Config}->{DynamicField}
-        && IsHashRefWithData( $Param{Config}->{DynamicFieldMapping} )
-        )
-    {
-
-        # check if the configured DynamicField is defined/has a value
-        my $DynamicFieldValue = $Param{Ticket}->{ 'DynamicField_' . $Param{Config}->{DynamicField} }
-            || $Param{Ticket}->{ $Param{Config}->{DynamicField} }
-            || undef;
-
-        # if the DynamicFieldValue is missing we got nothing to do
-        if ( !$DynamicFieldValue ) {
-            return 1;
-        }
-
-        # if the DynamicFieldValue isn't in our mapping we got nothing to do
-        if ( !$Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue} ) {
-            return 1;
-        }
-
-        # If we have the DynamicFieldValue in our Config but the the Value of that key isn't a hash
-        # or doesn't contain StateID or State as hashkeys
-        # we have a defective config and have to alert
-        if (
-            !IsHashRefWithData( $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue} )
-            || (
-                !$Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID}
-                && !$Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State}
-            )
-            )
-        {
-            $Self->{LogObject}->Log(
-                Priority => 'error',
-                Message  => 'Config error in StateSet ActionConfig: ' .
-                    'Need Hash as Value inside DynamicFieldMappings->DynamicFieldValue: ' .
-                    $DynamicFieldValue .
-                    ' and State or StateID as Hashkeys inside that hash!',
-            );
-            return;
-        }
-
-        # If Ticket's State is already the same as the value we should set it to,
-        # or StateID is already the same as the value we should set it to,
-        # we got nothing to do and return success
-        if (
-            (
-                $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State}
-                &&
-                $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State} eq
-                $Param{Ticket}->{State}
-            )
-            ||
-            (
-                $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID}
-                &&
-                $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID} eq
-                $Param{Ticket}->{StateID}
-            )
-            )
-        {
-            return 1;
-        }
-
-        if ( $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State} ) {
-
-            my %State = $Self->{StateObject}->StateGet(
-                Name => $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State}
-            );
-
-            if (%State) {
-                $Success = $Self->{TicketObject}->TicketStateSet(
-                    TicketID => $Param{Ticket}->{TicketID},
-                    StateID  => $State{ID},
-                    UserID   => $Param{UserID},
-                );
-
-                if ($Success) {
-                    return 1;
-                }
-                else {
-                    $Self->{LogObject}->Log(
-                        Priority => 'error',
-                        Message  => 'Ticket State '
-                            . $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{State}
-                            . ' could not be updated for Ticket: '
-                            . $Param{Ticket}->{TicketID} . '!',
-                    );
-                    return;
-                }
-            }
-
-            # if we didn't find the state return 0
-            # State object will error out that it didn't find what we were looking for
-            else {
-                return;
-            }
-        }
-        elsif ( $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID} ) {
-
-            my %State = $Self->{StateObject}->StateGet(
-                ID => $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID}
-            );
-
-            if (%State) {
-                $Success = $Self->{TicketObject}->TicketStateSet(
-                    TicketID => $Param{Ticket}->{TicketID},
-                    StateID  => $State{ID},
-                    UserID   => $Param{UserID},
-                );
-
-                if ($Success) {
-                    return 1;
-                }
-                else {
-                    $Self->{LogObject}->Log(
-                        Priority => 'error',
-                        Message  => 'Ticket StateID '
-                            . $Param{Config}->{DynamicFieldMapping}->{$DynamicFieldValue}->{StateID}
-                            . ' could not be updated for Ticket: '
-                            . $Param{Ticket}->{TicketID} . '!',
-                    );
-                    return;
-                }
-            }
-
-            # if we didn't find the state return 0
-            # State object will error out that it didn't find what we were looking for
-            else {
-                return;
-            }
-        }
-        else {
-            $Self->{LogObject}->Log(
-                Priority => 'error',
-                Message  => "Couldn't update Ticket State - can't find valid State parameter!",
-            );
-            return;
-        }
-    }
     else {
         $Self->{LogObject}->Log(
---------------------------------------------------------------------
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.