X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDN.pm;h=b64e48ce651109f53278933710f680c4a4b454a7;hb=73a58f3dceeb378343ceb151942828eea686b75a;hp=6d00f438afe1b8d9732fa53e7d6f1857ba1c3c37;hpb=854a9820edf79b7fdea4890f8802039836ab94c8;p=kivitendo-erp.git diff --git a/SL/DN.pm b/SL/DN.pm index 6d00f438a..b64e48ce6 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -36,6 +36,7 @@ package DN; use SL::Common; use SL::DBUtils; +use SL::DB::Default; use SL::GenericTranslations; use SL::IS; use SL::Mailer; @@ -208,7 +209,7 @@ sub create_invoice_for_fees { $query = qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id, taxincluded, amount, netamount, paid, duedate, - invoice, curr, notes, + invoice, currency_id, notes, employee_id) VALUES ( ?, -- id @@ -228,7 +229,7 @@ sub create_invoice_for_fees { -- duedate: (SELECT duedate FROM dunning WHERE dunning_id = ? LIMIT 1), 'f', -- invoice - ?, -- curr + (SELECT id FROM currencies WHERE name = ?), -- curr ?, -- notes -- employee_id: (SELECT id FROM employee WHERE login = ?) @@ -393,7 +394,9 @@ sub set_template_options { my ($self, $myconfig, $form) = @_; - $form->{templates} = "$myconfig->{templates}"; + my $defaults = SL::DB::Default->get; + $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; + $form->{templates} = $defaults->templates; $form->{language} = $form->get_template_language($myconfig); $form->{printer_code} = $form->get_printer_code($myconfig); @@ -432,7 +435,7 @@ sub set_template_options { $form->{IN} = undef; for my $filename (@template_files) { - if (-f "$form->{templates}/$filename") { + if (-f ($defaults->templates . "/$filename")) { $form->{IN} = $filename; last; } @@ -483,6 +486,7 @@ sub get_invoices { "ordnumber" => "a.ordnumber", "invnumber" => "a.invnumber", "notes" => "a.notes", + "country" => "ct.country", ); foreach my $key (keys(%columns)) { next unless ($form->{$key}); @@ -759,7 +763,7 @@ sub print_dunning { ar.transdate, ar.duedate, ar.customer_id, ar.invnumber, ar.ordnumber, ar.cp_id, ar.amount, ar.netamount, ar.paid, - ar.curr, + (SELECT cu.name FROM currencies cu WHERE cu.id=ar.currency_id) AS curr, ar.amount - ar.paid AS open_amount, ar.amount - ar.paid + da.fee + da.interest AS linetotal