[otrs-cvs] CVS: otrs/Kernel/Modules AgentStats.pm,1.7,1.8 AgentTicketSearch.pm,1.23,1.24

cvs-log at otrs.org cvs-log at otrs.org
Mon Aug 21 22:13:43 CEST 2006


Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv31667/Kernel/Modules

Modified Files:
	AgentStats.pm AgentTicketSearch.pm 
Log Message:
use new Table() in PDF.pm

Index: AgentStats.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentStats.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** AgentStats.pm	7 Aug 2006 18:39:02 -0000	1.7
--- AgentStats.pm	21 Aug 2006 19:13:41 -0000	1.8
***************
*** 1916,1920 ****
                  my $Page = $Self->{LayoutObject}->{LanguageObject}->Get('Page');
                  my $Time = $Self->{LayoutObject}->Output(Template => '$Env{"Time"}');
!                 my $Url = '';
                  if ($ENV{REQUEST_URI}) {
                      $Url = $Self->{ConfigObject}->Get('HttpType') . '://' .
--- 1916,1920 ----
                  my $Page = $Self->{LayoutObject}->{LanguageObject}->Get('Page');
                  my $Time = $Self->{LayoutObject}->Output(Template => '$Env{"Time"}');
!                 my $Url = ' ';
                  if ($ENV{REQUEST_URI}) {
                      $Url = $Self->{ConfigObject}->Get('HttpType') . '://' .
***************
*** 1923,1933 ****
                  }
                  # create the header
!                 my %Return;
                  my $CounterRow = 0;
                  my $CounterHead = 0;
                  foreach my $Content (@{$HeadArrayRef}) {
!                     $Return{CellData}[$CounterRow][$CounterHead]{Content} = $Content;
!                     $Return{CellData}[$CounterRow][$CounterHead]{Font} = 'HelveticaBold';
!                     $Return{CellData}[$CounterRow][$CounterHead]{BackgroundColor} = '#909090';
                      $CounterHead++;
                  }
--- 1923,1932 ----
                  }
                  # create the header
!                 my $CellData;
                  my $CounterRow = 0;
                  my $CounterHead = 0;
                  foreach my $Content (@{$HeadArrayRef}) {
!                     $CellData->[$CounterRow]->[$CounterHead]->{Content} = $Content;
!                     $CellData->[$CounterRow]->[$CounterHead]->{Font} = 'HelveticaBold';
                      $CounterHead++;
                  }
***************
*** 1939,1943 ****
                      my $CounterColumn = 0;
                      foreach my $Content (@{$Row}) {
!                         $Return{CellData}[$CounterRow][$CounterColumn]{Content} = $Content;
                          $CounterColumn++;
                      }
--- 1938,1942 ----
                      my $CounterColumn = 0;
                      foreach my $Content (@{$Row}) {
!                         $CellData->[$CounterRow]->[$CounterColumn]->{Content} = $Content;
                          $CounterColumn++;
                      }
***************
*** 1945,1995 ****
                  }
                  # output 'No Result', if no content was given
!                 if (!$Return{CellData}[0][0]) {
!                     $Return{CellData}[0][0]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('No Result!');
                  }
-                 $Return{ColumnData} = [];
- 
                  # create new pdf document
                  $Self->{PDFObject}->DocumentNew(
                      Title => $Self->{ConfigObject}->Get('Product') . ': ' . $Title,
                  );
! 
                  my $Loop = 1;
!                 my $Counter = 0;
                  while ($Loop) {
!                     # create new pdf page
!                     $Self->{PDFObject}->PageNew(
!                         PageOrientation => 'landscape',
!                         MarginTop => 30,
!                         MarginRight => 40,
!                         MarginBottom => 40,
!                         MarginLeft => 40,
!                         HeaderRight => $Self->{ConfigObject}->Get('Stats::StatsHook') . $Stat->{StatNumber},
!                         FooterLeft => $Url,
!                         FooterRight => $Page . ' ' . ($Counter + 1),
!                         HeadlineLeft => $Title,
!                         HeadlineRight => $PrintedBy . ' ' .
!                                 $Self->{UserFirstname} . ' ' .
!                                 $Self->{UserLastname} . ' (' .
!                                 $Self->{UserEmail} . ') ' .
!                                 $Time,
!                     );
!                     # output table
!                     %Return = $Self->{PDFObject}->Table(
!                         CellData => $Return{CellData},
!                         ColumnData => $Return{ColumnData},
!                         Border => 0,
!                         FontSize => 6,
!                         BackgroundColorEven => '#AAAAAA',
!                         BackgroundColorOdd => '#DDDDDD',
!                         Padding => 1,
!                         PaddingTop => 3,
!                         PaddingBottom => 3,
                      );
!                     # output another page
!                     if ($Return{State}) {
                          $Loop = 0;
                      }
                      $Counter++;
                  }
                  # return the pdf document
--- 1944,2015 ----
                  }
                  # output 'No Result', if no content was given
!                 if (!$CellData->[0]->[0]) {
!                     $CellData->[0]->[0]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('No Result!');
!                 }
!                 # page params
!                 my %PageParam;
!                 $PageParam{PageOrientation} = 'landscape';
!                 $PageParam{MarginTop} = 30;
!                 $PageParam{MarginRight} = 40;
!                 $PageParam{MarginBottom} = 40;
!                 $PageParam{MarginLeft} = 40;
!                 $PageParam{HeaderRight} = $Self->{ConfigObject}->Get('Stats::StatsHook') . $Stat->{StatNumber};
!                 $PageParam{FooterLeft} = $Url;
!                 $PageParam{HeadlineLeft} = $Title;
!                 $PageParam{HeadlineRight} = $PrintedBy . ' ' .
!                     $Self->{UserFirstname} . ' ' .
!                     $Self->{UserLastname} . ' (' .
!                     $Self->{UserEmail} . ') ' .
!                     $Time;
!                 # table params
!                 my %TableParam;
!                 $TableParam{CellData} = $CellData;
!                 $TableParam{Type} = 'Cut';
!                 $TableParam{FontSize} = 6;
!                 $TableParam{Border} = 0;
!                 $TableParam{BackgroundColorEven} = '#AAAAAA';
!                 $TableParam{BackgroundColorOdd} = '#DDDDDD';
!                 $TableParam{Padding} = 1;
!                 $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(
                      Title => $Self->{ConfigObject}->Get('Product') . ': ' . $Title,
                  );
!                 # 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

Index: AgentTicketSearch.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketSearch.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** AgentTicketSearch.pm	7 Aug 2006 18:41:19 -0000	1.23
--- AgentTicketSearch.pm	21 Aug 2006 19:13:41 -0000	1.24
***************
*** 519,541 ****
                          $ENV{REQUEST_URI};
                  }
- 
                  # create the header
!                 my %Return;
!                 $Return{CellData}[0][0]{Content} = $Self->{ConfigObject}->Get('Ticket::Hook');
!                 $Return{CellData}[0][0]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][1]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Created');
!                 $Return{CellData}[0][1]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][2]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('From');
!                 $Return{CellData}[0][2]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][3]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Subject');
!                 $Return{CellData}[0][3]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][4]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('State');
!                 $Return{CellData}[0][4]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][5]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Queue');
!                 $Return{CellData}[0][5]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][6]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Owner');
!                 $Return{CellData}[0][6]{Font} = 'HelveticaBold';
!                 $Return{CellData}[0][7]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('CustomerID');
!                 $Return{CellData}[0][7]{Font} = 'HelveticaBold';
                  # create the content array
                  my $CounterRow = 1;
--- 519,540 ----
                          $ENV{REQUEST_URI};
                  }
                  # create the header
!                 my $CellData;
!                 $CellData->[0]->[0]->{Content} = $Self->{ConfigObject}->Get('Ticket::Hook');
!                 $CellData->[0]->[0]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[1]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Created');
!                 $CellData->[0]->[1]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[2]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('From');
!                 $CellData->[0]->[2]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[3]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Subject');
!                 $CellData->[0]->[3]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[4]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('State');
!                 $CellData->[0]->[4]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[5]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Queue');
!                 $CellData->[0]->[5]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[6]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('Owner');
!                 $CellData->[0]->[6]->{Font} = 'HelveticaBold';
!                 $CellData->[0]->[7]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('CustomerID');
!                 $CellData->[0]->[7]->{Font} = 'HelveticaBold';
                  # create the content array
                  my $CounterRow = 1;
***************
*** 543,547 ****
                      my $CounterColumn = 0;
                      foreach my $Content (@{$Row}) {
!                         $Return{CellData}[$CounterRow][$CounterColumn]{Content} = $Content;
                          $CounterColumn++;
                      }
--- 542,546 ----
                      my $CounterColumn = 0;
                      foreach my $Content (@{$Row}) {
!                         $CellData->[$CounterRow]->[$CounterColumn]->{Content} = $Content;
                          $CounterColumn++;
                      }
***************
*** 549,599 ****
                  }
                  # output 'No Result', if no content was given
!                 if (!$Return{CellData}[0][0]) {
!                     $Return{CellData}[0][0]{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('No Result!');
                  }
-                 $Return{ColumnData} = [];
- 
                  # create new pdf document
                  $Self->{PDFObject}->DocumentNew(
                      Title => $Self->{ConfigObject}->Get('Product') . ': ' . $Title,
                  );
! 
                  my $Loop = 1;
!                 my $Counter = 0;
                  while ($Loop) {
!                     # create new pdf page
!                     $Self->{PDFObject}->PageNew(
!                         PageOrientation => 'landscape',
!                         MarginTop => 30,
!                         MarginRight => 40,
!                         MarginBottom => 40,
!                         MarginLeft => 40,
!                         HeaderRight => $Title,
!                         FooterLeft => $Url,
!                         FooterRight => $Page . ' ' . ($Counter + 1),
!                         HeadlineLeft => $Title,
!                         HeadlineRight => $PrintedBy . ' ' .
!                                 $Self->{UserFirstname} . ' ' .
!                                 $Self->{UserLastname} . ' (' .
!                                 $Self->{UserEmail} . ') ' .
!                                 $Time,
!                     );
!                     # output table
!                     %Return = $Self->{PDFObject}->Table(
!                         CellData => $Return{CellData},
!                         ColumnData => $Return{ColumnData},
!                         Border => 0,
!                         FontSize => 6,
!                         BackgroundColorEven => '#AAAAAA',
!                         BackgroundColorOdd => '#DDDDDD',
!                         Padding => 1,
!                         PaddingTop => 3,
!                         PaddingBottom => 3,
                      );
!                     # output another page
!                     if ($Return{State}) {
                          $Loop = 0;
                      }
                      $Counter++;
                  }
                  # return the pdf document
--- 548,619 ----
                  }
                  # output 'No Result', if no content was given
!                 if (!$CellData->[0]->[0]) {
!                     $CellData->[0]->[0]->{Content} = $Self->{LayoutObject}->{LanguageObject}->Get('No Result!');
!                 }
!                 # page params
!                 my %PageParam;
!                 $PageParam{PageOrientation} = 'landscape';
!                 $PageParam{MarginTop} = 30;
!                 $PageParam{MarginRight} = 40;
!                 $PageParam{MarginBottom} = 40;
!                 $PageParam{MarginLeft} = 40;
!                 $PageParam{HeaderRight} = $Title;
!                 $PageParam{FooterLeft} = $Url;
!                 $PageParam{HeadlineLeft} = $Title;
!                 $PageParam{HeadlineRight} = $PrintedBy . ' ' .
!                     $Self->{UserFirstname} . ' ' .
!                     $Self->{UserLastname} . ' (' .
!                     $Self->{UserEmail} . ') ' .
!                     $Time;
!                 # table params
!                 my %TableParam;
!                 $TableParam{CellData} = $CellData;
!                 $TableParam{Type} = 'Cut';
!                 $TableParam{FontSize} = 6;
!                 $TableParam{Border} = 0;
!                 $TableParam{BackgroundColorEven} = '#AAAAAA';
!                 $TableParam{BackgroundColorOdd} = '#DDDDDD';
!                 $TableParam{Padding} = 1;
!                 $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(
                      Title => $Self->{ConfigObject}->Get('Product') . ': ' . $Title,
                  );
!                 # 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



More information about the cvs-log mailing list