From 3431644a1a66b9d3394002c1d297acc72512c3a6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 28 Dec 2010 15:15:59 +0100 Subject: [PATCH] =?utf8?q?Benutzerdefinierte=20Variablen=20f=C3=BCr=20Kund?= =?utf8?q?en=20beim=20Drucken=20von=20Mahnungen=20zur=20Verf=C3=BCgung=20s?= =?utf8?q?tellen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Betrifft sowohl die Mahnung selber als auch eine eventuell für die Zinsen und Gebühren erstellte Rechnung. Fix für Bug 1376. --- SL/DN.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/SL/DN.pm b/SL/DN.pm index 45bc367eb..272bddc60 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -36,6 +36,7 @@ package DN; use SL::Common; use SL::DBUtils; +use SL::GenericTranslations; use SL::IS; use SL::Mailer; use SL::MoreCommon; @@ -782,6 +783,7 @@ sub print_dunning { $form->{total_open_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{total_open_amount}, 2), 2); $form->{total_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{fee} + $ref->{total_interest} + $ref->{total_open_amount}, 2), 2); + $self->set_customer_cvars($myconfig, $form); $self->set_template_options($myconfig, $form); my $filename = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf"; @@ -832,7 +834,7 @@ sub print_invoice_for_fees { $query = qq|SELECT ar.invnumber, ar.transdate AS invdate, ar.amount, ar.netamount, - ar.duedate, ar.notes, ar.notes AS invoicenotes, + ar.duedate, ar.notes, ar.notes AS invoicenotes, ar.customer_id, c.name, c.department_1, c.department_2, c.street, c.zipcode, c.city, c.country, c.contact, c.customernumber, c.phone, c.fax, c.email, @@ -873,6 +875,7 @@ sub print_invoice_for_fees { map { $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) } qw(fee interest invamount); + $self->set_customer_cvars($myconfig, $form); $self->set_template_options($myconfig, $form); my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf"; @@ -896,4 +899,18 @@ sub print_invoice_for_fees { $main::lxdebug->leave_sub(); } +sub set_customer_cvars { + my ($self, $myconfig, $form) = @_; + + my $custom_variables = CVar->get_custom_variables(dbh => $form->get_standard_dbh, + module => 'CT', + trans_id => $form->{customer_id}); + map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables }; + + $form->{cp_greeting} = GenericTranslations->get(dbh => $form->get_standard_dbh, + translation_type => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'), + language_id => $form->{language_id}, + allow_fallback => 1); +} + 1; -- 2.20.1