From 52352135ee322387c8eba0fcbbb09dd50abbdf09 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 12 Sep 2007 13:59:27 +0000 Subject: [PATCH] =?utf8?q?Die=20Argumente=20f=C3=BCr=20print=5Foptions()?= =?utf8?q?=20als=20Hash=20und=20nicht=20als=20Hash-Referenz=20=C3=BCbergeb?= =?utf8?q?en.=20Weitere=20Optionen=20zum=20Verstecken=20bestimmter=20Drop-?= =?utf8?q?Down-Boxen=20eingebaut.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/dn.pl | 20 ++++++++++---------- bin/mozilla/io.pl | 18 ++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 8a193426e..749c25b26 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -124,11 +124,11 @@ sub show_invoices { $form->{jsscript} = 1; $form->{callback} ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes)); - $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, - 'no_queue' => 1, - 'no_postscript' => 1, - 'no_html' => 1, - 'no_opendocument' => 1, }); + $form->{PRINT_OPTIONS} = print_options('inline' => 1, + 'no_queue' => 1, + 'no_postscript' => 1, + 'no_html' => 1, + 'no_opendocument' => 1,); $form->header(); print $form->parse_html_template("dunning/show_invoices"); @@ -282,11 +282,11 @@ sub show_dunning { 'languages' => 'languages'); $form->{type} = 'dunning'; - $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, - 'no_queue' => 1, - 'no_postscript' => 1, - 'no_html' => 1, - 'no_opendocument' => 1, }); + $form->{PRINT_OPTIONS} = print_options('inline' => 1, + 'no_queue' => 1, + 'no_postscript' => 1, + 'no_html' => 1, + 'no_opendocument' => 1,); $form->{title} = $locale->text('Dunning overview'); my $report = SL::ReportGenerator->new(\%myconfig, $form); diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 426c5aa14..039509269 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1404,9 +1404,7 @@ sub send_email { sub print_options { $lxdebug->enter_sub(); - my ($options) = @_; - - $options ||= { }; + my %options = @_; # names 3 parameters and returns a hashref, for use in templates sub opthash { +{ value => shift, selected => shift, oname => shift } } @@ -1461,21 +1459,21 @@ sub print_options { opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), (scalar @{ $form->{printers} } && $latex_templates) ? opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, - ($latex_templates && !$options->{no_queue}) ? + ($latex_templates && !$options{no_queue}) ? opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef if ($form->{media} ne 'email'); push @FORMAT, grep $_, ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin) - && !$options->{no_opendocument_pdf}) ? + && !$options{no_opendocument_pdf}) ? opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef, ($latex_templates) ? opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef, - ($latex_templates && !$options->{no_postscript}) ? + ($latex_templates && !$options{no_postscript}) ? opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef, - (!$options->{no_html}) ? + (!$options{no_html}) ? opthash("html", $form->{DF}{html}, "HTML") : undef, - ($opendocument_templates && !$options->{no_opendocument}) ? + ($opendocument_templates && !$options{no_opendocument}) ? opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef; push @LANGUAGE_ID, @@ -1486,7 +1484,7 @@ sub print_options { map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} } if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } }); - @SELECTS = map { sname => lc $_, DATA => \@$_, show => scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID); + @SELECTS = map { sname => lc $_, DATA => \@$_, show => !$options{"hide_" . lc($_)} && scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID); my %dont_display_groupitems = ( 'dunning' => 1, @@ -1502,7 +1500,7 @@ sub print_options { my $print_options = $form->parse_html_template("generic/print_options", { SELECTS => \@SELECTS, %template_vars } ); - if ($options->{inline}) { + if ($options{inline}) { $lxdebug->leave_sub() and return $print_options; } else { print $print_options; $lxdebug->leave_sub(); -- 2.20.1