From ba85807b7ac6ce83d2ffab069e19fe709a2ce3be Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 1 Oct 2015 16:23:56 +0200 Subject: [PATCH] Einkaufsrechnungen: In Kopf anzeigen, in welchen SEPA-Exporten der Beleg enthalten ist --- SL/DB/PurchaseInvoice.pm | 6 ++++++ bin/mozilla/ir.pl | 2 ++ templates/webpages/ir/form_header.html | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index d1eaded8f..c63a2ed70 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -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', diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 843230212..f73905d60 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -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}; diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index 15cb81ae8..f22d03eb5 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -80,6 +80,17 @@ [% LxERP.format_amount(creditremaining,0 ,'0') %] +[%- IF invoice_obj.sepa_exports.as_list.size %] + + [% LxERP.t8("SEPA exports") %] + + [% FOREACH export = invoice_obj.sepa_exports.as_list %] + [% HTML.escape(export.id) %] + [% UNLESS loop.last %], [% END %] + [% END %] + + +[%- END %] [%- IF business %] [% 'Vendor type' | $T8 %] -- 2.20.1