[otrs-cvs] otrs/Kernel/Modules AdminCustomerCompany.pm,1.1,1.1.2.1
cvs-log at otrs.org
cvs-log at otrs.org
Fri Feb 1 12:22:32 GMT 2008
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv13106/Kernel/Modules
Modified Files:
Tag: rel-2_2
AdminCustomerCompany.pm
Log Message:
Fixed ticket# 2008012242000417 - View performance problems if more then 1000 customer companies are in the database available.
Author: martin
Index: AdminCustomerCompany.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminCustomerCompany.pm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** AdminCustomerCompany.pm 2 Apr 2007 13:13:15 -0000 1.1
--- AdminCustomerCompany.pm 1 Feb 2008 12:22:27 -0000 1.1.2.1
***************
*** 1,5 ****
# --
# Kernel/Modules/AdminCustomerCompany.pm - to add/update/delete system addresses
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
# --
# $Id$
--- 1,5 ----
# --
# Kernel/Modules/AdminCustomerCompany.pm - to add/update/delete system addresses
! # 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.
# --
***************
*** 13,44 ****
use strict;
use Kernel::System::CustomerCompany;
use Kernel::System::Valid;
use vars qw($VERSION);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
sub new {
! my $Type = shift;
! my %Param = @_;
# allocate new hash for object
! my $Self = {};
! bless ($Self, $Type);
!
! # allocate new hash for objects
! foreach (keys %Param) {
! $Self->{$_} = $Param{$_};
! }
# check all needed objects
! foreach (qw(ParamObject DBObject LayoutObject ConfigObject LogObject)) {
! if (!$Self->{$_}) {
! $Self->{LayoutObject}->FatalError(Message => "Got no $_!");
}
}
$Self->{CustomerCompanyObject} = Kernel::System::CustomerCompany->new(%Param);
! $Self->{ValidObject} = Kernel::System::Valid->new(%Param);
return $Self;
--- 13,39 ----
use strict;
+ use warnings;
+
use Kernel::System::CustomerCompany;
use Kernel::System::Valid;
use vars qw($VERSION);
! $VERSION = qw($Revision$) [1];
sub new {
! my ( $Type, %Param ) = @_;
# allocate new hash for object
! my $Self = {%Param};
! bless( $Self, $Type );
# check all needed objects
! for (qw(ParamObject DBObject LayoutObject ConfigObject LogObject)) {
! if ( !$Self->{$_} ) {
! $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
}
}
$Self->{CustomerCompanyObject} = Kernel::System::CustomerCompany->new(%Param);
! $Self->{ValidObject} = Kernel::System::Valid->new(%Param);
return $Self;
***************
*** 46,60 ****
sub Run {
! my $Self = shift;
! my %Param = @_;
# ------------------------------------------------------------ #
# change
# ------------------------------------------------------------ #
! if ($Self->{Subaction} eq 'Change') {
! my $CustomerID = $Self->{ParamObject}->GetParam(Param => 'CustomerID') || '';
! my %Data = $Self->{CustomerCompanyObject}->CustomerCompanyGet(
! CustomerID => $CustomerID,
! );
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
--- 41,52 ----
sub Run {
! my ( $Self, %Param ) = @_;
# ------------------------------------------------------------ #
# change
# ------------------------------------------------------------ #
! if ( $Self->{Subaction} eq 'Change' ) {
! my $CustomerID = $Self->{ParamObject}->GetParam( Param => 'CustomerID' ) || '';
! my %Data = $Self->{CustomerCompanyObject}->CustomerCompanyGet( CustomerID => $CustomerID, );
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
***************
*** 65,94 ****
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# ------------------------------------------------------------ #
# change action
# ------------------------------------------------------------ #
! elsif ($Self->{Subaction} eq 'ChangeAction') {
my $Note = '';
my %GetParam;
! foreach my $Entry (@{$Self->{ConfigObject}->Get('CustomerCompany')->{Map}}) {
! $GetParam{$Entry->[0]} = $Self->{ParamObject}->GetParam(Param => $Entry->[0]) || '';
}
! foreach (qw(CustomerID)) {
! $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_) || '';
}
# update group
! if ($Self->{CustomerCompanyObject}->CustomerCompanyUpdate(%GetParam, UserID => $Self->{UserID})) {
$Self->_Overview();
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify(Info => 'Updated!');
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
--- 57,90 ----
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
+
# ------------------------------------------------------------ #
# change action
# ------------------------------------------------------------ #
! elsif ( $Self->{Subaction} eq 'ChangeAction' ) {
my $Note = '';
my %GetParam;
! for my $Entry ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{Map} } ) {
! $GetParam{ $Entry->[0] } = $Self->{ParamObject}->GetParam( Param => $Entry->[0] ) || '';
}
! for (qw(CustomerID)) {
! $GetParam{$_} = $Self->{ParamObject}->GetParam( Param => $_ ) || '';
}
+
# update group
! if ( $Self->{CustomerCompanyObject}
! ->CustomerCompanyUpdate( %GetParam, UserID => $Self->{UserID} ) )
! {
$Self->_Overview();
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify( Info => 'Updated!' );
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
***************
*** 98,102 ****
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify(Priority => 'Error');
$Self->_Edit(
Action => "Change",
--- 94,98 ----
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify( Priority => 'Error' );
$Self->_Edit(
Action => "Change",
***************
*** 105,109 ****
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
--- 101,105 ----
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
***************
*** 111,121 ****
}
}
# ------------------------------------------------------------ #
# add
# ------------------------------------------------------------ #
! elsif ($Self->{Subaction} eq 'Add') {
my %GetParam = ();
! foreach (qw(Name)) {
! $GetParam{$_} = $Self->{ParamObject}->GetParam(Param => $_);
}
my $Output = $Self->{LayoutObject}->Header();
--- 107,118 ----
}
}
+
# ------------------------------------------------------------ #
# add
# ------------------------------------------------------------ #
! elsif ( $Self->{Subaction} eq 'Add' ) {
my %GetParam = ();
! for (qw(Name)) {
! $GetParam{$_} = $Self->{ParamObject}->GetParam( Param => $_ );
}
my $Output = $Self->{LayoutObject}->Header();
***************
*** 127,153 ****
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# ------------------------------------------------------------ #
# add action
# ------------------------------------------------------------ #
! elsif ($Self->{Subaction} eq 'AddAction') {
my $Note = '';
my %GetParam;
! foreach my $Entry (@{$Self->{ConfigObject}->Get('CustomerCompany')->{Map}}) {
! $GetParam{$Entry->[0]} = $Self->{ParamObject}->GetParam(Param => $Entry->[0]) || '';
}
# add user
! if (my $AddressID = $Self->{CustomerCompanyObject}->CustomerCompanyAdd(%GetParam, UserID => $Self->{UserID})) {
$Self->_Overview();
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify(Info => 'Added!');
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
--- 124,155 ----
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
+
# ------------------------------------------------------------ #
# add action
# ------------------------------------------------------------ #
! elsif ( $Self->{Subaction} eq 'AddAction' ) {
my $Note = '';
my %GetParam;
! for my $Entry ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{Map} } ) {
! $GetParam{ $Entry->[0] } = $Self->{ParamObject}->GetParam( Param => $Entry->[0] ) || '';
}
+
# add user
! if ( my $AddressID
! = $Self->{CustomerCompanyObject}
! ->CustomerCompanyAdd( %GetParam, UserID => $Self->{UserID} ) )
! {
$Self->_Overview();
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify( Info => 'Added!' );
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
***************
*** 157,161 ****
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify(Priority => 'Error');
$Self->_Edit(
Action => "Add",
--- 159,163 ----
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
! $Output .= $Self->{LayoutObject}->Notify( Priority => 'Error' );
$Self->_Edit(
Action => "Add",
***************
*** 164,168 ****
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
--- 166,170 ----
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
***************
*** 170,173 ****
--- 172,176 ----
}
}
+
# ------------------------------------------------------------
# overview
***************
*** 179,183 ****
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
--- 182,186 ----
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminCustomerCompanyForm',
! Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
***************
*** 188,207 ****
sub _Edit {
! my $Self = shift;
! my %Param = @_;
$Self->{LayoutObject}->Block(
Name => 'Overview',
! Data => \%Param,
);
$Self->{LayoutObject}->Block(
Name => 'OverviewUpdate',
- Data => \%Param,
- );
- $Param{'ValidOption'} = $Self->{LayoutObject}->OptionStrgHashRef(
Data => {
! $Self->{ValidObject}->ValidList(),
},
! Name => 'ValidID',
SelectedID => $Param{ValidID},
);
--- 191,214 ----
sub _Edit {
! my ( $Self, %Param ) = @_;
! my $Search = $Self->{ParamObject}->GetParam(Param => 'Search') || '';
$Self->{LayoutObject}->Block(
Name => 'Overview',
! Data => {
! %Param,
! Search => $Search,
! },
);
$Self->{LayoutObject}->Block(
Name => 'OverviewUpdate',
Data => {
! %Param,
! Search => $Search,
},
! );
! $Param{'ValidOption'} = $Self->{LayoutObject}->OptionStrgHashRef(
! Data => { $Self->{ValidObject}->ValidList(), },
! Name => 'ValidID',
SelectedID => $Param{ValidID},
);
***************
*** 209,253 ****
Data => {
$Self->{DBObject}->GetTableData(
! What => 'id, name',
Table => 'queue',
Valid => 1,
)
},
! Name => 'QueueID',
! SelectedID => $Param{QueueID},
OnChangeSubmit => 0,
);
! foreach my $Entry (@{$Self->{ConfigObject}->Get('CustomerCompany')->{Map}}) {
! if ($Entry->[0]) {
my $Block = 'Input';
# build selections or input fields
! if ($Self->{ConfigObject}->Get('CustomerCompany')->{Selections}->{$Entry->[0]}) {
# build ValidID string
$Block = 'Option';
$Param{Option} = $Self->{LayoutObject}->OptionStrgHashRef(
! Data => $Self->{ConfigObject}->Get('CustomerCompany')->{Selections}->{$Entry->[0]},
! Name => $Entry->[0],
LanguageTranslation => 0,
! SelectedID => $Param{$Entry->[0]},
! Max => 35,
);
}
! elsif ($Entry->[0] =~ /^ValidID/i) {
# build ValidID string
$Block = 'Option';
$Param{Option} = $Self->{LayoutObject}->OptionStrgHashRef(
! Data => {
! $Self->{ValidObject}->ValidList(),
! },
! Name => $Entry->[0],
! SelectedID => defined ($Param{$Entry->[0]}) ? $Param{$Entry->[0]} : 1,
);
}
else {
! $Param{Value} = $Param{$Entry->[0]} || '';
}
# show required flag
! if ($Entry->[4]) {
$Param{Required} = '*';
}
--- 216,263 ----
Data => {
$Self->{DBObject}->GetTableData(
! What => 'id, name',
Table => 'queue',
Valid => 1,
)
},
! Name => 'QueueID',
! SelectedID => $Param{QueueID},
OnChangeSubmit => 0,
);
! for my $Entry ( @{ $Self->{ConfigObject}->Get('CustomerCompany')->{Map} } ) {
! if ( $Entry->[0] ) {
my $Block = 'Input';
+
# build selections or input fields
! if ( $Self->{ConfigObject}->Get('CustomerCompany')->{Selections}->{ $Entry->[0] } ) {
!
# build ValidID string
$Block = 'Option';
$Param{Option} = $Self->{LayoutObject}->OptionStrgHashRef(
! Data => $Self->{ConfigObject}->Get('CustomerCompany')->{Selections}
! ->{ $Entry->[0] },
! Name => $Entry->[0],
LanguageTranslation => 0,
! SelectedID => $Param{ $Entry->[0] },
! Max => 35,
);
}
! elsif ( $Entry->[0] =~ /^ValidID/i ) {
!
# build ValidID string
$Block = 'Option';
$Param{Option} = $Self->{LayoutObject}->OptionStrgHashRef(
! Data => { $Self->{ValidObject}->ValidList(), },
! Name => $Entry->[0],
! SelectedID => defined( $Param{ $Entry->[0] } ) ? $Param{ $Entry->[0] } : 1,
);
}
else {
! $Param{Value} = $Param{ $Entry->[0] } || '';
}
+
# show required flag
! if ( $Entry->[4] ) {
$Param{Required} = '*';
}
***************
*** 255,260 ****
$Param{Required} = '';
}
# add form option
! if ($Param{Type} && $Param{Type} eq 'hidden') {
$Param{Preferences} .= $Param{Value};
}
--- 265,271 ----
$Param{Required} = '';
}
+
# add form option
! if ( $Param{Type} && $Param{Type} eq 'hidden' ) {
$Param{Preferences} .= $Param{Value};
}
***************
*** 262,266 ****
$Self->{LayoutObject}->Block(
Name => 'PreferencesGeneric',
! Data => { Item => $Entry->[1], %Param},
);
$Self->{LayoutObject}->Block(
--- 273,277 ----
$Self->{LayoutObject}->Block(
Name => 'PreferencesGeneric',
! Data => { Item => $Entry->[1], %Param },
);
$Self->{LayoutObject}->Block(
***************
*** 268,274 ****
Data => {
%Param,
! Item => $Entry->[1],
! Name => $Entry->[0],
! Value => $Param{$Entry->[0]},
},
);
--- 279,285 ----
Data => {
%Param,
! Item => $Entry->[1],
! Name => $Entry->[0],
! Value => $Param{ $Entry->[0] },
},
);
***************
*** 280,304 ****
sub _Overview {
! my $Self = shift;
! my %Param = @_;
my $Output = '';
$Self->{LayoutObject}->Block(
Name => 'Overview',
! Data => \%Param,
);
$Self->{LayoutObject}->Block(
Name => 'OverviewResult',
! Data => \%Param,
! );
! my %List = $Self->{CustomerCompanyObject}->CustomerCompanyList(
! Valid => 0,
);
# get valid list
my %ValidList = $Self->{ValidObject}->ValidList();
! my $CssClass = '';
! foreach (sort {$List{$a} cmp $List{$b}} keys %List) {
# set output class
! if ($CssClass && $CssClass eq 'searchactive') {
$CssClass = 'searchpassive';
}
--- 291,327 ----
sub _Overview {
! my ( $Self, %Param ) = @_;
! my $Search = $Self->{ParamObject}->GetParam(Param => 'Search') || '';
my $Output = '';
$Self->{LayoutObject}->Block(
Name => 'Overview',
! Data => {
! %Param,
! Search => $Search,
! },
);
$Self->{LayoutObject}->Block(
Name => 'OverviewResult',
! Data => {
! %Param,
! Search => $Search,
! },
);
+ my %List = ();
+ if ($Search) {
+ %List = $Self->{CustomerCompanyObject}->CustomerCompanyList(
+ Search => $Search,
+ Valid => 0,
+ );
+ }
+
# get valid list
my %ValidList = $Self->{ValidObject}->ValidList();
! my $CssClass = '';
! for ( sort { $List{$a} cmp $List{$b} } keys %List ) {
!
# set output class
! if ( $CssClass && $CssClass eq 'searchactive' ) {
$CssClass = 'searchpassive';
}
***************
*** 306,318 ****
$CssClass = 'searchactive';
}
! my %Data = $Self->{CustomerCompanyObject}->CustomerCompanyGet(
! CustomerID => $_,
! );
$Self->{LayoutObject}->Block(
Name => 'OverviewResultRow',
Data => {
! Valid => $ValidList{$Data{ValidID}},
CssClass => $CssClass,
%Data,
},
);
--- 329,340 ----
$CssClass = 'searchactive';
}
! my %Data = $Self->{CustomerCompanyObject}->CustomerCompanyGet( CustomerID => $_, );
$Self->{LayoutObject}->Block(
Name => 'OverviewResultRow',
Data => {
! Valid => $ValidList{ $Data{ValidID} },
CssClass => $CssClass,
%Data,
+ Search => $Search,
},
);
More information about the cvs-log
mailing list