[otrs-cvs] otrs/Kernel/Modules AgentTicketProcess.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/Modules
In directory lancelot:/tmp/cvs-serv15440/Kernel/Modules

Modified Files:
	AgentTicketProcess.pm 
Log Message:
 - 2013-01-31 Fixed bug#9111 - ProcessManagement: Empty Service or SLA causes an error.

Author: cr

Index: AgentTicketProcess.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketProcess.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -2 -u -d -r1.35 -r1.36
--- AgentTicketProcess.pm	31 Jan 2013 13:45:54 -0000	1.35
+++ AgentTicketProcess.pm	31 Jan 2013 21:47:02 -0000	1.36
@@ -4215,9 +4215,46 @@
                     }
 
-                    $Success = $Self->{TicketObject}->$TicketFieldSetSub(
-                        $UpdateFieldName => $TicketParam{ $Self->{NameToID}{$CurrentField} },
-                        TicketID         => $TicketID,
-                        UserID           => $Self->{UserID},
-                    );
+                    # to store if the field needs to be updated
+                    my $FieldUpdate;
+
+                    # only Service and SLA fields accepts empty values if the hash key is not
+                    # defined set it to empty so the Ticket*Set function call will get the empty
+                    # value
+                    if (
+                        ( $UpdateFieldName eq 'ServiceID' || $UpdateFieldName eq 'SLAID' )
+                        && !defined $TicketParam{ $Self->{NameToID}{$CurrentField} }
+                        )
+                    {
+                        $TicketParam{ $Self->{NameToID}{$CurrentField} } = '';
+                        $FieldUpdate = 1;
+                    }
+
+                    # update Service an SLA fields if they have a defined value (even empty)
+                    elsif ( $UpdateFieldName eq 'ServiceID' || $UpdateFieldName eq 'SLAID' )
+                    {
+                        $FieldUpdate = 1;
+                    }
+
+                    # update any other field that its value is defiend and not emoty
+                    elsif (
+                        $UpdateFieldName ne 'ServiceID'
+                        && $UpdateFieldName ne 'SLAID'
+                        && defined $TicketParam{ $Self->{NameToID}{$CurrentField} }
+                        && $TicketParam{ $Self->{NameToID}{$CurrentField} } ne ''
+                        )
+                    {
+                        $FieldUpdate = 1;
+                    }
+
+                    $Success = 1;
+
+                    # check if field needs to be updated
+                    if ($FieldUpdate) {
+                        $Success = $Self->{TicketObject}->$TicketFieldSetSub(
+                            $UpdateFieldName => $TicketParam{ $Self->{NameToID}{$CurrentField} },
+                            TicketID         => $TicketID,
+                            UserID           => $Self->{UserID},
+                        );
+                    }
                 }
             }
---------------------------------------------------------------------
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.