[otrs-cvs] CVS: otrs/Kernel/System/Ticket Article.pm,1.128,1.129

cvs-log at otrs.org cvs-log at otrs.org
Tue Jan 9 03:37:09 CET 2007


Update of /home/cvs/otrs/Kernel/System/Ticket
In directory lancelot:/tmp/cvs-serv12073/Kernel/System/Ticket

Modified Files:
	Article.pm 
Log Message:
fixed not working email notification tags in auto response, agent and customer email notifications

Index: Article.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Ticket/Article.pm,v
retrieving revision 1.128
retrieving revision 1.129
diff -C2 -r1.128 -r1.129
*** Article.pm	15 Nov 2006 07:29:19 -0000	1.128
--- Article.pm	9 Jan 2007 02:37:07 -0000	1.129
***************
*** 1,5 ****
  # --
  # Kernel/System/Ticket/Article.pm - global article module for OTRS kernel
! # Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # Kernel/System/Ticket/Article.pm - global article module for OTRS kernel
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
***************
*** 1275,1279 ****
          $Data{TicketFreeTime1} = $Row[67];
          $Data{TicketFreeTime2} = $Row[68];
- 
          $Data{IncomingTime} = $Row[30];
          $Data{RealTillTimeNotUsed} = $Row[17];
--- 1275,1278 ----
***************
*** 1713,1735 ****
      $Notification{Body} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
      $Notification{Subject} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
  
      # get owner data and replace it with <OTRS_OWNER_...
!     my %Preferences = $Self->{UserObject}->GetUserData(UserID => $Article{OwnerID});
!     foreach (keys %Preferences) {
!         if ($Preferences{$_}) {
!             $Notification{Body} =~ s/<OTRS_OWNER_$_>/$Preferences{$_}/gi;
!             $Notification{Subject} =~ s/<OTRS_OWNER_$_>/$Preferences{$_}/gi;
          }
      }
      # get owner data and replace it with <OTRS_RESPONSIBLE_...
!     if ($Self->{ConfigObject}->Get('Ticket::Responsible') && $Article{ResponsibleID}) {
!         my %Preferences = $Self->{UserObject}->GetUserData(UserID => $Article{ResponsibleID});
!         foreach (keys %Preferences) {
!             if ($Preferences{$_}) {
!                 $Notification{Body} =~ s/<OTRS_RESPONSIBLE_$_>/$Preferences{$_}/gi;
!                 $Notification{Subject} =~ s/<OTRS_RESPONSIBLE_$_>/$Preferences{$_}/gi;
!             }
          }
      }
      # get current user data
      my %CurrentUser = $Self->{UserObject}->GetUserData(UserID => $Param{UserID});
--- 1712,1743 ----
      $Notification{Body} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
      $Notification{Subject} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_CONFIG_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_CONFIG_.+?>/-/gi;
  
      # get owner data and replace it with <OTRS_OWNER_...
!     my %OwnerPreferences = $Self->{UserObject}->GetUserData(UserID => $Article{OwnerID});
!     foreach (keys %OwnerPreferences) {
!         if ($OwnerPreferences{$_}) {
!             $Notification{Body} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
!             $Notification{Subject} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
          }
      }
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_OWNER_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_OWNER_.+?>/-/gi;
+ 
      # get owner data and replace it with <OTRS_RESPONSIBLE_...
!     my %ResponsiblePreferences = $Self->{UserObject}->GetUserData(UserID => $Article{ResponsibleID});
!     foreach (keys %ResponsiblePreferences) {
!         if ($ResponsiblePreferences{$_}) {
!             $Notification{Body} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
!             $Notification{Subject} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
          }
      }
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+ 
      # get current user data
      my %CurrentUser = $Self->{UserObject}->GetUserData(UserID => $Param{UserID});
***************
*** 1740,1743 ****
--- 1748,1755 ----
          }
      }
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_CURRENT_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_CURRENT_.+?>/-/gi;
+ 
      # replace it with given user params
      foreach (keys %User) {
***************
*** 1756,1763 ****
      }
      # COMPAT
!     $Notification{Body} =~ s/<OTRS_TICKET_ID>/$Param{TicketID}/g;
!     $Notification{Body} =~ s/<OTRS_TICKET_NUMBER>/$Article{TicketNumber}/g;
!     $Notification{Body} =~ s/<OTRS_QUEUE>/$Article{Queue}/g;
!     $Notification{Body} =~ s/<OTRS_COMMENT>/$GetParam{Comment}/g if (defined $GetParam{Comment});
  
      # prepare subject (insert old subject)
--- 1768,1778 ----
      }
      # COMPAT
!     $Notification{Body} =~ s/<OTRS_TICKET_ID>/$Param{TicketID}/gi;
!     $Notification{Body} =~ s/<OTRS_TICKET_NUMBER>/$Article{TicketNumber}/gi;
!     $Notification{Body} =~ s/<OTRS_QUEUE>/$Article{Queue}/gi;
!     $Notification{Body} =~ s/<OTRS_COMMENT>/$GetParam{Comment}/gi if (defined $GetParam{Comment});
!     # cleanup
!     $Notification{Subject} =~ s/<OTRS_TICKET_.+?>/-/gi;
!     $Notification{Body} =~ s/<OTRS_TICKET_.+?>/-/gi;
  
      # prepare subject (insert old subject)
***************
*** 1800,1808 ****
              $Notification{Body} =~ s/<OTRS_$_>/$Article{$_}/gi;
          }
-         else {
-             # cleanup
-             $Notification{Subject} =~ s/<OTRS_$_>//gi;
-             $Notification{Body} =~ s/<OTRS_$_>//gi;
-         }
      }
  
--- 1815,1818 ----
***************
*** 1834,1838 ****
      $Self->{SendmailObject}->Send(
          From => $Self->{ConfigObject}->Get('NotificationSenderName').
!              ' <'.$Self->{ConfigObject}->Get('NotificationSenderEmail').'>',
          To => $User{UserEmail},
          Subject => $Notification{Subject},
--- 1844,1848 ----
      $Self->{SendmailObject}->Send(
          From => $Self->{ConfigObject}->Get('NotificationSenderName').
!             ' <'.$Self->{ConfigObject}->Get('NotificationSenderEmail').'>',
          To => $User{UserEmail},
          Subject => $Notification{Subject},
***************
*** 1963,1971 ****
      $Notification{Body} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
      $Notification{Subject} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
  
      # COMPAT
!     $Notification{Body} =~ s/<OTRS_TICKET_ID>/$Param{TicketID}/g;
!     $Notification{Body} =~ s/<OTRS_TICKET_NUMBER>/$Article{TicketNumber}/g;
!     $Notification{Body} =~ s/<OTRS_QUEUE>/$Param{Queue}/g if ($Param{Queue});
      # ticket data
      my %Ticket = $Self->TicketGet(TicketID => $Param{TicketID});
--- 1973,1984 ----
      $Notification{Body} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
      $Notification{Subject} =~ s{<OTRS_CONFIG_(.+?)>}{$Self->{ConfigObject}->Get($1)}egx;
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_CONFIG_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_CONFIG_.+?>/-/gi;
  
      # COMPAT
!     $Notification{Body} =~ s/<OTRS_TICKET_ID>/$Param{TicketID}/gi;
!     $Notification{Body} =~ s/<OTRS_TICKET_NUMBER>/$Article{TicketNumber}/gi;
!     $Notification{Body} =~ s/<OTRS_QUEUE>/$Param{Queue}/gi if ($Param{Queue});
      # ticket data
      my %Ticket = $Self->TicketGet(TicketID => $Param{TicketID});
***************
*** 1980,1996 ****
      $Notification{Body} =~ s/<OTRS_TICKET_.+?>/-/gi;
  
-     # get owner data
-     my ($OwnerID, $Owner) = $Self->OwnerCheck(TicketID => $Param{TicketID});
-     my %Preferences = $Self->{UserObject}->GetUserData(UserID => $OwnerID);
-     foreach (keys %Preferences) {
-         if ($Preferences{$_}) {
-             $Notification{Body} =~ s/<OTRS_OWNER_$_>/$Preferences{$_}/gi;
-             $Notification{Subject} =~ s/<OTRS_OWNER_$_>/$Preferences{$_}/gi;
-         }
-     }
-     # cleanup
-     $Notification{Subject} =~ s/<OTRS_OWNER_.+?>/-/gi;
-     $Notification{Body} =~ s/<OTRS_OWNER_.+?>/-/gi;
- 
      # get current user data
      my %CurrentPreferences = $Self->{UserObject}->GetUserData(UserID => $Param{UserID});
--- 1993,1996 ----
***************
*** 2005,2008 ****
--- 2005,2036 ----
      $Notification{Body} =~ s/<OTRS_CURRENT_.+?>/-/gi;
  
+     # get owner data
+     my %OwnerPreferences = $Self->{UserObject}->GetUserData(
+         UserID => $Article{OwnerID},
+     );
+     foreach (keys %OwnerPreferences) {
+         if ($OwnerPreferences{$_}) {
+             $Notification{Body} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
+             $Notification{Subject} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
+         }
+     }
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_OWNER_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_OWNER_.+?>/-/gi;
+ 
+     # get responsible data
+     my %ResponsiblePreferences = $Self->{UserObject}->GetUserData(
+         UserID => $Article{ResponsibleID},
+     );
+     foreach (keys %ResponsiblePreferences) {
+         if ($ResponsiblePreferences{$_}) {
+             $Notification{Body} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
+             $Notification{Subject} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
+         }
+     }
+     # cleanup
+     $Notification{Subject} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+     $Notification{Body} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+ 
      # get ref of email params
      my %GetParam = %{$Param{CustomerMessageParams}};
***************
*** 2069,2072 ****
--- 2097,2103 ----
          $Notification{Body} =~ s/<OTRS_CUSTOMER_EMAIL\[.+?\]>/$NewOldBody/g;
      }
+     # cleanup all not needed <OTRS_CUSTOMER_ tags
+     $Notification{Body} =~ s/<OTRS_CUSTOMER_.+?>/-/gi;
+     $Notification{Subject} =~ s/<OTRS_CUSTOMER_.+?>/-/gi;
  
      # send notify
***************
*** 2175,2178 ****
--- 2206,2251 ----
          }
      }
+ 
+     # get current user data
+     my %CurrentPreferences = $Self->{UserObject}->GetUserData(UserID => $Param{UserID});
+     foreach (keys %CurrentPreferences) {
+         if ($CurrentPreferences{$_}) {
+             $Param{Body} =~ s/<OTRS_CURRENT_$_>/$CurrentPreferences{$_}/gi;
+             $Param{Subject} =~ s/<OTRS_CURRENT_$_>/$CurrentPreferences{$_}/gi;
+         }
+     }
+     # cleanup
+     $Param{Subject} =~ s/<OTRS_CURRENT_.+?>/-/gi;
+     $Param{Body} =~ s/<OTRS_CURRENT_.+?>/-/gi;
+ 
+     # get owner data
+     my %OwnerPreferences = $Self->{UserObject}->GetUserData(
+         UserID => $Article{OwnerID},
+     );
+     foreach (keys %OwnerPreferences) {
+         if ($OwnerPreferences{$_}) {
+             $Param{Body} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
+             $Param{Subject} =~ s/<OTRS_OWNER_$_>/$OwnerPreferences{$_}/gi;
+         }
+     }
+     # cleanup
+     $Param{Subject} =~ s/<OTRS_OWNER_.+?>/-/gi;
+     $Param{Body} =~ s/<OTRS_OWNER_.+?>/-/gi;
+ 
+     # get responsible data
+     my %ResponsiblePreferences = $Self->{UserObject}->GetUserData(
+         UserID => $Article{ResponsibleID},
+     );
+     foreach (keys %ResponsiblePreferences) {
+         if ($ResponsiblePreferences{$_}) {
+             $Param{Body} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
+             $Param{Subject} =~ s/<OTRS_RESPONSIBLE_$_>/$ResponsiblePreferences{$_}/gi;
+         }
+     }
+ 
+     # cleanup
+     $Param{Subject} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+     $Param{Body} =~ s/<OTRS_RESPONSIBLE_.+?>/-/gi;
+ 
      # ticket data
      my %Ticket = $Self->TicketGet(TicketID => $Param{TicketID});
***************
*** 2270,2273 ****
--- 2343,2350 ----
          $Param{Body} =~ s/<OTRS_CUSTOMER_EMAIL\[.+?\]>/$NewOldBody/g;
      }
+     # cleanup all not needed <OTRS_CUSTOMER_ tags
+     $Param{Body} =~ s/<OTRS_CUSTOMER_.+?>/-/gi;
+     $Param{Subject} =~ s/<OTRS_CUSTOMER_.+?>/-/gi;
+ 
      # set new To address if customer user id is used
      my $Cc = '';



More information about the cvs-log mailing list