use List::MoreUtils qw(any);
+sub opthash { +{ value => shift, selected => shift, oname => shift } }
# generate the printing options displayed at the bottom of oe and is forms.
# this function will attempt to guess what type of form is displayed, and will generate according options
sub get_print_options {
my ($class, %params) = @_;
+ no warnings 'once';
+
my $form = $params{form} || $::form;
my $myconfig = $params{myconfig} || \%::myconfig;
my $locale = $params{locale} || $::locale;
my $options = $params{options};
+ use warnings 'once';
+
my $prefix = $options->{dialog_name_prefix} || '';
# names 3 parameters and returns a hashref, for use in templates
- sub opthash { +{ value => shift, selected => shift, oname => shift } }
my (@FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = ();
# note: "||"-selection is only correct for values where "0" is _not_ a correct entry
($form->{type} eq 'invoice') ? (
opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')),
opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
+ opthash("invoice_copy", $form->{PD}{invoice_copy}, $locale->text('Invoice Copy')),
) : undef,
($form->{type} eq 'invoice' && $form->{storno}) ? (
opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')),
) : undef,
- ($form->{type} =~ /_delivery_order$/) ? (
+ ($form->{type} eq 'invoice_for_advance_payment') ? (
+ opthash("invoice_for_advance_payment", $form->{PD}{invoice_for_advance_payment}, $locale->text('Invoice for Advance Payment')),
+ ) : undef,
+ ($form->{type} eq 'final_invoice') ? (
+ opthash("final_invoice", $form->{PD}{final_invoice}, $locale->text('Final Invoice')),
+ ) : undef,
+ ($form->{type} =~ /^supplier_delivery_order$/) ? (
+ opthash('supplier_delivery_order', $form->{PD}{supplier_delivery_order}, $locale->text('Supplier Delivery Order')),
+ ) : undef,
+ ($form->{type} =~ /(sales|purchase)_delivery_order$/) ? (
opthash($form->{type}, $form->{PD}{$form->{type}}, $locale->text('Delivery Order')),
opthash('pick_list', $form->{PD}{pick_list}, $locale->text('Pick List')),
) : undef,
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}},
+ display_bothsided => $options->{show_bothsided},
groupitems_checked => $form->{groupitems} ? "checked" : '',
+ bothsided_checked => $form->{bothsided} ? "checked" : '',
remove_draft_checked => $form->{remove_draft} ? "checked" : ''
);