X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fsepa.pl;h=6fb9907d2e58ba13793f64ffd6f35258a8869f5f;hb=846a322f70e71c5d0338f13eeea842d0f87c5ae3;hp=3ac7c3ebbe95a06a93db77f67444a96c8f7508de;hpb=1f6a2920746912f82410c5855c15b2f6e6c434f9;p=kivitendo-erp.git diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index 3ac7c3ebb..6fb9907d2 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -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->{$_}; } @@ -496,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; @@ -504,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}, @@ -514,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();