+sub dispatcher {
+ foreach my $action (qw(delete print_multiple)) {
+ if ($::form->{"action_${action}"}) {
+ call_sub($action);
+ return;
+ }
+ }
+
+ $::form->error($::locale->text('No action defined.'));
+}
+
+sub setup_dn_add_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Search'),
+ submit => [ '#form', { action => "show_invoices" } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_dn_show_invoices_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Create'),
+ submit => [ '#form', { action => "save_dunning" } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=active_]' ] ],
+ accesskey => 'enter',
+ only_once => 1,
+ ],
+ );
+ }
+}
+
+sub setup_dn_search_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Search'),
+ submit => [ '#form', { action => "show_dunning" } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_dn_show_dunning_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Print'),
+ submit => [ '#form', { action => "print_multiple" } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=selected_]' ] ],
+ accesskey => 'enter',
+ ],
+
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => "delete" } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=selected_]' ] ],
+ confirm => $::locale->text('This resets the dunning process for the selected invoices. Posted dunning invoices will not be changed!'),
+ ],
+ );
+ }
+}
+
+sub setup_dn_edit_config_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => "save" } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_dn_status_action_bar {
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Back'),
+ link => $::form->{callback},
+ accesskey => 'enter',
+ ],
+ );
+ }
+
+}
+