Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 222bbfe9

Von Moritz Bunkus vor fast 17 Jahren hinzugefügt

  • ID 222bbfe92941beea4fbd2735b60cefd77c259e57
  • Vorgänger 7f7cbb08
  • Nachfolger 26a6e8b0

Der Variablenname %params oder $params ist für Hashes reserviert, die Funktionsparameter enthalten.

Unterschiede anzeigen:

SL/ReportGenerator.pm
423 423
  my $myconfig   = $self->{myconfig};
424 424

  
425 425
  my $opts       = $self->{options};
426
  my $params     = $opts->{pdf_export};
426
  my $pdfopts    = $opts->{pdf_export};
427 427

  
428 428
  my (@data, @column_props, @cell_props);
429 429

  
......
504 504

  
505 505
  my %supported_fonts = map { $_ => 1 } qw(courier georgia helvetica times verdana);
506 506

  
507
  my $paper_size  = defined $params->{paper_size} && defined $papersizes->{lc $params->{paper_size}} ? lc $params->{paper_size} : 'a4';
507
  my $paper_size  = defined $pdfopts->{paper_size} && defined $papersizes->{lc $pdfopts->{paper_size}} ? lc $pdfopts->{paper_size} : 'a4';
508 508
  my ($paper_width, $paper_height);
509 509

  
510
  if (lc $params->{orientation} eq 'landscape') {
510
  if (lc $pdfopts->{orientation} eq 'landscape') {
511 511
    ($paper_width, $paper_height) = @{$papersizes->{$paper_size}}[1, 0];
512 512
  } else {
513 513
    ($paper_width, $paper_height) = @{$papersizes->{$paper_size}}[0, 1];
514 514
  }
515 515

  
516
  my $margin_top        = _cm2bp($params->{margin_top}    || 1.5);
517
  my $margin_bottom     = _cm2bp($params->{margin_bottom} || 1.5);
518
  my $margin_left       = _cm2bp($params->{margin_left}   || 1.5);
519
  my $margin_right      = _cm2bp($params->{margin_right}  || 1.5);
516
  my $margin_top        = _cm2bp($pdfopts->{margin_top}    || 1.5);
517
  my $margin_bottom     = _cm2bp($pdfopts->{margin_bottom} || 1.5);
518
  my $margin_left       = _cm2bp($pdfopts->{margin_left}   || 1.5);
519
  my $margin_right      = _cm2bp($pdfopts->{margin_right}  || 1.5);
520 520

  
521 521
  my $table             = PDF::Table->new();
522 522
  my $pdf               = PDF::API2->new();
......
524 524

  
525 525
  $pdf->mediabox($paper_width, $paper_height);
526 526

  
527
  my $font              = $pdf->corefont(defined $params->{font_name} && $supported_fonts{lc $params->{font_name}} ? ucfirst $params->{font_name} : 'Verdana',
527
  my $font              = $pdf->corefont(defined $pdfopts->{font_name} && $supported_fonts{lc $pdfopts->{font_name}} ? ucfirst $pdfopts->{font_name} : 'Verdana',
528 528
                                         '-encoding' => $main::dbcharset || 'ISO-8859-15');
529
  my $font_size         = $params->{font_size} || 7;
529
  my $font_size         = $pdfopts->{font_size} || 7;
530 530
  my $title_font_size   = $font_size + 1;
531 531
  my $padding           = 1;
532 532
  my $font_height       = $font_size + 2 * $padding;
533 533
  my $title_font_height = $font_size + 2 * $padding;
534 534

  
535 535
  my $header_height     = 2 * $title_font_height if ($opts->{title});
536
  my $footer_height     = 2 * $font_height       if ($params->{number});
536
  my $footer_height     = 2 * $font_height       if ($pdfopts->{number});
537 537

  
538 538
  my $top_text_height   = 0;
539 539

  
......
582 582
  foreach my $page_num (1..$pdf->pages()) {
583 583
    my $curpage  = $pdf->openpage($page_num);
584 584

  
585
    if ($params->{number}) {
585
    if ($pdfopts->{number}) {
586 586
      my $label    = $main::locale->text("Page #1/#2", $page_num, $pdf->pages());
587 587
      my $text_obj = $curpage->text();
588 588

  
......
604 604
  my $content = $pdf->stringify();
605 605

  
606 606
  my $printer_command;
607
  if ($params->{print} && $params->{printer_id}) {
608
    $form->{printer_id} = $params->{printer_id};
607
  if ($pdfopts->{print} && $pdfopts->{printer_id}) {
608
    $form->{printer_id} = $pdfopts->{printer_id};
609 609
    $form->get_printer_code($myconfig);
610 610
    $printer_command = $form->{printer_command};
611 611
  }
......
613 613
  if ($printer_command) {
614 614
    $self->_print_content('printer_command' => $printer_command,
615 615
                          'content'         => $content,
616
                          'copies'          => $params->{copies});
616
                          'copies'          => $pdfopts->{copies});
617 617
    $form->{report_generator_printed} = 1;
618 618

  
619 619
  } else {

Auch abrufbar als: Unified diff