[otrs-cvs] CVS: ITSMCMDB/Kernel/Modules AgentITSMCMDB.pm,1.37,1.38

cvs-log at otrs.org cvs-log at otrs.org
Thu Nov 2 16:09:39 CET 2006


Update of /home/cvs/ITSMCMDB/Kernel/Modules
In directory lancelot:/tmp/cvs-serv17630/Kernel/Modules

Modified Files:
	AgentITSMCMDB.pm 
Log Message:
added customer selection

Index: AgentITSMCMDB.pm
===================================================================
RCS file: /home/cvs/ITSMCMDB/Kernel/Modules/AgentITSMCMDB.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** AgentITSMCMDB.pm	2 Nov 2006 14:30:46 -0000	1.37
--- AgentITSMCMDB.pm	2 Nov 2006 15:09:37 -0000	1.38
***************
*** 14,17 ****
--- 14,18 ----
  use strict;
  use Kernel::System::ITSMCMDB;
+ use Kernel::System::CustomerUser;
  
  use vars qw($VERSION);
***************
*** 36,39 ****
--- 37,41 ----
      }
      $Self->{ITSMCMDBObject} = Kernel::System::ITSMCMDB->new(%Param);
+     $Self->{CustomerUserObject} = Kernel::System::CustomerUser->new(%Param);
  
      return $Self;
***************
*** 763,766 ****
--- 765,781 ----
          $Content = $Year . '-' . $Month . '-' . $Day . ' ' . $Hour . ':' . $Minute;
      }
+     elsif ($Param{Type} eq 'CustomerSelect') {
+         my $ExpandCustomerName1 = $Self->{ParamObject}->GetParam(Param => $Param{Key}.'::ExpandCustomerName1');
+         my $ExpandCustomerName2 = $Self->{ParamObject}->GetParam(Param => $Param{Key}.'::ExpandCustomerName2');
+         if ($ExpandCustomerName1) {
+             $Content = $Self->{ParamObject}->GetParam(Param => $Param{Key}).'::ExpandCustomerName1';
+         }
+         elsif ($ExpandCustomerName1) {
+             $Content = $Self->{ParamObject}->GetParam(Param => $Param{Key}).'::ExpandCustomerName2';
+         }
+         else {
+             $Content = $Self->{ParamObject}->GetParam(Param => $Param{Key});
+         }
+     }
      else {
          $Content = $Self->{ParamObject}->GetParam(Param => $Param{Key});
***************
*** 986,989 ****
--- 1001,1035 ----
              );
          }
+         elsif ($Attribute->{Input}->{Type} eq 'CustomerSelect') {
+             my $ExpandCustomerName1 = '';
+             my $ExpandCustomerName2 = '';
+             if ($Attribute->{Input}->{Value} =~ /(.*)::(ExpandCustomerName(1|2))/) {
+                 $Attribute->{Input}->{Value} = $1;
+                 if ($3 == 1) {
+                      $ExpandCustomerName1 = 1;
+                 }
+                 elsif ($3 == 2) {
+                      $ExpandCustomerName1 = 1;
+                 }
+             }
+             my %CustomerUserList = ();
+             if ($ExpandCustomerName1) {
+                 %CustomerUserList = $Self->{CustomerUserObject}->CustomerSearch(
+                     Search => "*$Attribute->{Input}->{Value}*",
+                     ValidID => 1,
+                 );
+             }
+             my $Realname = '';
+             if ($Attribute->{Input}->{Value}) {
+                 $Realname = $Self->{CustomerUserObject}->CustomerName(
+                     UserLogin => $Attribute->{Input}->{Value},
+                 );
+             }
+             $Return = $Self->{LayoutObject}->ITSMCMDBInputCustomerSelect(
+                 %{$Attribute->{Input}},
+                 Realname => $Realname,
+                 Result => \%CustomerUserList,
+             );
+         }
          elsif ($Attribute->{Input}->{Type} eq 'DateTime') {
              my %InputParam;
***************
*** 1023,1026 ****
--- 1069,1081 ----
              $Return = ${$Attribute->{Input}}{Value} || '';
          }
+         elsif ($Attribute->{Input}->{Type} eq 'CustomerSelect') {
+             my $Realname = '';
+             if ($Attribute->{Input}->{Value}) {
+                 $Realname = $Self->{CustomerUserObject}->CustomerName(
+                     UserLogin => $Attribute->{Input}->{Value},
+                 );
+             }
+             $Return = "$Realname (${$Attribute->{Input}}{Value})" || '';
+         }
          else {
              $Return = ${$Attribute->{Input}}{Value} || '';



More information about the cvs-log mailing list