X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FBuchungsgruppen.pm;h=a608a6eab80ac814514d1d42e7047e8d93ef03c9;hb=ff159a4d47b9a2d10744dcfc23da2c63605c8a32;hp=4776bd6406f33796889a07151471377ee84e7ece;hpb=96670fe82a38116ac10592a6ccbd34800f8ad9f8;p=kivitendo-erp.git diff --git a/SL/Controller/Buchungsgruppen.pm b/SL/Controller/Buchungsgruppen.pm index 4776bd640..a608a6eab 100644 --- a/SL/Controller/Buchungsgruppen.pm +++ b/SL/Controller/Buchungsgruppen.pm @@ -33,6 +33,7 @@ sub action_list { $chartlist{ $gruppe->id } = SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($gruppe->id); } + $self->setup_list_action_bar; $::form->header; $self->render('buchungsgruppen/list', title => t8('Booking groups'), @@ -51,6 +52,7 @@ sub action_new { sub show_form { my ($self, %params) = @_; + $self->setup_show_form_action_bar; $self->render('buchungsgruppen/form', %params, TAXZONES => SL::DB::Manager::TaxZone->get_all_sorted()); } @@ -188,4 +190,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 => 'Buchungsgruppen/' . ($is_new ? 'create' : 'update') } ], + checks => [ 'kivi.validate_form' ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'Buchungsgruppen/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;