X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdn.pl;h=c16f6c34c27464b94dea1f931d65422686cf1cf8;hb=e070b6383cd90405970527fdb90f08fb1d96ba6d;hp=ca08da4981844e52e53e77df29201eb41f06ce42;hpb=19fb04d1cfad224a0f0c4c3b88494b4605fc6d4e;p=kivitendo-erp.git diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index ca08da498..c16f6c34c 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -36,6 +36,7 @@ use POSIX qw(strftime); use SL::IS; use SL::DN; +use SL::DB::Department; use SL::DB::Dunning; use SL::Helper::Flash qw(flash); use SL::Locale::String qw(t8); @@ -83,6 +84,8 @@ sub edit_config { $form->{title} = $locale->text('Edit Dunning Process Config'); $form->{callback} ||= build_std_url("action=edit_config"); + setup_dn_edit_config_action_bar(); + $form->header(); print $form->parse_html_template("dunning/edit_config"); @@ -98,16 +101,14 @@ sub add { $main::auth->assert('dunning_edit'); - # setup customer selection - $form->all_vc(\%myconfig, "customer", "AR"); - DN->get_config(\%myconfig, \%$form); - $form->{SHOW_CUSTOMER_SELECTION} = $form->{all_customer} && scalar @{ $form->{all_customer} }; $form->{SHOW_DUNNING_LEVEL_SELECTION} = $form->{DUNNING} && scalar @{ $form->{DUNNING} }; $form->{SHOW_DEPARTMENT_SELECTION} = $form->{all_departments} && scalar @{ $form->{all_departments} || [] }; $form->{title} = $locale->text('Start Dunning Process'); + + setup_dn_add_action_bar(); $form->header(); print $form->parse_html_template("dunning/add"); @@ -153,6 +154,7 @@ sub show_invoices { 'no_html' => 1, 'no_opendocument' => 1,); + setup_dn_show_invoices_action_bar(); $form->header(); print $form->parse_html_template("dunning/show_invoices"); @@ -305,12 +307,11 @@ sub search { DN->get_config(\%myconfig, \%$form); - $form->{SHOW_CUSTOMER_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} } <= $myconfig{vclimit}; - $form->{SHOW_DEPARTMENT_DDBOX} = scalar @{ $form->{ALL_CUSTOMERS} }; $form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} }; $form->{title} = $locale->text('Dunnings'); + setup_dn_search_action_bar(); $form->header(); print $form->parse_html_template("dunning/search"); @@ -453,6 +454,7 @@ sub show_dunning { $report->set_options_from_form(); + setup_dn_show_dunning_action_bar(); $report->generate_with_headers(); $main::lxdebug->leave_sub(); @@ -562,4 +564,85 @@ sub dispatcher { $::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', + ], + ); + } +} + # end of main