X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHelper%2FPrintOptions.pm;h=2d842afc0d1c63bfb59ebb5a1bb9ad724dcdb171;hb=0b33cc602d717933791d06cb64f65dea2a7c2354;hp=230e72dcaee4ba9fe087af4c3afb623c797f5669;hpb=6d6d4044b1caa0e4f7c9de61e3a0bc9dd691a035;p=kivitendo-erp.git diff --git a/SL/Helper/PrintOptions.pm b/SL/Helper/PrintOptions.pm index 230e72dca..2d842afc0 100644 --- a/SL/Helper/PrintOptions.pm +++ b/SL/Helper/PrintOptions.pm @@ -107,16 +107,17 @@ sub get_print_options { if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } }); @SELECTS = map { - sname => $_->[1], - DATA => $_->[0], - show => !$options->{"hide_" . $_->[1]} && scalar @{ $_->[0] } + sname => $_->[1], + DATA => $_->[0], + show => !$options->{"hide_" . $_->[1]} && scalar @{ $_->[0]}, + hname => $locale->text($_->[2]) }, - [ \@FORMNAME, 'formname', ], - [ \@LANGUAGE_ID, 'language_id', ], - [ \@FORMAT, 'format', ], - [ \@SENDMODE, 'sendmode', ], - [ \@MEDIA, 'media', ], - [ \@PRINTER_ID, 'printer_id', ]; + [ \@FORMNAME, 'formname', 'Formname' ], + [ \@LANGUAGE_ID, 'language_id', 'Language' ], + [ \@FORMAT, 'format', 'Format' ], + [ \@SENDMODE, 'sendmode', 'Sendmode' ], + [ \@MEDIA, 'media', 'Media' ], + [ \@PRINTER_ID, 'printer_id', 'Printer' ]; my %dont_display_groupitems = ( 'dunning' => 1, @@ -125,6 +126,7 @@ sub get_print_options { my %template_vars = ( name_prefix => $prefix || '', + show_headers => $options->{show_headers}, display_copies => scalar @{ $form->{printers} || [] } && $::lx_office_conf{print_templates}->{latex} && $form->{media} ne 'email', display_remove_draft => (!$form->{id} && $form->{draft_id}), display_groupitems => !$dont_display_groupitems{$form->{type}}, @@ -136,3 +138,97 @@ sub get_print_options { } 1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Helper::PrintOptions - A helper for generating the print options for +templates + +=head1 SYNOPSIS + + # render your template with print_options + $self->render('letter/edit', + %params, + letter => $letter, + print_options => SL::Helper::PrintOptions->get_print_options ( + options => { no_postscript => 1, + no_opendocument => 1, + no_html => 1, + no_queue => 1 }), + + ); + +Then, in the template, you can render the options with + C<[% print_options %]>. Look at the template + C to see, which variables you get back. + +=head1 FUNCTIONS + +=over 4 + +=item C + +Parses the template C. It does some guessings + and settings according to the params, (namely C
). + + +The recognized parameters are: + +=over 2 + +=item * C: defaults to $::form if not given. There are several + keys in C which control the output of the options, + e.g. C, C, C, C, C, + C, C, ... + +=item * C: defaults to %::myconfig + +=item * C: defaults to $::locale + +=item * C: Options can be: + +* C: a string prefixed to the template + variables. E.g. if prefix is C the value for copies + returned from the user is in $::form->{mypref_copies} + +* C: render headings for the input elements + +* C: if set, do not show option for printing to queue + +* C: if set, do not show option for printing + opendocument format + +* C: if set, do not show option for printing + postscript format + +* C: if set, do not show option for printing + html format + +* C + +* C + +* and some more + +=back + +=back + +=head1 AUTHOR + +? + +Bernd Bleßmann Ebernd@kivitendo-premium.deE (I just moved + it from io.pl to here and did some minor changes) + +=head1 BUGS + +incomplete documentation + +=cut