use SL::DB;
use SL::Locale::String qw(t8);
use DateTime;
+use Carp;
sub retrieve_open_invoices {
$main::lxdebug->enter_sub();
$main::lxdebug->leave_sub();
}
+sub undo_export {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ Common::check_params(\%params, qw(id));
+
+ my $sepa_export = SL::DB::Manager::SepaExport->find_by(id => $params{id});
+
+ croak "Not a valid SEPA Export id: $params{id}" unless $sepa_export;
+ croak "Cannot undo closed exports." if $sepa_export->closed;
+ croak "Cannot undo executed exports." if $sepa_export->executed;
+
+ die "Could not undo $sepa_export->id" if !$sepa_export->delete();
+
+ $main::lxdebug->leave_sub();
+}
+
sub list_exports {
$main::lxdebug->enter_sub();
}
1;
+
+
+__END__
+
+=head1 NAME
+
+SL::SEPA - Base class for SEPA objects
+
+=head1 SYNOPSIS
+
+ # get all open invoices we like to pay via SEPA
+ my $invoices = SL::SEPA->retrieve_open_invoices(vc => 'vendor');
+
+ # add some IBAN and purposes for open transaction
+ # and assign this to a SEPA export
+ my $id = SL::SEPA->create_export('employee' => $::myconfig{login},
+ 'bank_transfers' => \@bank_transfers,
+ 'vc' => 'vendor');
+
+=head1 DESCRIPTIONS
+
+This is the base class for SEPA. SEPA and the underlying directories
+(SEPA::XML etc) are used to genereate valid XML files for the SEPA
+(Single European Payment Area) specification and offers this structure
+as a download via a xml file.
+
+An export can have one or more transaction which have to
+comply to the specification (IBAN, BIC, amount, purpose, etc).
+
+Furthermore kivitendo sepa exports have two
+valid states: Open or closed and executed or not executed.
+
+The state closed can be set via a user interface and the
+state executed is automatically assigned if the action payment
+is triggered.
+
+=head1 FUNCTIONS
+
+=head2 C<undo_export> $sepa_export_id
+
+Needs a valid sepa_export id and deletes the sepa export if
+the state of the export is neither executed nor closed.
+Returns undef if the deletion was successfully.
+Otherwise the function just dies with a short notice of the id.
+
+=cut
+
+
+
+
$main::lxdebug->leave_sub();
}
+sub bank_transfer_undo_sepa_xml {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ map { SL::SEPA->undo_export('id' => $_); } @{ $form->{ids} || [] };
+
+ $form->{title} = $locale->text('Undo SEPA exports');
+ $form->header();
+ $form->show_generic_information($locale->text('The selected exports have been undone.'));
+
+ $main::lxdebug->leave_sub();
+}
+
sub dispatcher {
my $form = $main::form;
foreach my $action (qw(bank_transfer_create bank_transfer_edit bank_transfer_list
bank_transfer_post_payments bank_transfer_download_sepa_xml
bank_transfer_mark_as_closed_step1 bank_transfer_mark_as_closed_step2
- bank_transfer_payment_list_as_pdf)) {
+ bank_transfer_payment_list_as_pdf bank_transfer_undo_sepa_xml)) {
if ($form->{"action_${action}"}) {
call_sub($action);
return;
confirm => [ $params{is_vendor} ? t8('Do you really want to close the selected SEPA exports? No payment will be recorded for bank transfers that haven\'t been marked as executed yet.')
: t8('Do you really want to close the selected SEPA exports? No payment will be recorded for bank collections that haven\'t been marked as executed yet.') ],
],
+ action => [
+ t8('Undo SEPA exports'),
+ submit => [ '#form', { action => 'bank_transfer_undo_sepa_xml' } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name="ids[]"]' ] ],
+ confirm => [ t8('Do you really want to undo the selected SEPA exports? You have to reassign the export again.') ],
+ ],
], # end of combobox "Actions"
);
}
'Do you really want to delete this record template?' => 'Wollen Sie diese Belegvorlage wirklich löschen?',
'Do you really want to revert to this version?' => 'Wollen Sie wirklich auf diese Version zurücksetzen?',
'Do you really want to save?' => 'Wollen Sie wirklich speichern?',
+ 'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => 'Möchten Sie wirklich die ausgewählten SEPA-Exports rückgängig machen? Der Export muss anschließend neu erzeugt werden.',
'Do you really want to unimport the selected documents?' => 'Wollen Sie wirklich diese Dateien an die Quelle zurückgeben?',
'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?',
'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => 'Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?',
'The selected currency' => 'Die ausgewählte Währung',
'The selected database is still configured for client "#1". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?' => 'Die auswählte Datenbank ist noch für Mandant "#1" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?',
'The selected exports have been closed.' => 'Die ausgewählten Exporte wurden abgeschlossen.',
+ 'The selected exports have been undone.' => 'Die ausgwählten Exporte wurden rückgängig gemacht.',
'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.',
'The selected warehouse is empty, or no stocked items where found that match the filter settings.' => 'Das ausgewählte Lager ist leer, oder in ihm wurden keine zu den Sucheinstellungen passenden eingelagerten Artikel gefunden.',
'The session has expired. Please log in again.' => 'Die Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.',
'UStVa Einstellungen' => 'UStVa Einstellungen',
'Unbalanced Ledger' => 'Bilanzfehler',
'Unchecked custom variables will not appear in orders and invoices.' => 'Unmarkierte Variablen werden für diesen Artikel nicht in Aufträgen und Rechnungen angezeigt.',
+ 'Undo SEPA exports' => 'SEPA-Exporte rückgängig machen',
'Unfinished follow-ups' => 'Nicht erledigte Wiedervorlagen',
'Unfortunately you have no warehouse defined.' => 'Leider, gibt es kein Lager in diesem Mandanten.',
'Unimport all' => 'Alle zurück zur Quelle',