[otrs-cvs] otrs/Kernel/System CustomerCompany.pm,1.2.2.1,1.2.2.2

cvs-log at otrs.org cvs-log at otrs.org
Fri Feb 1 14:03:04 GMT 2008


Comments:
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv18600/Kernel/System

Modified Files:
      Tag: rel-2_2
	CustomerCompany.pm 
Log Message:
Improved Limit option of List().

Author: martin

Index: CustomerCompany.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/CustomerCompany.pm,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -d -r1.2.2.1 -r1.2.2.2
*** CustomerCompany.pm	1 Feb 2008 12:22:27 -0000	1.2.2.1
--- CustomerCompany.pm	1 Feb 2008 14:02:59 -0000	1.2.2.2
***************
*** 86,89 ****
--- 86,91 ----
      $Self->{CustomerCompanyMap} = $Self->{ConfigObject}->Get('CustomerCompany')->{Map}
          || die "Need CustomerCompany->Map in Kernel/Config.pm!";
+     $Self->{CustomerCompanyValid} = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanyValid'};
+     $Self->{SearchListLimit} =  $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchListLimit'};
      $Self->{SearchPrefix} = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchPrefix'};
      if (!defined($Self->{SearchPrefix})) {
***************
*** 315,318 ****
--- 317,321 ----
      }
  
+     # what is the result
      my $What = '';
      for ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{CustomerCompanyListFields} } ) {
***************
*** 322,327 ****
          $What .= "$_";
      }
!     # where
      my $SQL = '';
      if ($Param{Search}) {
          my $Count = 0;
--- 325,336 ----
          $What .= "$_";
      }
! 
!     # add valid option if required
      my $SQL = '';
+     if ( $Valid ) {
+         $SQL .= "$Self->{CustomerCompanyValid} IN ( ${\(join ', ', $Self->{ValidObject}->ValidIDsGet())} )";
+     }
+ 
+     # where
      if ($Param{Search}) {
          my $Count = 0;
***************
*** 331,335 ****
              $Part =~ s/\*/%/g;
              $Part =~ s/%%/%/g;
!             if ($Count) {
                  $SQL .= " AND ";
              }
--- 340,344 ----
              $Part =~ s/\*/%/g;
              $Part =~ s/%%/%/g;
!             if ($Count || $SQL) {
                  $SQL .= " AND ";
              }
***************
*** 352,363 ****
          }
      }
      # sql
!     return $Self->{DBObject}->GetTableData(
!         What  => "$Self->{CustomerCompanyKey}, $What",
!         Valid => $Valid,
!         Clamp => 1,
!         Table => $Self->{CustomerCompanyTable},
!         Where => $SQL,
!     );
  }
  
--- 361,381 ----
          }
      }
+ 
      # sql
!     my %List = ();
!     $SQL = "SELECT $Self->{CustomerCompanyKey}, $What FROM $Self->{CustomerCompanyTable} WHERE $SQL";
! 
!     $Self->{DBObject}->Prepare( SQL => $SQL, Limit => $Self->{SearchListLimit});
!     while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
!         my $Value = '';
!         for my $Position ( 1..10 ) {
!             if ( $Value ) {
!                 $Value = " ";
!             }
!             $Value .= $Row[ $Position ];
!         }
!         $List{ $Row[0] } = $Value;
!     }
!     return %List;
  }
  


More information about the cvs-log mailing list