$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,
};
$form->{rate} = $form->format_amount(\%myconfig, $form->{rate}, 2);
+ setup_am_edit_tax_action_bar();
$form->header();
my $parameters_ref = {
$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();
}
);
}
}
+
+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?'),
+ ],
+ );
+ }
+}
[%- USE LxERP %]
<h1>[% 'Tax-O-Matic' | $T8 %] [% title %]</h1>
- <form method="post" action="am.pl">
+ <form method="post" action="am.pl" id="form">
<input type="hidden" name="id" value="[% HTML.escape(id) %]">
<input type="hidden" name="type" value="tax">
[% END %]
<input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
-
- <input type="submit" class="submit" name="action" value="[% 'Save' | $T8 %]">
-
- [% IF orphaned AND NOT tax_already_used %]
- <input type="submit" class="submit" name="action" value="[% 'Delete' | $T8 %]">
- [% END %]
-
</form>
-