[otrs-cvs] CVS: otrs/bin mkStats.pl,1.37,1.38

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


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

Modified Files:
	mkStats.pl 
Log Message:
use new Table() in PDF.pm

Index: mkStats.pl
===================================================================
RCS file: /home/cvs/otrs/bin/mkStats.pl,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** mkStats.pl	7 Aug 2006 12:41:52 -0000	1.37
--- mkStats.pl	21 Aug 2006 19:13:41 -0000	1.38
***************
*** 224,239 ****
          my %User = $CommonObject{UserObject}->GetUserData(UserID => $CommonObject{UserID});
  
-         # create new document
-         $CommonObject{PDFObject}->DocumentNew(
-             Title => $CommonObject{ConfigObject}->Get('Product') . ': ' . $Title,
-         );
          # create the content array
!         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++;
          }
--- 224,234 ----
          my %User = $CommonObject{UserObject}->GetUserData(UserID => $CommonObject{UserID});
  
          # create the content array
!         my $CellData;
          my $CounterRow = 0;
          my $CounterHead = 0;
          foreach my $Content (@{$HeadArrayRef}) {
!             $CellData->[$CounterRow]->[$CounterHead]->{Content} = $Content;
!             $CellData->[$CounterRow]->[$CounterHead]->{Font} = 'HelveticaBold';
              $CounterHead++;
          }
***************
*** 244,298 ****
              my $CounterColumn = 0;
              foreach my $Content (@{$Row}) {
!                 $Return{CellData}[$CounterRow][$CounterColumn]{Content} = $Content;
                  $CounterColumn++;
              }
              $CounterRow++;
          }
! 
!         if (!$Return{CellData}[0][0]) {
!             $Return{CellData}[0][0]{Content} = $CommonObject{LayoutObject}->{LanguageObject}->Get('No Result!');
          }
!         $Return{ColumnData} = [];
! 
          my $Loop = 1;
!         my $Counter = 0;
          while ($Loop) {
!             # create new page
!             $CommonObject{PDFObject}->PageNew(
!                 Width => 842,
!                 Height => 595,
!                 MarginTop => 30,
!                 MarginRight => 40,
!                 MarginBottom => 40,
!                 MarginLeft => 40,
!                 HeaderRight => $Title,
!                 FooterLeft => 'mkStats.pl',
!                 FooterRight => $Page . ' ' . ($Counter + 1),
!                 HeadlineLeft => $Title,
!                 HeadlineRight => $PrintedBy . ' ' .
!                         $User{UserFirstname} . ' ' .
!                         $User{UserLastname} . ' (' .
!                         $User{UserEmail} . ') ' .
!                         $Time,
!             );
!             # output table
!             %Return = $CommonObject{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 document
          my $PDFString = $CommonObject{PDFObject}->DocumentOutput();
--- 239,316 ----
              my $CounterColumn = 0;
              foreach my $Content (@{$Row}) {
!                 $CellData->[$CounterRow]->[$CounterColumn]->{Content} = $Content;
                  $CounterColumn++;
              }
              $CounterRow++;
          }
!         if (!$CellData->[0]->[0]) {
!             $CellData->[0]->[0]->{Content} = $CommonObject{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} = $CommonObject{ConfigObject}->Get('Stats::StatsHook') . $Stat->{StatNumber};
!         $PageParam{FooterLeft} = 'mkStats.pl';
!         $PageParam{HeadlineLeft} = $Title;
!         $PageParam{HeadlineRight} = $PrintedBy . ' ' .
!             $User{UserFirstname} . ' ' .
!             $User{UserLastname} . ' (' .
!             $User{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 = $CommonObject{ConfigObject}->Get('PDF::MaxPages');
!         if (!$MaxPages || $MaxPages < 1 || $MaxPages > 1000) {
!             $MaxPages = 100;
!         }
!         # create new pdf document
!         $CommonObject{PDFObject}->DocumentNew(
!             Title => $CommonObject{ConfigObject}->Get('Product') . ': ' . $Title,
!         );
!         # start table output
          my $Loop = 1;
!         my $Counter = 1;
          while ($Loop) {
!             # if first page
!             if ($Counter eq 1) {
!                 $CommonObject{PDFObject}->PageNew(
!                     %PageParam,
!                     FooterRight => $Page . ' ' . $Counter,
!                 );
!             }
!             # output table (or a fragment of it)
!             %TableParam = $CommonObject{PDFObject}->Table(
!                 %TableParam,
              );
!             # stop output or another page
!             if ($TableParam{State}) {
                  $Loop = 0;
              }
+             else {
+                 $CommonObject{PDFObject}->PageNew(
+                     %PageParam,
+                     FooterRight => $Page . ' ' . ($Counter + 1),
+                 );
+             }
              $Counter++;
+             # check max pages
+             if ($Counter >= $MaxPages) {
+                 $Loop = 0
+             }
          }
          # return the document
          my $PDFString = $CommonObject{PDFObject}->DocumentOutput();



More information about the cvs-log mailing list