From: Moritz Bunkus Date: Mon, 25 Oct 2021 14:53:39 +0000 (+0200) Subject: Zusätzliche Rechnungsadressen: beim Ausdruck als Variablen verfügbar machen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~308 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=00177fae5986f1de25515c7103d10fc36a38cefd;p=kivitendo-erp.git Zusätzliche Rechnungsadressen: beim Ausdruck als Variablen verfügbar machen --- 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};