[otrs-cvs] CVS: otrs/Kernel/Modules AgentStats.pm,1.8,1.9
AgentTicketSearch.pm,1.24,1.25
cvs-log at otrs.org
cvs-log at otrs.org
Tue Aug 22 18:08:23 CEST 2006
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv22078/Kernel/Modules
Modified Files:
AgentStats.pm AgentTicketSearch.pm
Log Message:
optimize loops for better infinite loop protection
Index: AgentStats.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentStats.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** AgentStats.pm 21 Aug 2006 19:13:41 -0000 1.8
--- AgentStats.pm 22 Aug 2006 15:08:21 -0000 1.9
***************
*** 1922,1925 ****
--- 1922,1930 ----
$ENV{REQUEST_URI};
}
+ # get maximum number of pages
+ my $MaxPages = $Self->{ConfigObject}->Get('PDF::MaxPages');
+ if (!$MaxPages || $MaxPages < 1 || $MaxPages > 1000) {
+ $MaxPages = 100;
+ }
# create the header
my $CellData;
***************
*** 1973,1981 ****
$TableParam{PaddingTop} = 3;
$TableParam{PaddingBottom} = 3;
! # get maximum number of pages
! my $MaxPages = $Self->{ConfigObject}->Get('PDF::MaxPages');
! if (!$MaxPages || $MaxPages < 1 || $MaxPages > 1000) {
! $MaxPages = 100;
! }
# create new pdf document
$Self->{PDFObject}->DocumentNew(
--- 1978,1982 ----
$TableParam{PaddingTop} = 3;
$TableParam{PaddingBottom} = 3;
!
# create new pdf document
$Self->{PDFObject}->DocumentNew(
***************
*** 1983,2015 ****
);
# start table output
! my $Loop = 1;
! my $Counter = 1;
! while ($Loop) {
! # if first page
! if ($Counter eq 1) {
! $Self->{PDFObject}->PageNew(
! %PageParam,
! FooterRight => $Page . ' ' . $Counter,
! );
! }
# output table (or a fragment of it)
%TableParam = $Self->{PDFObject}->Table(
%TableParam,
);
! # stop output or another page
if ($TableParam{State}) {
! $Loop = 0;
}
else {
$Self->{PDFObject}->PageNew(
%PageParam,
! FooterRight => $Page . ' ' . ($Counter + 1),
);
}
- $Counter++;
- # check max pages
- if ($Counter >= $MaxPages) {
- $Loop = 0
- }
}
# return the pdf document
--- 1984,2006 ----
);
# start table output
! $Self->{PDFObject}->PageNew(
! %PageParam,
! FooterRight => $Page . ' 1',
! );
! for (2..$MaxPages) {
# output table (or a fragment of it)
%TableParam = $Self->{PDFObject}->Table(
%TableParam,
);
! # stop output or output next page
if ($TableParam{State}) {
! last;
}
else {
$Self->{PDFObject}->PageNew(
%PageParam,
! FooterRight => $Page . ' ' . $_,
);
}
}
# return the pdf document
Index: AgentTicketSearch.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketSearch.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** AgentTicketSearch.pm 21 Aug 2006 19:13:41 -0000 1.24
--- AgentTicketSearch.pm 22 Aug 2006 15:08:21 -0000 1.25
***************
*** 519,522 ****
--- 519,527 ----
$ENV{REQUEST_URI};
}
+ # get maximum number of pages
+ my $MaxPages = $Self->{ConfigObject}->Get('PDF::MaxPages');
+ if (!$MaxPages || $MaxPages < 1 || $MaxPages > 1000) {
+ $MaxPages = 100;
+ }
# create the header
my $CellData;
***************
*** 577,585 ****
$TableParam{PaddingTop} = 3;
$TableParam{PaddingBottom} = 3;
! # get maximum number of pages
! my $MaxPages = $Self->{ConfigObject}->Get('PDF::MaxPages');
! if (!$MaxPages || $MaxPages < 1 || $MaxPages > 1000) {
! $MaxPages = 100;
! }
# create new pdf document
$Self->{PDFObject}->DocumentNew(
--- 582,586 ----
$TableParam{PaddingTop} = 3;
$TableParam{PaddingBottom} = 3;
!
# create new pdf document
$Self->{PDFObject}->DocumentNew(
***************
*** 587,600 ****
);
# start table output
! my $Loop = 1;
! my $Counter = 1;
! while ($Loop) {
! # if first page
! if ($Counter eq 1) {
! $Self->{PDFObject}->PageNew(
! %PageParam,
! FooterRight => $Page . ' ' . $Counter,
! );
! }
# output table (or a fragment of it)
%TableParam = $Self->{PDFObject}->Table(
--- 588,596 ----
);
# start table output
! $Self->{PDFObject}->PageNew(
! %PageParam,
! FooterRight => $Page . ' 1',
! );
! for (2..$MaxPages) {
# output table (or a fragment of it)
%TableParam = $Self->{PDFObject}->Table(
***************
*** 603,619 ****
# stop output or another page
if ($TableParam{State}) {
! $Loop = 0;
}
else {
$Self->{PDFObject}->PageNew(
%PageParam,
! FooterRight => $Page . ' ' . ($Counter + 1),
);
}
- $Counter++;
- # check max pages
- if ($Counter >= $MaxPages) {
- $Loop = 0
- }
}
# return the pdf document
--- 599,610 ----
# stop output or another page
if ($TableParam{State}) {
! last;
}
else {
$Self->{PDFObject}->PageNew(
%PageParam,
! FooterRight => $Page . ' ' . $_,
);
}
}
# return the pdf document
More information about the cvs-log
mailing list