Bugfix 1566: Variablen für Verkäufer und USTID in Mahnungsdruck hinzugefügt
[kivitendo-erp.git] / SL / DN.pm
index cef3638..797588a 100644 (file)
--- a/SL/DN.pm
+++ b/SL/DN.pm
@@ -718,6 +718,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,
          ar.amount - ar.paid AS open_amount,
          ar.amount - ar.paid + da.fee + da.interest AS linetotal
 
@@ -746,11 +747,13 @@ sub print_dunning {
          c.country,           c.department_1, c.department_2, c.email,     c.customernumber,
          c.greeting,          c.contact,      c.phone,        c.fax,       c.homepage,
          c.email,             c.taxincluded,  c.business_id,  c.taxnumber, c.iban,
+         c,ustid,             e.name as salesman_name,
          co.*
        FROM dunning d
        LEFT JOIN ar          ON (d.trans_id = ar.id)
        LEFT JOIN customer c  ON (ar.customer_id = c.id)
        LEFT JOIN contacts co ON (ar.cp_id = co.cp_id)
+       LEFT JOIN employee e  ON (ar.salesman_id = e.id)
        WHERE (d.dunning_id = ?)
        LIMIT 1|;
   my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
@@ -794,7 +797,7 @@ sub print_dunning {
 
   my $filename          = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf";
   my $spool             = $::lx_office_conf{paths}->{spool};
-  $form->{OUT}          = ">${spool}/$filename";
+  $form->{OUT}          = "${spool}/$filename";
   $form->{keep_tmpfile} = 1;
 
   delete $form->{tmpfile};
@@ -888,7 +891,7 @@ sub print_invoice_for_fees {
   my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf";
 
   my $spool             = $::lx_office_conf{paths}->{spool};
-  $form->{OUT}          = ">$spool/$filename";
+  $form->{OUT}          = "$spool/$filename";
   $form->{keep_tmpfile} = 1;
   delete $form->{tmpfile};