Merge branch 'sepa-fixes-2320'
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 7 Jan 2014 18:09:55 +0000 (19:09 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 7 Jan 2014 18:09:55 +0000 (19:09 +0100)
Behebt #2320.

16 files changed:
SL/CT.pm
SL/DB/MetaSetup/Customer.pm
SL/DB/MetaSetup/SepaExportItem.pm
SL/DB/MetaSetup/Vendor.pm
SL/SEPA.pm
SL/SEPA/XML.pm
bin/mozilla/sepa.pl
locale/de/all
sql/Pg-upgrade2/add_customer_mandator_id.sql [new file with mode: 0644]
sql/Pg-upgrade2/add_depositor_for_customer_vendor.sql [new file with mode: 0644]
templates/webpages/customer_vendor/form.html
templates/webpages/customer_vendor/tabs/bank.html [new file with mode: 0644]
templates/webpages/customer_vendor/tabs/billing.html
templates/webpages/sepa/bank_transfer_add.html
templates/webpages/sepa/bank_transfer_create.html
templates/webpages/sepa/bank_transfer_edit.html

index b7ae9a5..fa1f914 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -308,7 +308,8 @@ sub get_bank_info {
   my $table        = $params{vc} eq 'customer' ? 'customer' : 'vendor';
   my @ids          = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id});
   my $placeholders = join ", ", ('?') x scalar @ids;
-  my $query        = qq|SELECT id, name, account_number, bank, bank_code, iban, bic
+  my $c_mandate    = $params{vc} eq 'customer' ? ', mandator_id, mandate_date_of_signature' : '';
+  my $query        = qq|SELECT id, name, account_number, bank, bank_code, iban, bic ${c_mandate}
                         FROM ${table}
                         WHERE id IN (${placeholders})|;
 
index 2d5a155..0f523a4 100644 (file)
@@ -9,52 +9,55 @@ use base qw(SL::DB::Object);
 __PACKAGE__->meta->table('customer');
 
 __PACKAGE__->meta->columns(
-  account_number      => { type => 'text' },
-  bank                => { type => 'text' },
-  bank_code           => { type => 'text' },
-  bcc                 => { type => 'text' },
-  bic                 => { type => 'varchar', length => 100 },
-  business_id         => { type => 'integer' },
-  c_vendor_id         => { type => 'text' },
-  cc                  => { type => 'text' },
-  city                => { type => 'varchar', length => 75 },
-  contact             => { type => 'text' },
-  country             => { type => 'varchar', length => 75 },
-  creditlimit         => { type => 'numeric', default => '0', precision => 5, scale => 15 },
-  currency_id         => { type => 'integer', not_null => 1 },
-  customernumber      => { type => 'text' },
-  delivery_term_id    => { type => 'integer' },
-  department_1        => { type => 'varchar', length => 75 },
-  department_2        => { type => 'varchar', length => 75 },
-  direct_debit        => { type => 'boolean', default => 'false' },
-  discount            => { type => 'float', precision => 4 },
-  email               => { type => 'text' },
-  fax                 => { type => 'varchar', length => 30 },
-  greeting            => { type => 'text' },
-  homepage            => { type => 'text' },
-  iban                => { type => 'varchar', length => 100 },
-  id                  => { type => 'integer', not_null => 1, sequence => 'id' },
-  itime               => { type => 'timestamp', default => 'now()' },
-  klass               => { type => 'integer', default => '0' },
-  language            => { type => 'varchar', length => 5 },
-  language_id         => { type => 'integer' },
-  mtime               => { type => 'timestamp' },
-  name                => { type => 'text', not_null => 1 },
-  notes               => { type => 'text' },
-  obsolete            => { type => 'boolean', default => 'false' },
-  payment_id          => { type => 'integer' },
-  phone               => { type => 'text' },
-  salesman_id         => { type => 'integer' },
-  street              => { type => 'varchar', length => 75 },
-  taxincluded         => { type => 'boolean' },
-  taxincluded_checked => { type => 'boolean' },
-  taxnumber           => { type => 'text' },
-  taxzone_id          => { type => 'integer', default => '0', not_null => 1 },
-  terms               => { type => 'integer', default => '0' },
-  user_password       => { type => 'text' },
-  username            => { type => 'varchar', length => 50 },
-  ustid               => { type => 'text' },
-  zipcode             => { type => 'varchar', length => 10 },
+  account_number            => { type => 'text' },
+  bank                      => { type => 'text' },
+  bank_code                 => { type => 'text' },
+  bcc                       => { type => 'text' },
+  bic                       => { type => 'varchar', length => 100 },
+  business_id               => { type => 'integer' },
+  c_vendor_id               => { type => 'text' },
+  cc                        => { type => 'text' },
+  city                      => { type => 'varchar', length => 75 },
+  contact                   => { type => 'text' },
+  country                   => { type => 'varchar', length => 75 },
+  creditlimit               => { type => 'numeric', default => '0', precision => 5, scale => 15 },
+  currency_id               => { type => 'integer', not_null => 1 },
+  customernumber            => { type => 'text' },
+  delivery_term_id          => { type => 'integer' },
+  department_1              => { type => 'varchar', length => 75 },
+  department_2              => { type => 'varchar', length => 75 },
+  depositor                 => { type => 'text' },
+  direct_debit              => { type => 'boolean', default => 'false' },
+  discount                  => { type => 'float', precision => 4 },
+  email                     => { type => 'text' },
+  fax                       => { type => 'varchar', length => 30 },
+  greeting                  => { type => 'text' },
+  homepage                  => { type => 'text' },
+  iban                      => { type => 'varchar', length => 100 },
+  id                        => { type => 'integer', not_null => 1, sequence => 'id' },
+  itime                     => { type => 'timestamp', default => 'now()' },
+  klass                     => { type => 'integer', default => '0' },
+  language                  => { type => 'varchar', length => 5 },
+  language_id               => { type => 'integer' },
+  mandate_date_of_signature => { type => 'date' },
+  mandator_id               => { type => 'text' },
+  mtime                     => { type => 'timestamp' },
+  name                      => { type => 'text', not_null => 1 },
+  notes                     => { type => 'text' },
+  obsolete                  => { type => 'boolean', default => 'false' },
+  payment_id                => { type => 'integer' },
+  phone                     => { type => 'text' },
+  salesman_id               => { type => 'integer' },
+  street                    => { type => 'varchar', length => 75 },
+  taxincluded               => { type => 'boolean' },
+  taxincluded_checked       => { type => 'boolean' },
+  taxnumber                 => { type => 'text' },
+  taxzone_id                => { type => 'integer', default => '0', not_null => 1 },
+  terms                     => { type => 'integer', default => '0' },
+  user_password             => { type => 'text' },
+  username                  => { type => 'varchar', length => 50 },
+  ustid                     => { type => 'text' },
+  zipcode                   => { type => 'varchar', length => 10 },
 );
 
 __PACKAGE__->meta->primary_key_columns([ 'id' ]);
index 08dd06e..f2b325d 100644 (file)
@@ -9,21 +9,25 @@ use base qw(SL::DB::Object);
 __PACKAGE__->meta->table('sepa_export_items');
 
 __PACKAGE__->meta->columns(
-  amount                   => { type => 'numeric', precision => 5, scale => 25 },
-  ap_id                    => { type => 'integer' },
-  ar_id                    => { type => 'integer' },
-  chart_id                 => { type => 'integer', not_null => 1 },
-  end_to_end_id            => { type => 'varchar', length => 35 },
-  executed                 => { type => 'boolean', default => 'false' },
-  execution_date           => { type => 'date' },
-  id                       => { type => 'integer', not_null => 1, sequence => 'id' },
-  our_bic                  => { type => 'varchar', length => 100 },
-  our_iban                 => { type => 'varchar', length => 100 },
-  reference                => { type => 'varchar', length => 35 },
-  requested_execution_date => { type => 'date' },
-  sepa_export_id           => { type => 'integer', not_null => 1 },
-  vc_bic                   => { type => 'varchar', length => 100 },
-  vc_iban                  => { type => 'varchar', length => 100 },
+  amount                       => { type => 'numeric', precision => 5, scale => 25 },
+  ap_id                        => { type => 'integer' },
+  ar_id                        => { type => 'integer' },
+  chart_id                     => { type => 'integer', not_null => 1 },
+  end_to_end_id                => { type => 'varchar', length => 35 },
+  executed                     => { type => 'boolean', default => 'false' },
+  execution_date               => { type => 'date' },
+  id                           => { type => 'integer', not_null => 1, sequence => 'id' },
+  our_bic                      => { type => 'varchar', length => 100 },
+  our_depositor                => { type => 'text' },
+  our_iban                     => { type => 'varchar', length => 100 },
+  reference                    => { type => 'varchar', length => 35 },
+  requested_execution_date     => { type => 'date' },
+  sepa_export_id               => { type => 'integer', not_null => 1 },
+  vc_bic                       => { type => 'varchar', length => 100 },
+  vc_depositor                 => { type => 'text' },
+  vc_iban                      => { type => 'varchar', length => 100 },
+  vc_mandate_date_of_signature => { type => 'date' },
+  vc_mandator_id               => { type => 'text' },
 );
 
 __PACKAGE__->meta->primary_key_columns([ 'id' ]);
index f2988ad..0493aa3 100644 (file)
@@ -24,6 +24,7 @@ __PACKAGE__->meta->columns(
   delivery_term_id => { type => 'integer' },
   department_1     => { type => 'varchar', length => 75 },
   department_2     => { type => 'varchar', length => 75 },
+  depositor        => { type => 'text' },
   direct_debit     => { type => 'boolean', default => 'false' },
   discount         => { type => 'float', precision => 4 },
   email            => { type => 'text' },
index d31204e..63efe2c 100644 (file)
@@ -19,12 +19,14 @@ sub retrieve_open_invoices {
   my $arap     = $params{vc} eq 'customer' ? 'ar'       : 'ap';
   my $vc       = $params{vc} eq 'customer' ? 'customer' : 'vendor';
 
+  my $mandate  = $params{vc} eq 'customer' ? " AND COALESCE(vc.mandator_id, '') <> '' AND vc.mandate_date_of_signature IS NOT NULL " : '';
+
   my $query =
     qq|
        SELECT ${arap}.id, ${arap}.invnumber, ${arap}.${vc}_id as vc_id, ${arap}.amount AS invoice_amount, ${arap}.invoice,
          vc.name AS vcname, vc.language_id, ${arap}.duedate as duedate, ${arap}.direct_debit,
 
-         COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' AS vc_bank_info_ok,
+         COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' ${mandate} AS vc_bank_info_ok,
 
          ${arap}.amount - ${arap}.paid - COALESCE(open_transfers.amount, 0) AS open_amount
 
@@ -76,14 +78,16 @@ sub create_export {
 
   my $q_item_id = qq|SELECT nextval('id')|;
   my $h_item_id = prepare_query($form, $dbh, $q_item_id);
+  my $c_mandate = $params{vc} eq 'customer' ? ', vc_mandator_id, vc_mandate_date_of_signature' : '';
+  my $p_mandate = $params{vc} eq 'customer' ? ', ?, ?' : '';
 
   my $q_insert =
     qq|INSERT INTO sepa_export_items (id,          sepa_export_id,           ${arap}_id,  chart_id,
                                       amount,      requested_execution_date, reference,   end_to_end_id,
-                                      our_iban,    our_bic,                  vc_iban,     vc_bic)
+                                      our_iban,    our_bic,                  vc_iban,     vc_bic ${c_mandate})
        VALUES                        (?,           ?,                        ?,           ?,
                                       ?,           ?,                        ?,           ?,
-                                      ?,           ?,                        ?,           ?)|;
+                                      ?,           ?,                        ?,           ? ${p_mandate})|;
   my $h_insert = prepare_query($form, $dbh, $q_insert);
 
   my $q_reference =
@@ -130,6 +134,8 @@ sub create_export {
                   $transfer->{reference},            $end_to_end_id,
                   map { my $pfx = $_; map { $transfer->{"${pfx}_${_}"} } qw(iban bic) } qw(our vc));
 
+    push @values, $transfer->{vc_mandator_id}, conv_date($transfer->{vc_mandate_date_of_signature}) if $params{vc} eq 'customer';
+
     do_statement($form, $h_insert, $q_insert, @values);
   }
 
@@ -177,8 +183,10 @@ sub retrieve_export {
   if ($export->{id}) {
     my ($columns, $joins);
 
+    my $mandator_id = $params{vc} eq 'customer' ? ', mandator_id, mandate_date_of_signature' : '';
+
     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)|;
index 90c77ec..8ccfa83 100644 (file)
@@ -223,8 +223,8 @@ sub to_xml {
         $xml->startTag('DrctDbtTx');
 
         $xml->startTag('MndtRltdInf');
-        $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('company_number')));
-        $xml->dataElement('DtOfSgntr', $transaction->get('reference_date', 2010-12-02));
+        $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('mandator_id')));
+        $xml->dataElement('DtOfSgntr', $self->_restricted_identification_sepa2($transaction->get('date_of_signature')));
         $xml->endTag('MndtRltdInf');
 
         $xml->startTag('CdtrSchmeId');
index 2850bfb..6fb9907 100755 (executable)
@@ -1,7 +1,7 @@
 use strict;
 
 use List::MoreUtils qw(any none uniq);
-use List::Util qw(first);
+use List::Util qw(sum first);
 use POSIX qw(strftime);
 
 use SL::BankAccount;
@@ -105,14 +105,19 @@ sub bank_transfer_create {
     $form->error($locale->text('You have selected none of the invoices.'));
   }
 
+  my $total_trans = sum map { $_->{open_amount} } @bank_transfers;
+
   my ($vc_bank_info);
   my $error_message;
 
+  my @bank_columns    = qw(iban bic);
+  push @bank_columns, qw(mandator_id mandate_date_of_signature) if $vc eq 'customer';
+
   if ($form->{confirmation}) {
     $vc_bank_info = { map { $_->{id} => $_ } @{ $form->{vc_bank_info} || [] } };
 
     foreach my $info (values %{ $vc_bank_info }) {
-      if (any { !$info->{$_} } qw(iban bic)) {
+      if (any { !$info->{$_} } @bank_columns) {
         $error_message = $locale->text('The bank information must not be empty.');
         last;
       }
@@ -136,11 +141,12 @@ sub bank_transfer_create {
                                        'bank_account_label' => $bank_account_label_sub,
                                        'error_message'      => $error_message,
                                        'vc'                 => $vc,
+                                       'total_trans'        => $total_trans,
                                      });
 
   } else {
     foreach my $bank_transfer (@bank_transfers) {
-      foreach (qw(iban bic)) {
+      foreach (@bank_columns) {
         $bank_transfer->{"vc_${_}"}  = $vc_bank_info->{ $bank_transfer->{vc_id} }->{$_};
         $bank_transfer->{"our_${_}"} = $bank_account->{$_};
       }
@@ -493,6 +499,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;
@@ -501,6 +508,11 @@ 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};
+      if ($item->{mandate_date_of_signature}) {
+        ($yy, $mm, $dd)                    = $locale->parse_date($myconfig, $item->{mandate_date_of_signature});
+        $item->{mandate_date_of_signature} = sprintf '%04d-%02d-%02d', $yy, $mm, $dd;
+      }
     }
 
     $sepa_xml->add_transaction({ 'src_iban'       => $item->{our_iban},
@@ -511,9 +523,11 @@ 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} });
+                                 'end_to_end_id'  => $item->{end_to_end_id},
+                                 'date_of_signature' => $item->{mandate_date_of_signature}, });
   }
 
   my $xml = $sepa_xml->to_xml();
index f4f207d..ddc1a1d 100755 (executable)
@@ -278,6 +278,7 @@ $self->{texts} = {
   'Bank Code Number'            => 'Bankleitzahl',
   'Bank Connection Tax Office'  => 'Bankverbindung des Finanzamts',
   'Bank Connections'            => 'Bankverbindungen',
+  'Bank account'                => 'Bankkonto',
   'Bank accounts'               => 'Bankkonten',
   'Bank code'                   => 'Bankleitzahl',
   'Bank collection amount'      => 'Einzugsbetrag',
@@ -1286,6 +1287,8 @@ $self->{texts} = {
   'Make default profile'        => 'Zu Standardprofil machen',
   'Manage Custom Variables'     => 'Benutzerdefinierte Variablen',
   'Mandantennummer'             => 'Mandantennummer',
+  'Mandate Date of Signature'   => 'Mandat-Unterschriftsdatum',
+  'Mandator ID'                 => 'Mandanten-ID',
   'Mandatory Departments'       => 'Benutzer muss Abteilungen vergeben',
   'Map'                         => 'Karte',
   'Mar'                         => 'März',
@@ -1494,6 +1497,7 @@ $self->{texts} = {
   'Outputformat'                => 'Ausgabeformat',
   'Overdue sales quotations and requests for quotations' => 'Überfällige Angebote und Preisanfragen',
   'Override invoice language'   => 'Diese Sprache verwenden',
+  'Owner of account'            => 'Kontoinhaber',
   'PAYMENT POSTED'              => 'Rechung gebucht',
   'PDF'                         => 'PDF',
   'PDF (OpenDocument/OASIS)'    => 'PDF (OpenDocument/OASIS)',
@@ -2001,6 +2005,7 @@ $self->{texts} = {
   'Sum Credit'                  => 'Summe Haben',
   'Sum Debit'                   => 'Summe Soll',
   'Sum for'                     => 'Summe für',
+  'Sum open amount'             => 'Summierter offener Betrag',
   'Sum per'                     => 'Summe per',
   'Summen- und Saldenliste'     => 'Summen- und Saldenliste',
   'Superuser name'              => 'Datenbankadministrator',
@@ -2224,6 +2229,8 @@ $self->{texts} = {
   'The project type has been deleted.' => 'Der Projekttyp wurde gelöscht.',
   'The project type has been saved.' => 'Der Projekttyp wurde gespeichert.',
   'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.',
+  'The required information consists of the IBAN and the BIC.' => 'Die benötigten Informationen bestehen aus der IBAN und der BIC.',
+  'The required information consists of the IBAN, the BIC, the mandator ID and the mandate\'s date of signature.' => 'Die benötigten Informationen bestehen aus IBAN, BIC, Mandanten-ID und dem Unterschriftsdatum des Mandates.',
   'The second reason is that kivitendo allowed the user to enter the tax amount manually regardless of the taxkey used.' => 'Der zweite Grund war, dass kivitendo zuließ, dass die Benutzer beliebige, von den tatsächlichen Steuerschlüsseln unabhängige Steuerbeträge eintrugen.',
   'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul f&uuml;r Sie installieren zu lassen.',
   'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.',
diff --git a/sql/Pg-upgrade2/add_customer_mandator_id.sql b/sql/Pg-upgrade2/add_customer_mandator_id.sql
new file mode 100644 (file)
index 0000000..99a788e
--- /dev/null
@@ -0,0 +1,18 @@
+-- @tag: add_customer_mandator_id
+-- @description: Einführen einer Mandanten-ID- und Signatur-Datums-Spalte bei Kunden.
+-- @depends: release_3_0_0
+
+ALTER TABLE customer          ADD COLUMN mandator_id                  text;
+ALTER TABLE customer          ADD COLUMN mandate_date_of_signature    date;
+ALTER TABLE sepa_export_items ADD COLUMN vc_mandator_id               text;
+ALTER TABLE sepa_export_items ADD COLUMN vc_mandate_date_of_signature date;
+
+UPDATE sepa_export_items
+SET vc_mandator_id = (
+  SELECT c.customernumber
+  FROM ar
+  LEFT JOIN customer c ON (ar.customer_id = c.id)
+  WHERE ar.id = sepa_export_items.ar_id
+),
+vc_mandate_date_of_signature = '2010-01-01'::date
+WHERE ar_id IS NOT NULL;
diff --git a/sql/Pg-upgrade2/add_depositor_for_customer_vendor.sql b/sql/Pg-upgrade2/add_depositor_for_customer_vendor.sql
new file mode 100644 (file)
index 0000000..cba51d7
--- /dev/null
@@ -0,0 +1,11 @@
+-- @tag: add_depositor_for_customer_vendor
+-- @description: Einführen einer Depositor (Kontoinhaber) Spalte bei Customer bzw. Vendor
+-- @depends: sepa
+
+ALTER TABLE customer          ADD depositor     text;
+ALTER TABLE vendor            ADD depositor     text;
+ALTER TABLE sepa_export_items ADD our_depositor text;
+ALTER TABLE sepa_export_items ADD vc_depositor  text;
+
+UPDATE customer SET depositor = name;
+UPDATE vendor   SET depositor = name;
index a0d1ab9..ad2da05 100644 (file)
@@ -16,6 +16,7 @@
   <div class="tabwidget" id="customer_vendor_tabs">
     <ul>
       <li><a href="#billing">[% 'Billing Address' | $T8 %]</a></li>
+      <li><a href="#bank">[% 'Bank account' | $T8 %]</a></li>
       <li><a href="#shipto">[% 'Shipping Address' | $T8 %]</a></li>
       <li><a href="#contacts">[% 'Contacts' | $T8 %]</a></li>
       [% IF ( SELF.cv.id && AUTH.assert('sales_all_edit', 1) ) %]
@@ -29,6 +30,7 @@
     </ul>
 
     [% PROCESS "customer_vendor/tabs/billing.html" %]
+    [% PROCESS "customer_vendor/tabs/bank.html" %]
     [% PROCESS "customer_vendor/tabs/shipto.html" %]
     [% PROCESS "customer_vendor/tabs/contacts.html" %]
     [% IF ( SELF.cv.id && AUTH.assert('sales_all_edit', 1) ) %]
   }
 -->
 </script>
-
diff --git a/templates/webpages/customer_vendor/tabs/bank.html b/templates/webpages/customer_vendor/tabs/bank.html
new file mode 100644 (file)
index 0000000..1f08af4
--- /dev/null
@@ -0,0 +1,63 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+
+<div id="bank">
+  <table>
+    <tr>
+      <th align="right">[% 'Owner of account' | $T8 %]</th>
+
+      <td>
+        [% L.input_tag('cv.depositor', SELF.cv.depositor, size = 20) %]
+      </td>
+
+    [%- IF ( SELF.is_customer ) %]
+      <th align="right">[% 'Mandator ID' | $T8 %]</th>
+      <td>
+        [% L.input_tag('cv.mandator_id', SELF.cv.mandator_id, size = 20) %]
+      </td>
+
+      <th align="right">[% 'Mandate Date of Signature' | $T8 %]</th>
+      <td>
+        [% L.date_tag('cv.mandate_date_of_signature', SELF.cv.mandate_date_of_signature) %]
+      </td>
+    [%- END %]
+    </tr>
+
+    <tr>
+      <th align="right">[% 'IBAN' | $T8 %]</th>
+
+      <td>
+        [% L.input_tag('cv.iban', SELF.cv.iban, size = 34, maxlength = 100) %]
+      </td>
+
+
+      <th align="right">[% 'BIC' | $T8 %]</th>
+      <td>
+        [% L.input_tag('cv.bic', SELF.cv.bic, size = 20, maxlength = 100) %]
+      </td>
+
+      <th align="right">[% 'Bank' | $T8 %]</th>
+
+      <td>
+        [% L.input_tag('cv.bank', SELF.cv.bank, size = 20) %]
+      </td>
+    </tr>
+
+    <tr>
+      <th align="right">[% 'Account Number' | $T8 %]</th>
+
+      <td>
+        [% L.input_tag('cv.account_number', SELF.cv.account_number, size = 20, maxlength = 100) %]
+      </td>
+
+
+      <th align="right">[% 'Bank Code Number' | $T8 %]</th>
+
+      <td>
+        [% L.input_tag('cv.bank_code', SELF.cv.bank_code, size = 20, maxlength = 100) %]
+      </td>
+    </tr>
+  </table>
+</div>
index 5c036e0..c65bed0 100644 (file)
       [%- END %]
     </tr>
 
+  [% IF ( SELF.all_currencies.size ) %]
     <tr>
-      <th align="right">[% 'Account Number' | $T8 %]</th>
-
-      <td>
-        [% L.input_tag('cv.account_number', SELF.cv.account_number, size = 20, maxlength = 100) %]
-      </td>
-
-
-      <th align="right">[% 'Bank Code Number' | $T8 %]</th>
-
-      <td>
-        [% L.input_tag('cv.bank_code', SELF.cv.bank_code, size = 20, maxlength = 100) %]
-      </td>
-
-
-      <th align="right">[% 'Bank' | $T8 %]</th>
-
-      <td>
-        [% L.input_tag('cv.bank', SELF.cv.bank, size = 20) %]
-      </td>
-    </tr>
-
-    <tr>
-      <th align="right">[% 'IBAN' | $T8 %]</th>
-
-      <td>
-        [% L.input_tag('cv.iban', SELF.cv.iban, size = 34, maxlength = 100) %]
-      </td>
-
-
-      <th align="right">[% 'BIC' | $T8 %]</th>
-      <td>
-        [% L.input_tag('cv.bic', SELF.cv.bic, size = 11, maxlength = 100) %]
-      </td>
-
-
-      [% IF ( SELF.all_currencies.size ) %]
         <th align="right">[% 'Currency' | $T8 %]</th>
 
         <td>
           [% L.select_tag('cv.currency_id', SELF.all_currencies, title_key = 'name', value_key = 'id', default = SELF.cv.currency_id) %]
         </td>
-      [% END %]
     </tr>
+  [% END %]
 
     <tr>
       [% IF ( !INSTANCE_CONF.get_vertreter ) %]
index fe2d441..4ae82d1 100644 (file)
@@ -77,7 +77,7 @@
        <input name="bank_transfers[].reference" value="[% HTML.escape(reference.substr(0, 140)) %]" maxlength="140" size="60">
       </td>
       <td align="right">
-       <input name="bank_transfers[].amount" value="[% LxERP.format_amount(invoice.invoice_amount, -2) %]" style="text-align: right" size="12">
+       <input name="bank_transfers[].amount" value="[% LxERP.format_amount(invoice.invoice_amount, 2) %]" style="text-align: right" size="12">
       </td>
      </tr>
     [%- END %]
     <sup>(1)</sup>
     [%- IF is_vendor %]
      [%- 'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' | $T8 %]
+     [% "The required information consists of the IBAN and the BIC." | $T8 %]
     [%- ELSE %]
      [%- 'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' | $T8 %]
+     [% "The required information consists of the IBAN, the BIC, the mandator ID and the mandate's date of signature." | $T8 %]
     [%- END %]
    </p>
   [%- END %]
index 561baec..80af4c4 100644 (file)
      <th class="listheading">[% 'IBAN' | $T8 %]</th>
      <th class="listheading">[% 'BIC' | $T8 %]</th>
      <th class="listheading">[% 'Bank' | $T8 %]</th>
+     [% IF vc == 'customer' %]
+      <th class="listheading">[% 'Mandator ID' | $T8 %]</th>
+      <th class="listheading">[% 'Mandate Date of Signature' | $T8 %]</th>
+     [%- END %]
     </tr>
 
     [%- FOREACH vbi = VC_BANK_INFO %]
      <td><input name="vc_bank_info[].iban" size="34" value="[% HTML.escape(vbi.iban.substr(0, 34)) %]" maxlength="34"></td>
      <td><input name="vc_bank_info[].bic" size="20" value="[% HTML.escape(vbi.bic.substr(0, 20)) %]" maxlength="20"></td>
      <td><input name="vc_bank_info[].bank" size="30" value="[% HTML.escape(vbi.bank) %]"></td>
+     [% IF vc == 'customer' %]
+      <td><input name="vc_bank_info[].mandator_id" size="30" value="[% HTML.escape(vbi.mandator_id) %]"></td>
+      <td>[% L.date_tag("vc_bank_info[].mandate_date_of_signature", vbi.mandate_date_of_signature) %]</td>
+     [%- END %]
     </tr>
     [%- END %]
    </table>
    </table>
   </p>
 
+  <p>
+   [% 'Sum open amount' | $T8 %]: [% LxERP.format_amount(total_trans, -2) %]
+  </p>
+
   <p>
    [%- IF is_vendor %]
     <input type="submit" class="submit" name="action_bank_transfer_create" value="[% 'Create bank transfer' | $T8 %]">
index b8f209d..589b358 100644 (file)
@@ -33,6 +33,9 @@
       <th class="listheading" colspan="2">[% 'Source bank account' | $T8 %]</th>
      [%- END %]
      <th class="listheading" align="right">[% 'Amount' | $T8 %]</th>
+     [% IF vc == 'customer' %]
+      <th class="listheading" align="right">[% 'Mandator ID' | $T8 %]</th>
+     [%- END %]
      <th class="listheading">[% 'Reference' | $T8 %]</th>
      <th class="listheading" align="right">[% 'Requested execution date' | $T8 %]</th>
      <th class="listheading" align="right">[% 'Execution date' | $T8 %]</th>
@@ -44,7 +47,7 @@
      <th class="listheading">[% 'IBAN' | $T8 %]</th>
      <th class="listheading">[% 'BIC' | $T8 %]</th>
      [%- IF show_post_payments_button %]
-      <th class="listheading" colspan="3">&nbsp;</th>
+      <th class="listheading" colspan="[% IF vc == 'customer' %]4[% ELSE %]3[% END %]">&nbsp;</th>
       <th class="listheading">
         [% L.date_tag('set_all_execution_date', '', onchange='set_all_execution_date_fields(this);') %]
       </th>
@@ -73,6 +76,9 @@
       <td>[% HTML.escape(item.vc_iban) %]</td>
       <td>[% HTML.escape(item.vc_bic) %]</td>
       <td align="right">[% HTML.escape(LxERP.format_amount(item.amount, 2)) %]</td>
+      [% IF vc == 'customer' %]
+       <td>[% HTML.escape(item.mandator_id) %]</td>
+      [%- END %]
       <td>[% HTML.escape(item.reference) %]</td>
       <td align="right">[% HTML.escape(item.requested_execution_date) %]</td>
       <td align="right" nowrap>