[otrs-cvs] ITSMChangeManagement/bin otrs.ITSMChangesCheck.pl, 1.16, 1.16.4.1

"CVS commits notifications of OTRS.org" <[email protected]> Thu, 27 Jun 2013 21:03:47 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/ITSMChangeManagement/bin
In directory lancelot:/tmp/cvs-serv3299/bin

Modified Files:
      Tag: rel-3_2
	otrs.ITSMChangesCheck.pl 
Log Message:
Fixed bug# 6667 - When running otrs.ITSMChangesCheck.pl: Can't call method "FETCH" on an undefined value.

Author: ub

Index: otrs.ITSMChangesCheck.pl
===================================================================
RCS file: /home/cvs/ITSMChangeManagement/bin/otrs.ITSMChangesCheck.pl,v
retrieving revision 1.16
retrieving revision 1.16.4.1
diff -2 -u -d -r1.16 -r1.16.4.1
--- otrs.ITSMChangesCheck.pl	20 Nov 2012 19:03:03 -0000	1.16
+++ otrs.ITSMChangesCheck.pl	27 Jun 2013 21:03:42 -0000	1.16.4.1
@@ -2,5 +2,5 @@
 # --
 # bin/otrs.ITSMChangesCheck.pl - check itsm changes
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -108,5 +108,5 @@
 if ( exists $Opts{h} ) {
     print "otrs.ITSMChangesCheck.pl <Revision $VERSION> - check itsm changes\n";
-    print "Copyright (C) 2001-2012 OTRS AG, http://otrs.org/\n";
+    print "Copyright (C) 2001-2013 OTRS AG, http://otrs.org/\n";
     print "usage: otrs.ITSMChangesCheck.pl [-f force]\n\n";
     exit 1;
@@ -167,9 +167,15 @@
 
         my $LastNotificationSentDate = ChangeNotificationSent(
+            %CommonObject,
             ChangeID => $ChangeID,
             Type     => "Planned${Type}",
         );
 
-        next CHANGEID if SentWithinPeriod($LastNotificationSentDate);
+        my $AlreadySentWithinPeriod = SentWithinPeriod(
+            %CommonObject,
+            LastNotificationSentDate => $LastNotificationSentDate,
+        );
+
+        next CHANGEID if $AlreadySentWithinPeriod;
 
         # trigger ChangePlannedStartTimeReachedPost-Event
@@ -200,4 +206,5 @@
 
         my $LastNotificationSentDate = ChangeNotificationSent(
+            %CommonObject,
             ChangeID => $ChangeID,
             Type     => "Actual${Type}",
@@ -234,4 +241,5 @@
 
     my $LastNotificationSentDate = ChangeNotificationSent(
+        %CommonObject,
         ChangeID => $ChangeID,
         Type     => "RequestedTime",
@@ -273,9 +281,15 @@
 
         my $LastNotificationSentDate = WorkOrderNotificationSent(
+            %CommonObject,
             WorkOrderID => $WorkOrderID,
             Type        => "Planned${Type}",
         );
 
-        next WORKORDERID if SentWithinPeriod($LastNotificationSentDate);
+        my $AlreadySentWithinPeriod = SentWithinPeriod(
+            %CommonObject,
+            LastNotificationSentDate => $LastNotificationSentDate,
+        );
+
+        next WORKORDERID if $AlreadySentWithinPeriod;
 
         # trigger WorkOrderPlannedStartTimeReachedPost-Event
@@ -307,4 +321,5 @@
 
         my $LastNotificationSentDate = WorkOrderNotificationSent(
+            %CommonObject,
             WorkOrderID => $WorkOrderID,
             Type        => "Actual${Type}",
@@ -330,14 +345,14 @@
 # check if a notification was already sent for the given change
 sub ChangeNotificationSent {
-    my (%Param) = @_;
+    my (%CommonObject) = @_;
 
     # check needed stuff
     for my $Needed (qw(ChangeID Type)) {
-        return if !$Param{$Needed};
+        return if !$CommonObject{$Needed};
     }
 
     # get history entries
     my $History = $CommonObject{HistoryObject}->ChangeHistoryGet(
-        ChangeID => $Param{ChangeID},
+        ChangeID => $CommonObject{ChangeID},
         UserID   => 1,
     );
@@ -346,5 +361,5 @@
     for my $HistoryEntry ( reverse @{$History} ) {
         if (
-            $HistoryEntry->{HistoryType} eq 'Change' . $Param{Type} . 'Reached'
+            $HistoryEntry->{HistoryType} eq 'Change' . $CommonObject{Type} . 'Reached'
             && $HistoryEntry->{ContentNew} =~ m{ Notification \s Sent $ }xms
             )
@@ -359,14 +374,14 @@
 # check if a notification was already sent for the given workorder
 sub WorkOrderNotificationSent {
-    my (%Param) = @_;
+    my (%CommonObject) = @_;
 
     # check needed stuff
     for my $Needed (qw(WorkOrderID Type)) {
-        return if !$Param{$Needed};
+        return if !$CommonObject{$Needed};
     }
 
     # get history entries
     my $History = $CommonObject{HistoryObject}->WorkOrderHistoryGet(
-        WorkOrderID => $Param{WorkOrderID},
+        WorkOrderID => $CommonObject{WorkOrderID},
         UserID      => 1,
     );
@@ -375,5 +390,5 @@
     for my $HistoryEntry ( reverse @{$History} ) {
         if (
-            $HistoryEntry->{HistoryType} eq 'WorkOrder' . $Param{Type} . 'Reached'
+            $HistoryEntry->{HistoryType} eq 'WorkOrder' . $CommonObject{Type} . 'Reached'
             && $HistoryEntry->{ContentNew} =~ m{ Notification \s Sent }xms
             )
@@ -387,7 +402,8 @@
 
 sub SentWithinPeriod {
-    my $LastNotificationSentDate = shift;
 
-    return if !$LastNotificationSentDate;
+    my (%CommonObject) = @_;
+
+    return if !$CommonObject{LastNotificationSentDate};
 
     # get SysConfig option
@@ -399,5 +415,5 @@
     # get epoche seconds of send time
     my $SentEpoche = $CommonObject{TimeObject}->TimeStamp2SystemTime(
-        String => $LastNotificationSentDate,
+        String => $CommonObject{LastNotificationSentDate},
     );
 
---------------------------------------------------------------------
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