From c7fff13f52ed343b751c7ceec575ba584b88e4bd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 31 Jan 2017 15:39:10 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20=C2=BBSteuern?= =?utf8?q?=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/am.pl | 45 +++++++++++++++++++++++++---- templates/webpages/am/edit_tax.html | 10 +------ templates/webpages/am/list_tax.html | 4 --- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index a62fa15f6..30c78703f 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1110,10 +1110,10 @@ sub add_tax { $form->{expense} = 1; $form->{costs} = 1; + setup_am_edit_tax_action_bar(); $form->header(); my $parameters_ref = { -# ChartTypeIsAccount => $ChartTypeIsAccount, LANGUAGES => SL::DB::Manager::Language->get_all_sorted, }; @@ -1147,6 +1147,7 @@ sub edit_tax { $form->{rate} = $form->format_amount(\%myconfig, $form->{rate}, 2); + setup_am_edit_tax_action_bar(); $form->header(); my $parameters_ref = { @@ -1177,13 +1178,11 @@ sub list_tax { $form->{title} = $locale->text('Tax-O-Matic'); + setup_am_list_tax_action_bar(); $form->header(); - my $parameters_ref = { - }; - # Ausgabe des Templates - print($form->parse_html_template('am/list_tax', $parameters_ref)); + print($form->parse_html_template('am/list_tax')); $main::lxdebug->leave_sub(); } @@ -1428,3 +1427,39 @@ sub setup_am_edit_account_action_bar { ); } } + +sub setup_am_list_tax_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + link => [ + t8('Add'), + link => 'am.pl?action=add_tax', + ], + ); + } +} + +sub setup_am_edit_tax_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => "save_tax" } ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => "delete_tax" } ], + disabled => !$::form->{id} ? t8('The object has not been saved yet.') + : !$::form->{orphaned} || $::form->{tax_already_used} ? t8('The object is in use and cannot be deleted.') + : undef, + confirm => t8('Do you really want to delete this object?'), + ], + ); + } +} diff --git a/templates/webpages/am/edit_tax.html b/templates/webpages/am/edit_tax.html index 46c45d84a..616ac2d8f 100644 --- a/templates/webpages/am/edit_tax.html +++ b/templates/webpages/am/edit_tax.html @@ -4,7 +4,7 @@ [%- USE LxERP %]

[% 'Tax-O-Matic' | $T8 %] [% title %]

-
+ @@ -129,12 +129,4 @@ [% END %] - - - - [% IF orphaned AND NOT tax_already_used %] - - [% END %] -
- diff --git a/templates/webpages/am/list_tax.html b/templates/webpages/am/list_tax.html index 836cca355..4b8ed2d47 100644 --- a/templates/webpages/am/list_tax.html +++ b/templates/webpages/am/list_tax.html @@ -25,7 +25,3 @@ [% END %] - -

- [%- 'Add' | $T8 %] -

-- 2.20.1