From 00177fae5986f1de25515c7103d10fc36a38cefd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 25 Oct 2021 16:53:39 +0200 Subject: [PATCH] =?utf8?q?Zus=C3=A4tzliche=20Rechnungsadressen:=20beim=20A?= =?utf8?q?usdruck=20als=20Variablen=20verf=C3=BCgbar=20machen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Helper/FlattenToForm.pm | 2 +- SL/Form.pm | 14 ++++++++++++++ bin/mozilla/io.pl | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index f99993922..591073e18 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -15,7 +15,7 @@ sub flatten_to_form { _copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma globalproject_id delivered transaction_description container_type accepted_by_customer invoice storno storno_id dunning_config_id - orddate quodate reqdate gldate duedate deliverydate datepaid transdate tax_point delivery_term_id)); + orddate quodate reqdate gldate duedate deliverydate datepaid transdate tax_point delivery_term_id billing_address_id)); $form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : ''; if ( $vc eq 'customer' ) { diff --git a/SL/Form.pm b/SL/Form.pm index a95f4e0db..2e9458956 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -59,6 +59,7 @@ use SL::CVar; use SL::DB; use SL::DBConnect; use SL::DBUtils; +use SL::DB::AdditionalBillingAddress; use SL::DB::Customer; use SL::DB::Default; use SL::DB::PaymentTerm; @@ -3154,6 +3155,8 @@ sub prepare_for_printing { IS->invoice_details(\%::myconfig, $self, $::locale); } + $self->set_addition_billing_address_print_variables; + # Chose extension & set source file name my $extension = 'html'; if ($self->{format} eq 'postscript') { @@ -3221,6 +3224,17 @@ sub prepare_for_printing { return $self; } +sub set_addition_billing_address_print_variables { + my ($self) = @_; + + return if !$self->{billing_address_id}; + + my $address = SL::DB::Manager::AdditionalBillingAddress->find_by(id => $self->{billing_address_id}); + return if !$address; + + $self->{"billing_address_${_}"} = $address->$_ for map { $_->name } @{ $address->meta->columns }; +} + sub substitute_placeholders_in_template_arrays { my ($self, @fields) = @_; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 917720c9d..89e40d0e5 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1392,6 +1392,8 @@ sub print_form { $form->get_shipto(\%myconfig); } + $form->set_addition_billing_address_print_variables; + $form->{notes} =~ s/^\s+//g; delete $form->{printer_command}; -- 2.20.1