[otrs-cvs] otrs/Kernel/System CustomerCompany.pm,1.5,1.6

cvs-log at otrs.org cvs-log at otrs.org
Fri Feb 1 12:25:57 GMT 2008


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

Modified Files:
	CustomerCompany.pm 
Log Message:
Fixed ticket# 2008012242000417 - View performance problems if more then 1000 customer companies are in the database available.

Author: martin

Index: CustomerCompany.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/CustomerCompany.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CustomerCompany.pm	2 Oct 2007 10:37:19 -0000	1.5
--- CustomerCompany.pm	1 Feb 2008 12:25:52 -0000	1.6
***************
*** 1,5 ****
  # --
  # Kernel/System/CustomerCompany.pm - All customer company related function should be here eventually
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # Kernel/System/CustomerCompany.pm - All customer company related function should be here eventually
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
  # --
  # $Id$
***************
*** 7,11 ****
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  # --
  
--- 7,11 ----
  # This software comes with ABSOLUTELY NO WARRANTY. For details, see
  # the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  # --
  
***************
*** 86,89 ****
--- 86,97 ----
      $Self->{CustomerCompanyMap} = $Self->{ConfigObject}->Get('CustomerCompany')->{Map}
          || die "Need CustomerCompany->Map in Kernel/Config.pm!";
+     $Self->{SearchPrefix} = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchPrefix'};
+     if (!defined($Self->{SearchPrefix})) {
+         $Self->{SearchPrefix} = '';
+     }
+     $Self->{SearchSuffix} = $Self->{ConfigObject}->Get('CustomerCompany')->{'CustomerCompanySearchSuffix'};
+     if (!defined($Self->{SearchSuffix})) {
+         $Self->{SearchSuffix} = '*';
+     }
  
      # create new db connect if DSN is given
***************
*** 290,293 ****
--- 298,306 ----
      );
  
+     my %List = $ProjectObject->ProjectList(
+         Search => '*sometext*',
+         Limit => 10,
+     );
+ 
  =cut
  
***************
*** 301,304 ****
--- 314,318 ----
          $Valid = 0;
      }
+ 
      my $What = '';
      for ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{CustomerCompanyListFields} } ) {
***************
*** 308,312 ****
          $What .= "$_";
      }
! 
      # sql
      return $Self->{DBObject}->GetTableData(
--- 322,355 ----
          $What .= "$_";
      }
!     # where
!     my $SQL = '';
!     if ($Param{Search}) {
!         my $Count = 0;
!         my @Parts = split(/\+/, $Param{Search}, 6);
!         foreach my $Part (@Parts) {
!             $Part = $Self->{SearchPrefix}.$Part.$Self->{SearchSuffix};
!             $Part =~ s/\*/%/g;
!             $Part =~ s/%%/%/g;
!             if ($Count) {
!                 $SQL .= " AND ";
!             }
!             $Count ++;
!             if ($Self->{ConfigObject}->Get('CustomerCompany')->{CustomerCompanySearchFields}) {
!                 my $SQLExt = '';
!                 foreach (@{$Self->{ConfigObject}->Get('CustomerCompany')->{CustomerCompanySearchFields}}) {
!                     if ($SQLExt) {
!                         $SQLExt .= ' OR ';
!                     }
!                     $SQLExt .= " LOWER($_) LIKE LOWER('".$Self->{DBObject}->Quote($Part)."') ";
!                 }
!                 if ($SQLExt) {
!                     $SQL .= "($SQLExt)";
!                 }
!             }
!             else {
!                 $SQL .= " LOWER($Self->{CustomerKey}) LIKE LOWER('".$Self->{DBObject}->Quote($Part)."') ";
!             }
!         }
!     }
      # sql
      return $Self->{DBObject}->GetTableData(
***************
*** 315,318 ****
--- 358,362 ----
          Clamp => 1,
          Table => $Self->{CustomerCompanyTable},
+         Where => $SQL,
      );
  }
***************
*** 340,344 ****
  This software comes with ABSOLUTELY NO WARRANTY. For details, see
  the enclosed file COPYING for license information (GPL). If you
! did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
  
  =cut
--- 384,388 ----
  This software comes with ABSOLUTELY NO WARRANTY. For details, see
  the enclosed file COPYING for license information (GPL). If you
! did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
  
  =cut


More information about the cvs-log mailing list