3 use List::MoreUtils qw(any none uniq);
4 use List::Util qw(sum first);
5 use POSIX qw(strftime);
8 use SL::DB::BankAccount;
9 use SL::DB::SepaExport;
13 use SL::GenericTranslations;
14 use SL::ReportGenerator;
18 require "bin/mozilla/common.pl";
19 require "bin/mozilla/reportgenerator.pl";
21 sub bank_transfer_add {
22 $main::lxdebug->enter_sub();
24 my $form = $main::form;
25 my $locale = $main::locale;
26 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
28 $form->{title} = $vc eq 'customer' ? $::locale->text('Prepare bank collection via SEPA XML') : $locale->text('Prepare bank transfer via SEPA XML');
30 my $bank_accounts = SL::DB::Manager::BankAccount->get_all_sorted( query => [ obsolete => 0 ] );
32 if (!scalar @{ $bank_accounts }) {
33 $form->error($locale->text('You have not added bank accounts yet.'));
36 my $invoices = SL::SEPA->retrieve_open_invoices(vc => $vc);
38 if (!scalar @{ $invoices }) {
39 $form->show_generic_information($locale->text('Either there are no open invoices, or you have already initiated bank transfers ' .
40 'with the open amounts for those that are still open.'));
41 $main::lxdebug->leave_sub();
45 # Only include those per default that require manual action from our
46 # side. For sales invoices these are the ones for which direct debit
47 # has been selected. For purchase invoices it's the other way
48 # around: if direct debit is active then the vendor will collect
49 # from us automatically and we don't have to send money manually.
50 $_->{checked} = ($vc eq 'customer' ? $_->{direct_debit} : !$_->{direct_debit}) for @{ $invoices };
52 my $translation_list = GenericTranslations->list(translation_type => 'sepa_remittance_info_pfx');
53 my %translations = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list };
55 foreach my $invoice (@{ $invoices }) {
56 my $prefix = $translations{ $invoice->{language_id} } || $translations{default} || $::locale->text('Invoice');
57 $prefix .= ' ' unless $prefix =~ m/ $/;
58 $invoice->{reference_prefix} = $prefix;
62 print $form->parse_html_template('sepa/bank_transfer_add',
63 { 'INVOICES' => $invoices,
64 'BANK_ACCOUNTS' => $bank_accounts,
68 $main::lxdebug->leave_sub();
71 sub bank_transfer_create {
72 $main::lxdebug->enter_sub();
74 my $form = $main::form;
75 my $locale = $main::locale;
76 my $myconfig = \%main::myconfig;
77 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
79 $form->{title} = $vc eq 'customer' ? $::locale->text('Create bank collection via SEPA XML') : $locale->text('Create bank transfer via SEPA XML');
81 my $bank_accounts = SL::DB::Manager::BankAccount->get_all_sorted( query => [ obsolete => 0 ] );
82 if (!scalar @{ $bank_accounts }) {
83 $form->error($locale->text('You have not added bank accounts yet.'));
86 my $bank_account = SL::DB::Manager::BankAccount->find_by( id => $form->{bank_account} );
88 unless ( $bank_account ) {
89 $form->error($locale->text('The selected bank account does not exist anymore.'));
92 my $arap_id = $vc eq 'customer' ? 'ar_id' : 'ap_id';
93 my $invoices = SL::SEPA->retrieve_open_invoices(vc => $vc);
95 # load all open invoices (again), but grep out the ones that were selected with checkboxes beforehand ($_->selected). At this stage we again have all the invoice information, including dropdown with payment_type options
96 # all the information from retrieve_open_invoices is then ADDED to what was passed via @{ $form->{bank_transfers} }
97 # parse amount from the entry in the form, but take skonto_amount from PT again
98 # the map inserts the values of invoice_map directly into the array of hashes
99 my %invoices_map = map { $_->{id} => $_ } @{ $invoices };
101 map +{ %{ $invoices_map{ $_->{$arap_id} } }, %{ $_ } },
102 grep { $_->{selected} && (0 < $_->{amount}) && $invoices_map{ $_->{$arap_id} } }
103 map { $_->{amount} = $form->parse_amount($myconfig, $_->{amount}); $_ }
104 @{ $form->{bank_transfers} || [] };
106 # override default payment_type selection and set it to the one chosen by the user
107 # in the previous step, so that we don't need the logic in the template
108 foreach my $bt (@bank_transfers) {
109 foreach my $type ( @{$bt->{payment_select_options}} ) {
110 if ( $type->{payment_type} eq $bt->{payment_type} ) {
111 $type->{selected} = 1;
113 $type->{selected} = 0;
118 if (!scalar @bank_transfers) {
119 $form->error($locale->text('You have selected none of the invoices.'));
122 my $total_trans = sum map { $_->{open_amount} } @bank_transfers;
127 my @bank_columns = qw(iban bic);
128 push @bank_columns, qw(mandator_id mandate_date_of_signature) if $vc eq 'customer';
130 if ($form->{confirmation}) {
131 $vc_bank_info = { map { $_->{id} => $_ } @{ $form->{vc_bank_info} || [] } };
133 foreach my $info (values %{ $vc_bank_info }) {
134 if (any { !$info->{$_} } @bank_columns) {
135 $error_message = $locale->text('The bank information must not be empty.');
141 if ($error_message || !$form->{confirmation}) {
142 my @vc_ids = uniq map { $_->{vc_id} } @bank_transfers;
143 $vc_bank_info ||= CT->get_bank_info('vc' => $vc,
145 my @vc_bank_info = sort { lc $a->{name} cmp lc $b->{name} } values %{ $vc_bank_info };
148 print $form->parse_html_template('sepa/bank_transfer_create',
149 { 'BANK_TRANSFERS' => \@bank_transfers,
150 'BANK_ACCOUNTS' => $bank_accounts,
151 'VC_BANK_INFO' => \@vc_bank_info,
152 'bank_account' => $bank_account,
153 'error_message' => $error_message,
155 'total_trans' => $total_trans,
159 foreach my $bank_transfer (@bank_transfers) {
160 foreach (@bank_columns) {
161 $bank_transfer->{"vc_${_}"} = $vc_bank_info->{ $bank_transfer->{vc_id} }->{$_};
162 $bank_transfer->{"our_${_}"} = $bank_account->{$_};
165 $bank_transfer->{chart_id} = $bank_account->{chart_id};
168 my $id = SL::SEPA->create_export('employee' => $::myconfig{login},
169 'bank_transfers' => \@bank_transfers,
173 print $form->parse_html_template('sepa/bank_transfer_created', { 'id' => $id, 'vc' => $vc });
176 $main::lxdebug->leave_sub();
179 sub bank_transfer_search {
180 $main::lxdebug->enter_sub();
182 my $form = $main::form;
183 my $locale = $main::locale;
184 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
186 $form->{title} = $vc eq 'customer' ? $::locale->text('List of bank collections') : $locale->text('List of bank transfers');
189 print $form->parse_html_template('sepa/bank_transfer_search', { vc => $vc });
191 $main::lxdebug->leave_sub();
195 sub bank_transfer_list {
196 $main::lxdebug->enter_sub();
198 my $form = $main::form;
199 my $locale = $main::locale;
200 my $cgi = $::request->{cgi};
201 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
203 $form->{title} = $vc eq 'customer' ? $::locale->text('List of bank collections') : $locale->text('List of bank transfers');
205 $form->{sort} ||= 'id';
206 $form->{sortdir} = '1' if (!defined $form->{sortdir});
208 $form->{callback} = build_std_url('action=bank_transfer_list', 'sort', 'sortdir', 'vc');
210 my %filter = map +( $_ => $form->{"f_${_}"} ),
211 grep { $form->{"f_${_}"} }
213 map { ("${_}_date_from", "${_}_date_to") }
214 qw(export requested_execution execution));
215 $filter{executed} = $form->{l_executed} ? 1 : 0 if ($form->{l_executed} != $form->{l_not_executed});
216 $filter{closed} = $form->{l_closed} ? 1 : 0 if ($form->{l_open} != $form->{l_closed});
218 my $exports = SL::SEPA->list_exports('filter' => \%filter,
219 'sortorder' => $form->{sort},
220 'sortdir' => $form->{sortdir},
223 my $open_available = any { !$_->{closed} } @{ $exports };
225 my $report = SL::ReportGenerator->new(\%main::myconfig, $form);
227 my @hidden_vars = ('vc', grep { m/^[fl]_/ && $form->{$_} } keys %{ $form });
229 my $href = build_std_url('action=bank_transfer_list', @hidden_vars);
232 'selected' => { 'text' => $cgi->checkbox(-name => 'select_all', -id => 'select_all', -label => ''), },
233 'id' => { 'text' => $locale->text('Number'), },
234 'export_date' => { 'text' => $locale->text('Export date'), },
235 'employee' => { 'text' => $locale->text('Employee'), },
236 'executed' => { 'text' => $locale->text('Executed'), },
237 'closed' => { 'text' => $locale->text('Closed'), },
238 num_invoices => { 'text' => $locale->text('Number of invoices'), },
239 sum_amounts => { 'text' => $locale->text('Sum of all amounts'), },
242 my @columns = qw(selected id export_date employee executed closed invoices netamount);
243 my %column_alignment = map { ($_ => 'right') } qw(num_invoices sum_amounts);
245 foreach my $name (qw(id export_date employee executed closed)) {
246 my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
247 $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
250 $column_defs{selected}->{visible} = $open_available ? 'HTML' : 0;
251 $column_defs{executed}->{visible} = $form->{l_executed} && $form->{l_not_executed} ? 1 : 0;
252 $column_defs{closed}->{visible} = $form->{l_closed} && $form->{l_open} ? 1 : 0;
253 $column_defs{$_}->{align} = $column_alignment{$_} for keys %column_alignment;
256 push @options, ($vc eq 'customer' ? $::locale->text('Customer') : $locale->text('Vendor')) . ' : ' . $form->{f_vc} if ($form->{f_vc});
257 push @options, $locale->text('Invoice number') . ' : ' . $form->{f_invnumber} if ($form->{f_invnumber});
258 push @options, $locale->text('Export date from') . ' : ' . $form->{f_export_date_from} if ($form->{f_export_date_from});
259 push @options, $locale->text('Export date to') . ' : ' . $form->{f_export_date_to} if ($form->{f_export_date_to});
260 push @options, $locale->text('Requested execution date from') . ' : ' . $form->{f_requested_execution_date_from} if ($form->{f_requested_execution_date_from});
261 push @options, $locale->text('Requested execution date to') . ' : ' . $form->{f_requested_execution_date_to} if ($form->{f_requested_execution_date_to});
262 push @options, $locale->text('Execution date from') . ' : ' . $form->{f_execution_date_from} if ($form->{f_execution_date_from});
263 push @options, $locale->text('Execution date to') . ' : ' . $form->{f_execution_date_to} if ($form->{f_execution_date_to});
264 push @options, $form->{l_executed} ? $locale->text('executed') : $locale->text('not yet executed') if ($form->{l_executed} != $form->{l_not_executed});
265 push @options, $form->{l_closed} ? $locale->text('closed') : $locale->text('open') if ($form->{l_open} != $form->{l_closed});
267 $report->set_options('top_info_text' => join("\n", @options),
268 'raw_top_info_text' => $form->parse_html_template('sepa/bank_transfer_list_top'),
269 'raw_bottom_info_text' => $form->parse_html_template('sepa/bank_transfer_list_bottom', { 'show_buttons' => $open_available, vc => $vc }),
270 'std_column_visibility' => 1,
271 'output_format' => 'HTML',
272 'title' => $form->{title},
273 'attachment_basename' => $locale->text('banktransfers') . strftime('_%Y%m%d', localtime time),
275 $report->set_options_from_form();
276 $locale->set_numberformat_wo_thousands_separator(\%::myconfig) if lc($report->{options}->{output_format}) eq 'csv';
278 $report->set_columns(%column_defs);
279 $report->set_column_order(@columns);
280 $report->set_export_options('bank_transfer_list', @hidden_vars);
281 $report->set_sort_indicator($form->{sort}, $form->{sortdir});
283 my $edit_url = build_std_url('action=bank_transfer_edit', 'callback');
285 foreach my $export (@{ $exports }) {
286 my $row = { map { $_ => { 'data' => $export->{$_}, 'align' => $column_alignment{$_} } } keys %{ $export } };
288 map { $row->{$_}->{data} = $export->{$_} ? $locale->text('yes') : $locale->text('no') } qw(executed closed);
290 $row->{id}->{link} = $edit_url . '&id=' . E($export->{id}) . '&vc=' . E($vc);
292 $row->{$_}->{data} = $::form->format_amount(\%::myconfig, $row->{$_}->{data}, 2) for qw(sum_amounts);
294 if (!$export->{closed}) {
295 $row->{selected}->{raw_data} =
296 $cgi->hidden(-name => "exports[+].id", -value => $export->{id})
297 . $cgi->checkbox(-name => "exports[].selected", -value => 1, -label => '');
300 $report->add_data($row);
303 $report->generate_with_headers();
305 $main::lxdebug->leave_sub();
308 sub bank_transfer_edit {
309 $main::lxdebug->enter_sub();
311 my $form = $main::form;
312 my $locale = $main::locale;
313 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
316 if (!$form->{mode} || ($form->{mode} eq 'single')) {
317 push @ids, $form->{id};
319 @ids = map $_->{id}, grep { $_->{selected} } @{ $form->{exports} || [] };
322 $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
328 foreach my $id (@ids) {
329 my $curr_export = SL::SEPA->retrieve_export('id' => $id, 'details' => 1, 'vc' => $vc);
331 foreach my $item (@{ $curr_export->{items} }) {
332 map { $item->{"export_${_}"} = $curr_export->{$_} } grep { !ref $curr_export->{$_} } keys %{ $curr_export };
336 $export = $curr_export;
338 push @{ $export->{items} }, @{ $curr_export->{items} };
342 if ($form->{mode} && ($form->{mode} eq 'multi')) {
343 $export->{items} = [ grep { !$_->{export_closed} && !$_->{executed} } @{ $export->{items} } ];
345 if (!@{ $export->{items} }) {
346 $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1);
350 $form->error($locale->text('That export does not exist.'));
353 $form->{title} = $locale->text('View SEPA export');
355 print $form->parse_html_template('sepa/bank_transfer_edit',
358 'current_date' => $form->current_date(\%main::myconfig),
359 'show_post_payments_button' => any { !$_->{export_closed} && !$_->{executed} } @{ $export->{items} },
362 $main::lxdebug->leave_sub();
365 sub bank_transfer_post_payments {
366 $main::lxdebug->enter_sub();
368 my $form = $main::form;
369 my $locale = $main::locale;
370 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
372 my @items = grep { $_->{selected} } @{ $form->{items} || [] };
375 $form->show_generic_error($locale->text('You have not selected any item.'), 'back_button' => 1);
377 my @export_ids = uniq map { $_->{sepa_export_id} } @items;
378 my %exports = map { $_ => SL::SEPA->retrieve_export('id' => $_, 'details' => 1, vc => $vc) } @export_ids;
379 my @items_to_post = ();
381 foreach my $item (@items) {
382 my $export = $exports{ $item->{sepa_export_id} };
383 next if (!$export || $export->{closed} || $export->{executed});
385 push @items_to_post, $item if (none { ($_->{id} == $item->{id}) && $_->{executed} } @{ $export->{items} });
388 if (!@items_to_post) {
389 $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1);
392 if (any { !$_->{execution_date} } @items_to_post) {
393 $form->show_generic_error($locale->text('You have to specify an execution date for each antry.'), 'back_button' => 1);
396 SL::SEPA->post_payment('items' => \@items_to_post, vc => $vc);
398 $form->show_generic_information($locale->text('The payments have been posted.'));
400 $main::lxdebug->leave_sub();
403 sub bank_transfer_payment_list_as_pdf {
404 $main::lxdebug->enter_sub();
406 my $form = $main::form;
407 my %myconfig = %main::myconfig;
408 my $locale = $main::locale;
409 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
411 my @ids = @{ $form->{items} || [] };
412 my @export_ids = uniq map { $_->{export_id} } @ids;
414 $form->show_generic_error($locale->text('Multi mode not supported.'), 'back_button' => 1) if 1 != scalar @export_ids;
416 my $export = SL::SEPA->retrieve_export('id' => $export_ids[0], 'details' => 1, vc => $vc);
419 foreach my $id (@ids) {
420 my $item = first { $_->{id} == $id->{id} } @{ $export->{items} };
421 push @items, $item if $item;
424 $form->show_generic_error($locale->text('No transfers were executed in this export.'), 'back_button' => 1) if 1 > scalar @items;
426 my $report = SL::ReportGenerator->new(\%main::myconfig, $form);
429 'invnumber' => { 'text' => $locale->text('Invoice'), },
430 'vc_name' => { 'text' => $vc eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
431 'our_iban' => { 'text' => $vc eq 'customer' ? $locale->text('Destination IBAN') : $locale->text('Source IBAN'), },
432 'our_bic' => { 'text' => $vc eq 'customer' ? $locale->text('Destination BIC') : $locale->text('Source BIC'), },
433 'vc_iban' => { 'text' => $vc eq 'customer' ? $locale->text('Source IBAN') : $locale->text('Destination IBAN'), },
434 'vc_bic' => { 'text' => $vc eq 'customer' ? $locale->text('Source BIC') : $locale->text('Destination BIC'), },
435 'amount' => { 'text' => $locale->text('Amount'), },
436 'reference' => { 'text' => $locale->text('Reference'), },
437 'execution_date' => { 'text' => $locale->text('Execution date'), },
440 map { $column_defs{$_}->{align} = 'right' } qw(amount execution_date);
442 my @columns = qw(invnumber vc_name our_iban our_bic vc_iban vc_bic amount reference execution_date);
444 $report->set_options('std_column_visibility' => 1,
445 'output_format' => 'PDF',
446 'title' => $vc eq 'customer' ? $locale->text('Bank collection payment list for export #1', $export->{id}) : $locale->text('Bank transfer payment list for export #1', $export->{id}),
447 'attachment_basename' => ($vc eq 'customer' ? $locale->text('bank_collection_payment_list_#1', $export->{id}) : $locale->text('bank_transfer_payment_list_#1', $export->{id})) . strftime('_%Y%m%d', localtime time),
450 $report->set_columns(%column_defs);
451 $report->set_column_order(@columns);
453 foreach my $item (@items) {
454 my $row = { map { $_ => { 'data' => $item->{$_} } } @columns };
455 $row->{amount}->{data} = $form->format_amount(\%myconfig, $item->{amount}, 2);
457 $report->add_data($row);
460 $report->generate_with_headers();
462 $main::lxdebug->leave_sub();
466 sub bank_transfer_download_sepa_xml {
467 $main::lxdebug->enter_sub();
469 my $form = $main::form;
470 my $myconfig = \%main::myconfig;
471 my $locale = $main::locale;
472 my $cgi = $::request->{cgi};
473 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
474 my $defaults = SL::DB::Default->get;
476 if (!$defaults->company) {
477 $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.'), 'back_button' => 1);
480 if (($vc eq 'customer') && !$defaults->sepa_creditor_id) {
481 $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.'), 'back_button' => 1);
485 if ($form->{mode} && ($form->{mode} eq 'multi')) {
486 @ids = map $_->{id}, grep { $_->{selected} } @{ $form->{exports} || [] };
489 @ids = ($form->{id});
493 $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
498 foreach my $id (@ids) {
499 my $export = SL::SEPA->retrieve_export('id' => $id, 'details' => 1, vc => $vc);
500 push @items, grep { !$_->{executed} } @{ $export->{items} } if ($export && !$export->{closed});
504 $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1);
507 my $message_id = strftime('MSG%Y%m%d%H%M%S', localtime) . sprintf('%06d', $$);
509 my $sepa_xml = SL::SEPA::XML->new('company' => $defaults->company,
510 'creditor_id' => $defaults->sepa_creditor_id,
511 'src_charset' => 'UTF-8',
512 'message_id' => $message_id,
514 'collection' => $vc eq 'customer',
517 foreach my $item (@items) {
518 my $requested_execution_date;
520 if ($item->{requested_execution_date}) {
521 my ($yy, $mm, $dd) = $locale->parse_date($myconfig, $item->{requested_execution_date});
522 $requested_execution_date = sprintf '%04d-%02d-%02d', $yy, $mm, $dd;
525 if ($vc eq 'customer') {
526 my ($yy, $mm, $dd) = $locale->parse_date($myconfig, $item->{reference_date});
527 $item->{reference_date} = sprintf '%04d-%02d-%02d', $yy, $mm, $dd;
528 $mandator_id = $item->{mandator_id};
529 if ($item->{mandate_date_of_signature}) {
530 ($yy, $mm, $dd) = $locale->parse_date($myconfig, $item->{mandate_date_of_signature});
531 $item->{mandate_date_of_signature} = sprintf '%04d-%02d-%02d', $yy, $mm, $dd;
535 $sepa_xml->add_transaction({ 'src_iban' => $item->{our_iban},
536 'src_bic' => $item->{our_bic},
537 'dst_iban' => $item->{vc_iban},
538 'dst_bic' => $item->{vc_bic},
539 'company' => $item->{vc_name},
540 'company_number' => $item->{vc_number},
541 'amount' => $item->{amount},
542 'reference' => $item->{reference},
543 'mandator_id' => $mandator_id,
544 'reference_date' => $item->{reference_date},
545 'execution_date' => $requested_execution_date,
546 'end_to_end_id' => $item->{end_to_end_id},
547 'date_of_signature' => $item->{mandate_date_of_signature}, });
550 # Store the message ID used in each of the entries in order to
551 # facilitate finding them by looking at bank statements.
552 foreach my $id (@ids) {
553 SL::DB::SepaExportMessageId->new(
554 sepa_export_id => $id,
555 message_id => $message_id,
559 my $xml = $sepa_xml->to_xml();
561 print $cgi->header('-type' => 'application/octet-stream',
562 '-content-disposition' => 'attachment; filename="SEPA_' . $message_id . ($vc eq 'customer' ? '.cdd' : '.cct') . '"',
563 '-content-length' => length $xml);
566 $main::lxdebug->leave_sub();
569 sub bank_transfer_mark_as_closed_step1 {
570 $main::lxdebug->enter_sub();
572 my $form = $main::form;
573 my $locale = $main::locale;
574 my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
576 my @export_ids = map { $_->{id} } grep { $_->{selected} } @{ $form->{exports} || [] };
579 $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
582 my @open_export_ids = ();
583 foreach my $id (@export_ids) {
584 my $export = SL::SEPA->retrieve_export('id' => $id, vc => $vc);
585 push @open_export_ids, $id if (!$export->{closed});
588 if (!@open_export_ids) {
589 $form->show_generic_error($locale->text('All of the exports you have selected were already closed.'), 'back_button' => 1);
592 $form->{title} = $locale->text('Close SEPA exports');
594 print $form->parse_html_template('sepa/bank_transfer_mark_as_closed_step1', { 'OPEN_EXPORT_IDS' => \@open_export_ids, vc => $vc });
596 $main::lxdebug->leave_sub();
599 sub bank_transfer_mark_as_closed_step2 {
600 $main::lxdebug->enter_sub();
602 my $form = $main::form;
603 my $locale = $main::locale;
605 map { SL::SEPA->close_export('id' => $_); } @{ $form->{open_export_ids} || [] };
607 $form->{title} = $locale->text('Close SEPA exports');
609 $form->show_generic_information($locale->text('The selected exports have been closed.'));
611 $main::lxdebug->leave_sub();
615 my $form = $main::form;
617 foreach my $action (qw(bank_transfer_create bank_transfer_edit bank_transfer_list
618 bank_transfer_post_payments bank_transfer_download_sepa_xml
619 bank_transfer_mark_as_closed_step1 bank_transfer_mark_as_closed_step2
620 bank_transfer_payment_list_as_pdf)) {
621 if ($form->{"action_${action}"}) {
627 $form->error($main::locale->text('No action defined.'));