From 66e2fdcc4f89a4f13c77f6e44f2969fd46aa7aba Mon Sep 17 00:00:00 2001 From: Waldemar Toews Date: Tue, 7 Jan 2014 16:58:42 +0100 Subject: [PATCH] Kunden Mandanten ID fuer SEPA Lastschrift implementiert. --- SL/DB/MetaSetup/Customer.pm | 1 + SL/DB/MetaSetup/Vendor.pm | 1 + SL/SEPA.pm | 4 +++- SL/SEPA/XML.pm | 2 +- bin/mozilla/sepa.pl | 3 +++ locale/de/all | 1 + sql/Pg-upgrade2/add_customer_mandator_id.sql | 6 ++++++ templates/webpages/sepa/bank_transfer_create.html | 6 ++++++ templates/webpages/sepa/bank_transfer_edit.html | 8 +++++++- 9 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 sql/Pg-upgrade2/add_customer_mandator_id.sql diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index 3652c7a68..52414eabd 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -39,6 +39,7 @@ __PACKAGE__->meta->columns( klass => { type => 'integer', default => '0' }, language => { type => 'varchar', length => 5 }, language_id => { type => 'integer' }, + mandator_id => { type => 'text' }, mtime => { type => 'timestamp' }, name => { type => 'text', not_null => 1 }, notes => { type => 'text' }, diff --git a/SL/DB/MetaSetup/Vendor.pm b/SL/DB/MetaSetup/Vendor.pm index 0493aa374..8d451ad6b 100644 --- a/SL/DB/MetaSetup/Vendor.pm +++ b/SL/DB/MetaSetup/Vendor.pm @@ -36,6 +36,7 @@ __PACKAGE__->meta->columns( itime => { type => 'timestamp', default => 'now()' }, language => { type => 'varchar', length => 5 }, language_id => { type => 'integer' }, + mandator_id => { type => 'text' }, mtime => { type => 'timestamp' }, name => { type => 'varchar', length => 75, not_null => 1 }, notes => { type => 'text' }, diff --git a/SL/SEPA.pm b/SL/SEPA.pm index d31204e3b..21629ba3d 100644 --- a/SL/SEPA.pm +++ b/SL/SEPA.pm @@ -177,8 +177,10 @@ sub retrieve_export { if ($export->{id}) { my ($columns, $joins); + my $mandator_id = $params{vc} eq 'customer' ? ', mandator_id' : ''; + if ($params{details}) { - $columns = qq|, arap.invnumber, arap.invoice, arap.transdate AS reference_date, vc.name AS vc_name, vc.${vc}number AS vc_number, c.accno AS chart_accno, c.description AS chart_description|; + $columns = qq|, arap.invnumber, arap.invoice, arap.transdate AS reference_date, vc.name AS vc_name, vc.${vc}number AS vc_number, c.accno AS chart_accno, c.description AS chart_description, ${mandator_id}|; $joins = qq|LEFT JOIN ${arap} arap ON (sei.${arap}_id = arap.id) LEFT JOIN ${vc} vc ON (arap.${vc}_id = vc.id) LEFT JOIN chart c ON (sei.chart_id = c.id)|; diff --git a/SL/SEPA/XML.pm b/SL/SEPA/XML.pm index 90c77ec3d..f939453fe 100644 --- a/SL/SEPA/XML.pm +++ b/SL/SEPA/XML.pm @@ -223,7 +223,7 @@ sub to_xml { $xml->startTag('DrctDbtTx'); $xml->startTag('MndtRltdInf'); - $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('company_number'))); + $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('mandator_id'))); $xml->dataElement('DtOfSgntr', $transaction->get('reference_date', 2010-12-02)); $xml->endTag('MndtRltdInf'); diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index 3ac7c3ebb..e7ca5ecd4 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -496,6 +496,7 @@ sub bank_transfer_download_sepa_xml { foreach my $item (@items) { my $requested_execution_date; + my $mandator_id; if ($item->{requested_execution_date}) { my ($yy, $mm, $dd) = $locale->parse_date($myconfig, $item->{requested_execution_date}); $requested_execution_date = sprintf '%04d-%02d-%02d', $yy, $mm, $dd; @@ -504,6 +505,7 @@ sub bank_transfer_download_sepa_xml { if ($vc eq 'customer') { my ($yy, $mm, $dd) = $locale->parse_date($myconfig, $item->{reference_date}); $item->{reference_date} = sprintf '%04d-%02d-%02d', $yy, $mm, $dd; + $mandator_id = $item->{mandator_id}; } $sepa_xml->add_transaction({ 'src_iban' => $item->{our_iban}, @@ -514,6 +516,7 @@ sub bank_transfer_download_sepa_xml { 'company_number' => $item->{vc_number}, 'amount' => $item->{amount}, 'reference' => $item->{reference}, + 'mandator_id' => $mandator_id, 'reference_date' => $item->{reference_date}, 'execution_date' => $requested_execution_date, 'end_to_end_id' => $item->{end_to_end_id} }); diff --git a/locale/de/all b/locale/de/all index 9e50555cf..052823046 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1286,6 +1286,7 @@ $self->{texts} = { 'Make default profile' => 'Zu Standardprofil machen', 'Manage Custom Variables' => 'Benutzerdefinierte Variablen', 'Mandantennummer' => 'Mandantennummer', + 'Mandator ID' => 'Mandanten-ID', 'Mandatory Departments' => 'Benutzer muss Abteilungen vergeben', 'Map' => 'Karte', 'Mar' => 'März', diff --git a/sql/Pg-upgrade2/add_customer_mandator_id.sql b/sql/Pg-upgrade2/add_customer_mandator_id.sql new file mode 100644 index 000000000..e27eba5c3 --- /dev/null +++ b/sql/Pg-upgrade2/add_customer_mandator_id.sql @@ -0,0 +1,6 @@ +-- @tag: add_customer_mandator_id +-- @description: Einführen einer Mandanten ID Spalte bei Kunden und Lieferanten. +-- @depends: release_3_0_0 + +ALTER TABLE customer ADD mandator_id text; +ALTER TABLE vendor ADD mandator_id text; diff --git a/templates/webpages/sepa/bank_transfer_create.html b/templates/webpages/sepa/bank_transfer_create.html index 092498297..e5ef6568f 100644 --- a/templates/webpages/sepa/bank_transfer_create.html +++ b/templates/webpages/sepa/bank_transfer_create.html @@ -47,6 +47,9 @@ [% 'IBAN' | $T8 %] [% 'BIC' | $T8 %] [% 'Bank' | $T8 %] + [% IF vc == 'customer' %] + [% 'Mandator ID' | $T8 %] + [%- END %] [%- FOREACH vbi = VC_BANK_INFO %] @@ -59,6 +62,9 @@ + [% IF vc == 'customer' %] + + [%- END %] [%- END %] diff --git a/templates/webpages/sepa/bank_transfer_edit.html b/templates/webpages/sepa/bank_transfer_edit.html index b8f209d75..589b3581b 100644 --- a/templates/webpages/sepa/bank_transfer_edit.html +++ b/templates/webpages/sepa/bank_transfer_edit.html @@ -33,6 +33,9 @@ [% 'Source bank account' | $T8 %] [%- END %] [% 'Amount' | $T8 %] + [% IF vc == 'customer' %] + [% 'Mandator ID' | $T8 %] + [%- END %] [% 'Reference' | $T8 %] [% 'Requested execution date' | $T8 %] [% 'Execution date' | $T8 %] @@ -44,7 +47,7 @@ [% 'IBAN' | $T8 %] [% 'BIC' | $T8 %] [%- IF show_post_payments_button %] -   +   [% L.date_tag('set_all_execution_date', '', onchange='set_all_execution_date_fields(this);') %] @@ -73,6 +76,9 @@ [% HTML.escape(item.vc_iban) %] [% HTML.escape(item.vc_bic) %] [% HTML.escape(LxERP.format_amount(item.amount, 2)) %] + [% IF vc == 'customer' %] + [% HTML.escape(item.mandator_id) %] + [%- END %] [% HTML.escape(item.reference) %] [% HTML.escape(item.requested_execution_date) %] -- 2.20.1