-
- |
- . $locale->text('Enforce transaction reversal for all dates') . qq|
- | |
- . $locale->text('Yes')
- . qq| |
- . $locale->text('No')
- . qq| |
-
| . $locale->text('Close Books up to') . qq| |
{closedto}> |
@@ -2825,19 +2602,16 @@ sub audit_control {
sub doclose {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
AM->closebooks(\%myconfig, \%$form);
- if ($form->{revtrans}) {
+ if ($form->{closedto}) {
$form->redirect(
- $locale->text('Transaction reversal enforced for all dates'));
+ $locale->text('Books closed up to') . " "
+ . $locale->date(\%myconfig, $form->{closedto}, 1));
} else {
- if ($form->{closedto}) {
- $form->redirect(
- $locale->text('Transaction reversal enforced up to') . " "
- . $locale->date(\%myconfig, $form->{closedto}, 1));
- } else {
- $form->redirect($locale->text('Books are open'));
- }
+ $form->redirect($locale->text('Books are open'));
}
$lxdebug->leave_sub();
@@ -2846,7 +2620,9 @@ sub doclose {
sub edit_units {
$lxdebug->enter_sub();
- $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
+ $auth->assert('config');
+
+ $units = AM->retrieve_units(\%myconfig, $form, "resolved_");
AM->units_in_use(\%myconfig, $form, $units);
map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
@@ -2870,18 +2646,18 @@ sub edit_units {
$i++;
}
- $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
+ $units = AM->retrieve_units(\%myconfig, $form);
$ddbox = AM->unit_select_data($units, undef, 1);
- my $updownlink = build_std_url("action=swap_units", "unit_type");
+ my $updownlink = build_std_url("action=swap_units");
- $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
+ $form->{"title"} = $locale->text("Add and edit units");
$form->header();
print($form->parse_html_template("am/edit_units",
- { "UNITS" => \@unit_list,
+ { "UNITS" => \@unit_list,
"NEW_BASE_UNIT_DDBOX" => $ddbox,
- "LANGUAGES" => \@languages,
- "updownlink" => $updownlink }));
+ "LANGUAGES" => \@languages,
+ "updownlink" => $updownlink }));
$lxdebug->leave_sub();
}
@@ -2889,8 +2665,10 @@ sub edit_units {
sub add_unit {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->isblank("new_name", $locale->text("The name is missing."));
- $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
+ $units = AM->retrieve_units(\%myconfig, $form);
$all_units = AM->retrieve_units(\%myconfig, $form);
$form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
@@ -2913,7 +2691,7 @@ sub add_unit {
});
}
- AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, $form->{"unit_type"}, \@languages);
+ AM->add_unit(\%myconfig, $form, $form->{"new_name"}, $base_unit, $factor, \@languages);
$form->{"saved_message"} = $locale->text("The unit has been saved.");
@@ -2925,6 +2703,8 @@ sub add_unit {
sub set_unit_languages {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
my ($unit, $languages, $idx) = @_;
$unit->{"LANGUAGES"} = [];
@@ -2943,7 +2723,9 @@ sub set_unit_languages {
sub save_unit {
$lxdebug->enter_sub();
- $old_units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"}, "resolved_");
+ $auth->assert('config');
+
+ $old_units = AM->retrieve_units(\%myconfig, $form, "resolved_");
AM->units_in_use(\%myconfig, $form, $old_units);
@languages = AM->language(\%myconfig, $form, 1);
@@ -3009,7 +2791,7 @@ sub save_unit {
}
}
- AM->save_units(\%myconfig, $form, $form->{"unit_type"}, $new_units, \@delete_units);
+ AM->save_units(\%myconfig, $form, $new_units, \@delete_units);
$form->{"saved_message"} = $locale->text("The units have been saved.");
@@ -3021,16 +2803,21 @@ sub save_unit {
sub show_history_search {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = $locale->text("History Search");
$form->header();
- print $form->parse_html_template("/common/search_history");
+ print $form->parse_html_template("common/search_history");
$lxdebug->leave_sub();
}
sub show_am_history {
$lxdebug->enter_sub();
+
+ $auth->assert('config');
+
my %search = ( "Artikelnummer" => "parts",
"Kundennummer" => "customer",
"Lieferantennummer" => "vendor",
@@ -3103,7 +2890,7 @@ sub show_am_history {
my ($sort, $sortby) = split(/\-\-/, $form->{order});
$sort =~ s/.*\.(.*)$/$1/;
- print $form->parse_html_template("/common/show_history",
+ print $form->parse_html_template("common/show_history",
{"DATEN" => $form->get_history($dbh, $daten, $restriction, $form->{order}),
"SUCCESS" => ($form->get_history($dbh, $daten, $restriction, $form->{order}) ne "0"),
"NONEWWINDOW" => 1,
@@ -3116,6 +2903,9 @@ sub show_am_history {
sub get_employee_id {
$lxdebug->enter_sub();
+
+ $auth->assert('config');
+
my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|;
my $sth = $_[1]->prepare($query);
$sth->execute() || $form->dberror($query);
@@ -3128,10 +2918,10 @@ sub get_employee_id {
sub swap_units {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
my $dir = $form->{"dir"} eq "down" ? "down" : "up";
- my $unit_type = $form->{"unit_type"} eq "dimension" ?
- "dimension" : "service";
- AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
+ AM->swap_units(\%myconfig, $form, $dir, $form->{"name"});
edit_units();
@@ -3141,11 +2931,11 @@ sub swap_units {
sub add_tax {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = $locale->text('Add');
- $form->{callback} =
- "$form->{script}?action=add_tax&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
+ $form->{callback} ||= "am.pl?action=add_tax";
_get_taxaccount_selection();
@@ -3164,6 +2954,8 @@ sub add_tax {
sub edit_tax {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = $locale->text('Edit');
AM->get_tax(\%myconfig, \%$form);
@@ -3185,6 +2977,8 @@ sub edit_tax {
sub list_tax {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
AM->taxes(\%myconfig, \%$form);
map { $_->{rate} = $form->format_amount(\%myconfig, $_->{rate}, 2) } @{ $form->{TAX} };
@@ -3202,27 +2996,13 @@ sub list_tax {
}
sub _get_taxaccount_selection{
- $lxdebug->enter_sub();
+ $lxdebug->enter_sub();
- AM->get_tax_accounts(\%myconfig, \%$form);
+ $auth->assert('config');
- my $i = 0;
- foreach my $taxaccount (@{ $form->{ACCOUNTS} } ) {
+ AM->get_tax_accounts(\%myconfig, \%$form);
- # Fill in the Taxaxxounts as select options
- if ($form->{chart_id} == $taxaccount->{id}) {
- $form->{ACCOUNTS}[$i]{select_taxaccount} .=
- qq| |