X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FTaxzones.pm;h=72c772fd6915ed2a11e4a6e2364c980e644018a1;hb=9dfd320ff258071e3ad78dd6cf2d76e215efd4f7;hp=1594b9b37376843a48e1e479821c0f8b989eb6da;hpb=96670fe82a38116ac10592a6ccbd34800f8ad9f8;p=kivitendo-erp.git diff --git a/SL/Controller/Taxzones.pm b/SL/Controller/Taxzones.pm index 1594b9b37..72c772fd6 100644 --- a/SL/Controller/Taxzones.pm +++ b/SL/Controller/Taxzones.pm @@ -27,6 +27,7 @@ sub action_list { my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); + $self->setup_list_action_bar; $self->render('taxzones/list', title => t8('List of tax zones'), TAXZONES => $taxzones); @@ -42,6 +43,7 @@ sub action_new { sub show_form { my ($self, %params) = @_; + $self->setup_show_form_action_bar; $self->render('taxzones/form', %params, BUCHUNGSGRUPPEN => SL::DB::Manager::Buchungsgruppe->get_all_sorted); } @@ -179,4 +181,53 @@ sub create_or_update { sub init_defaults { SL::DB::Default->get }; +# +# helpers +# + +sub setup_show_form_action_bar { + my ($self) = @_; + + my $is_new = !$self->config->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'Taxzones/' . ($is_new ? 'create' : 'update') } ], + checks => [ 'kivi.validate_form' ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'Taxzones/delete' } ], + confirm => t8('Do you really want to delete this object?'), + disabled => $is_new ? t8('This object has not been saved yet.') + : !$self->config->orphaned ? t8('The object is in use and cannot be deleted.') + : undef, + ], + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list'), + ], + ); + } + $::request->layout->add_javascripts('kivi.Validator.js'); +} + +sub setup_list_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + link => [ + t8('Add'), + link => $self->url_for(action => 'new'), + ], + ); + } +} + 1;