Debitorenbuchungen: In Kopf anzeigen, in welchen SEPA-Exporten der Beleg enthalten ist
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 1 Oct 2015 14:21:09 +0000 (16:21 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 1 Oct 2015 14:31:52 +0000 (16:31 +0200)
bin/mozilla/ar.pl
templates/webpages/ar/form_header.html

index 148ac0b..a8bdc56 100644 (file)
@@ -140,6 +140,12 @@ sub display_form {
   $main::lxdebug->leave_sub();
 }
 
+sub _retrieve_invoice_object {
+  return undef if !$::form->{id};
+  return $::form->{invoice_obj} if $::form->{invoice_obj} && $::form->{invoice_obj}->id == $::form->{id};
+  return SL::DB::Invoice->new(id => $::form->{id})->load;
+}
+
 sub create_links {
   $main::lxdebug->enter_sub();
 
@@ -150,7 +156,7 @@ sub create_links {
   my %myconfig = %main::myconfig;
 
   $form->create_links("AR", \%myconfig, "customer");
-  $form->{invoice_obj} = $form->{id} ? SL::DB::Invoice->new(id => $form->{id})->load : undef;
+  $form->{invoice_obj} = _retrieve_invoice_object();
 
   my %saved;
   if (!$params{dont_save}) {
@@ -218,6 +224,8 @@ sub form_header {
   my $locale   = $main::locale;
   my $cgi      = $::request->{cgi};
 
+  $form->{invoice_obj} = _retrieve_invoice_object();
+
   my ($title, $readonly, $exchangerate, $rows);
   my ($notes, $department, $customer, $employee, $amount, $project);
   my ($ARselected);
index cef1f62..b4cf07c 100644 (file)
                  <span class="plus[% creditremaining < 0 ? 0 : 1 %]">[% LxERP.format_amount(creditremaining, 0) %][% L.hidden_tag('creditremaining', LxERP.format_amount(creditremaining, 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=customer&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
+                  [% UNLESS loop.last %], [% END %]
+                 [% END %]
+                </td>
+              </tr>
+[%- END %]
               <tr>
                 <th align=right>[% 'Currency' | $T8 %]</th>
                 <td><select name=currency>[% selectcurrency %]</select></td>