]> wagnertech.de Git - mfinanz.git/commitdiff
SEPA: Feld »Signaturdatum«; Bearbeiten der Felder in Stammdatenmasken; Speichern...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 7 Jan 2014 18:06:35 +0000 (19:06 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 7 Jan 2014 18:06:35 +0000 (19:06 +0100)
12 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
templates/webpages/customer_vendor/tabs/bank.html
templates/webpages/sepa/bank_transfer_add.html
templates/webpages/sepa/bank_transfer_create.html

index b7ae9a50407f5a1383c9a62aabfda267caf95cd2..fa1f914773542ebdfcb41ad033a766f290300d1e 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 52414eabd0e3f8b184f038dac336663c221b1a98..0f523a46625c9a0b857a3a5cc3fe6471938dc97b 100644 (file)
@@ -9,54 +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 },
-  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' },
-  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 },
+  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 4746572ddfd2454d4586bc8b75b75118d4a9f93e..f2b325d8509f0cdada765dd268e3e6ebc93bd46e 100644 (file)
@@ -9,23 +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_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 },
+  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 8d451ad6bd3f63104fcd2da894a3739bfe7b4f58..0493aa3744de4a42c8f3662b4b507372f0929bbc 100644 (file)
@@ -36,7 +36,6 @@ __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' },
index 21629ba3d61e87d06790b375f51184e7a879d132..63efe2c5a981a7a975fa7af069f543d5ea4fa113 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,10 +183,10 @@ sub retrieve_export {
   if ($export->{id}) {
     my ($columns, $joins);
 
-    my $mandator_id = $params{vc} eq 'customer' ? ', mandator_id' : '';
+    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, ${mandator_id}|;
+      $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 f939453fe8f9f8a936a9cd7c2b42ddf9d97d9a1c..8ccfa837452d2d9627cd72d458e54372c27185a7 100644 (file)
@@ -224,7 +224,7 @@ sub to_xml {
 
         $xml->startTag('MndtRltdInf');
         $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('mandator_id')));
-        $xml->dataElement('DtOfSgntr', $transaction->get('reference_date', 2010-12-02));
+        $xml->dataElement('DtOfSgntr', $self->_restricted_identification_sepa2($transaction->get('date_of_signature')));
         $xml->endTag('MndtRltdInf');
 
         $xml->startTag('CdtrSchmeId');
index e7ca5ecd455677aaa9e49ea0684e7b259f409412..6fb9907d2e58ba13793f64ffd6f35258a8869f5f 100755 (executable)
@@ -110,11 +110,14 @@ sub bank_transfer_create {
   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;
       }
@@ -143,7 +146,7 @@ sub bank_transfer_create {
 
   } 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->{$_};
       }
@@ -506,6 +509,10 @@ sub bank_transfer_download_sepa_xml {
       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},
@@ -519,7 +526,8 @@ sub bank_transfer_download_sepa_xml {
                                  '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 93453293e175305aba39a73c5abb4f81cb1368e7..7c529a31f08c7997a0c2aa87fad901840a3042d5 100755 (executable)
@@ -1287,6 +1287,7 @@ $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',
@@ -2227,6 +2228,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.',
index e27eba5c33eee85a9380a0079cc611291e3bcec1..99a788e92d5fb57d442b7876bdb8ab224e9e02e6 100644 (file)
@@ -1,6 +1,18 @@
 -- @tag: add_customer_mandator_id
--- @description: Einführen einer Mandanten ID Spalte bei Kunden und Lieferanten.
+-- @description: Einführen einer Mandanten-ID- und Signatur-Datums-Spalte bei Kunden.
 -- @depends: release_3_0_0
 
-ALTER TABLE customer ADD mandator_id text;
-ALTER TABLE vendor   ADD mandator_id text;
+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;
index 878a928b3fafaae036742a592a3bb1bdd6fdafdf..1f08af4b5153cdea5177ef1a921a542cfe0c514c 100644 (file)
         [% 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>
index 2793263682c62d4d25acb1084f012be59f7deec8..4ae82d12d45e21f151b721698659cbc2d755493b 100644 (file)
     <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 e5ef6568f1ea91ab874d2ef6538c8259e95ade9a..80af4c49d548dbf85d81d94fe3f2ae22988cd174 100644 (file)
@@ -49,6 +49,7 @@
      <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>
 
@@ -64,6 +65,7 @@
      <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 %]