Einkaufsrechnungen: In Kopf anzeigen, in welchen SEPA-Exporten der Beleg enthalten ist
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 1 Oct 2015 14:23:56 +0000 (16:23 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 1 Oct 2015 14:31:53 +0000 (16:31 +0200)
SL/DB/PurchaseInvoice.pm
bin/mozilla/ir.pl
templates/webpages/ir/form_header.html

index d1eaded..c63a2ed 100644 (file)
@@ -28,6 +28,12 @@ __PACKAGE__->meta->add_relationship(
     column_map      => { id => 'ap_id' },
     manager_args    => { with_objects => [ 'sepa_export' ] }
   },
+  sepa_exports      => {
+    type            => 'many to many',
+    map_class       => 'SL::DB::SepaExportItem',
+    map_from        => 'ap',
+    map_to          => 'sepa_export',
+  },
   custom_shipto     => {
     type            => 'one to one',
     class           => 'SL::DB::Shipto',
index 8432302..f73905d 100644 (file)
@@ -36,6 +36,7 @@ use SL::IR;
 use SL::IS;
 use SL::PE;
 use SL::DB::Default;
+use SL::DB::PurchaseInvoice;
 use List::Util qw(max sum);
 use List::UtilsBy qw(sort_by);
 
@@ -259,6 +260,7 @@ sub form_header {
   my %TMPL_VAR = ();
   my @custom_hiddens;
 
+  $TMPL_VAR{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $form->{id})->load if $form->{id};
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
index 15cb81a..f22d03e 100644 (file)
             <span class="plus[% IF is_credit_remaining_negativ %]0[% ELSE %]1[% END %]">[% LxERP.format_amount(creditremaining,0 ,'0') %]</span>
           </td>
         </tr>
+[%- IF invoice_obj.sepa_exports.as_list.size %]
+        <tr>
+          <th align="right">[% LxERP.t8("SEPA exports") %]</th>
+          <td>
+           [% FOREACH export = invoice_obj.sepa_exports.as_list %]
+            <a href="sepa.pl?action=bank_transfer_edit&vc=vendor&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
+            [% UNLESS loop.last %], [% END %]
+           [% END %]
+          </td>
+        </tr>
+[%- END %]
 [%- IF business %]
         <tr>
           <th align="right">[% 'Vendor type' | $T8 %]</th>