From a8459f498a58bdabcd87bcdf1cd08e9f5726abe4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 17 Jan 2017 11:16:31 +0100 Subject: [PATCH] Form->show_generic_error: Parameter action, back_button entfernt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Der Funktion kann man eine spezifische Action mitgeben, damit ein Button mit der Action anstelle des normalen Zurück-Buttons angezeigt wird. Es gibt allerdings (schon lange?) keinen einzigen Aufruf mehr, der dieses Feature »Action übergeben« nutzt. Daher wird es hiermit entfernt. Im Umkehrschluss gibt es keine Situation, wo der Zurück-Button nicht angezeigt werden soll. Daher wird auch dieser Parameter entfernt. --- SL/Form.pm | 14 -------------- bin/mozilla/do.pl | 10 +++++----- bin/mozilla/ic.pl | 2 +- bin/mozilla/oe.pl | 2 +- bin/mozilla/sepa.pl | 26 ++++++++++++------------- bin/mozilla/wh.pl | 10 +++++----- templates/webpages/generic/error.html | 28 --------------------------- 7 files changed, 25 insertions(+), 67 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 00880f1b2..f737a58dd 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -681,20 +681,6 @@ sub show_generic_error { 'label_error' => $error, }; - if ($params{action}) { - my @vars; - - map { delete($self->{$_}); } qw(action); - map { push @vars, { "name" => $_, "value" => $self->{$_} } if (!ref($self->{$_})); } keys %{ $self }; - - $add_params->{SHOW_BUTTON} = 1; - $add_params->{BUTTON_LABEL} = $params{label} || $params{action}; - $add_params->{VARIABLES} = \@vars; - - } elsif ($params{back_button}) { - $add_params->{SHOW_BACK_BUTTON} = 1; - } - $self->{title} = $params{title} if $params{title}; $self->header(); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 8654a9972..f69da647b 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -914,7 +914,7 @@ sub invoice_multi { my @do_ids = map { $form->{"trans_id_$_"} } grep { $form->{"multi_id_$_"} } (1..$form->{rowcount}); if (!scalar @do_ids) { - $form->show_generic_error($locale->text('You have not selected any delivery order.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have not selected any delivery order.')); } map { delete $form->{$_} } grep { m/^(?:trans|multi)_id_\d+/ } keys %{ $form }; @@ -1357,7 +1357,7 @@ sub transfer_in { my $locale = $main::locale; if ($form->{id} && DO->is_marked_as_delivered(id => $form->{id})) { - $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.'), 'back_button' => 1); + $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.')); } save(no_redirect => 1); @@ -1427,7 +1427,7 @@ sub transfer_out { my $locale = $main::locale; if ($form->{id} && DO->is_marked_as_delivered(id => $form->{id})) { - $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.'), 'back_button' => 1); + $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.')); } save(no_redirect => 1); @@ -1653,7 +1653,7 @@ sub transfer_in_out_default { my $base_unit_factor = $units->{ $part_info_map{$form->{"id_$i"}}->{unit} }->{factor} || 1; my $qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor; - $form->show_generic_error($locale->text("Cannot transfer negative entries." ), 'back_button' => 1) if ($qty < 0); + $form->show_generic_error($locale->text("Cannot transfer negative entries." )) if ($qty < 0); # if we do not want to transfer services and this part is a service, set qty to zero # ... and do not create a hash entry in %qty_parts below (will skip check for bins for the transfer == out case) # ... and push only a empty (undef) element to @all_requests (will skip check for bin_id and warehouse_id and will not alter the row) @@ -1740,7 +1740,7 @@ sub transfer_in_out_default { } } else { #$main::lxdebug->message(0, 'Fehlertext: ' . $fehlertext); - $form->show_generic_error($locale->text("Cannot transfer.
Reason:
#1", $fehlertext ), 'back_button' => 1); + $form->show_generic_error($locale->text("Cannot transfer.
Reason:
#1", $fehlertext )); } } } diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 4a21d0244..d67409398 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -153,7 +153,7 @@ sub confirm_price_update { $form->header(); if (@errors) { - $form->show_generic_error(join('
', @errors), 'back_button' => 1); + $form->show_generic_error(join('
', @errors)); } $form->{nextsub} = "update_prices"; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 5e6f81020..a38f04baa 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -770,7 +770,7 @@ sub search { $form->{ordlabel} = $locale->text('Quotation Number'); } else { - $form->show_generic_error($locale->text('oe.pl::search called with unknown type'), back_button => 1); + $form->show_generic_error($locale->text('oe.pl::search called with unknown type')); } # setup vendor / customer data diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index 0f5a242a8..78b5eea6e 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -329,7 +329,7 @@ sub bank_transfer_edit { @ids = map $_->{id}, grep { $_->{selected} } @{ $form->{exports} || [] }; if (!@ids) { - $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have not selected any export.')); } } @@ -353,7 +353,7 @@ sub bank_transfer_edit { $export->{items} = [ grep { !$_->{export_closed} && !$_->{executed} } @{ $export->{items} } ]; if (!@{ $export->{items} }) { - $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1); + $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.')); } } elsif (!$export) { @@ -382,7 +382,7 @@ sub bank_transfer_post_payments { my @items = grep { $_->{selected} } @{ $form->{items} || [] }; if (!@items) { - $form->show_generic_error($locale->text('You have not selected any item.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have not selected any item.')); } my @export_ids = uniq map { $_->{sepa_export_id} } @items; my %exports = map { $_ => SL::SEPA->retrieve_export('id' => $_, 'details' => 1, vc => $vc) } @export_ids; @@ -396,11 +396,11 @@ sub bank_transfer_post_payments { } if (!@items_to_post) { - $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1); + $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.')); } if (any { !$_->{execution_date} } @items_to_post) { - $form->show_generic_error($locale->text('You have to specify an execution date for each antry.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have to specify an execution date for each antry.')); } SL::SEPA->post_payment('items' => \@items_to_post, vc => $vc); @@ -421,7 +421,7 @@ sub bank_transfer_payment_list_as_pdf { my @ids = @{ $form->{items} || [] }; my @export_ids = uniq map { $_->{export_id} } @ids; - $form->show_generic_error($locale->text('Multi mode not supported.'), 'back_button' => 1) if 1 != scalar @export_ids; + $form->show_generic_error($locale->text('Multi mode not supported.')) if 1 != scalar @export_ids; my $export = SL::SEPA->retrieve_export('id' => $export_ids[0], 'details' => 1, vc => $vc); my @items = (); @@ -431,7 +431,7 @@ sub bank_transfer_payment_list_as_pdf { push @items, $item if $item; } - $form->show_generic_error($locale->text('No transfers were executed in this export.'), 'back_button' => 1) if 1 > scalar @items; + $form->show_generic_error($locale->text('No transfers were executed in this export.')) if 1 > scalar @items; my $report = SL::ReportGenerator->new(\%main::myconfig, $form); @@ -484,11 +484,11 @@ sub bank_transfer_download_sepa_xml { my $defaults = SL::DB::Default->get; if (!$defaults->company) { - $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.')); } if (($vc eq 'customer') && !$defaults->sepa_creditor_id) { - $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.')); } my @ids; @@ -500,7 +500,7 @@ sub bank_transfer_download_sepa_xml { } if (!@ids) { - $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have not selected any export.')); } my @items = (); @@ -511,7 +511,7 @@ sub bank_transfer_download_sepa_xml { } if (!@items) { - $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'), 'back_button' => 1); + $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.')); } my $message_id = strftime('MSG%Y%m%d%H%M%S', localtime) . sprintf('%06d', $$); @@ -586,7 +586,7 @@ sub bank_transfer_mark_as_closed_step1 { my @export_ids = map { $_->{id} } grep { $_->{selected} } @{ $form->{exports} || [] }; if (!@export_ids) { - $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1); + $form->show_generic_error($locale->text('You have not selected any export.')); } my @open_export_ids = (); @@ -596,7 +596,7 @@ sub bank_transfer_mark_as_closed_step1 { } if (!@open_export_ids) { - $form->show_generic_error($locale->text('All of the exports you have selected were already closed.'), 'back_button' => 1); + $form->show_generic_error($locale->text('All of the exports you have selected were already closed.')); } $form->{title} = $locale->text('Close SEPA exports'); diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 42639f579..8b69306bb 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -436,12 +436,12 @@ sub create_assembly { $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty}); if ($form->{qty} <= 0) { - $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1); + $form->show_generic_error($locale->text('Invalid quantity.')); } # TODO Es wäre schön, hier schon die maximale Anzahl der zu fertigenden Erzeugnisse zu haben #else { if ($form->{qty} > $maxcreate) { #s.o. - # $form->show_generic_error($locale->text('Can not create that quantity with current stock'), 'back_button' => 1); - # $form->show_generic_error('Maximale Stückzahl' . $maxcreate , 'back_button' => 1); + # $form->show_generic_error($locale->text('Can not create that quantity with current stock')); + # $form->show_generic_error('Maximale Stückzahl' . $maxcreate); # } # } @@ -473,7 +473,7 @@ sub create_assembly { # Ideen? jb 18.3.09 if ($ret ne "1"){ # Die locale-Funktion kann keine Double-Quotes escapen, deswegen hier erstmal so (ein wahrscheinlich immerwährender Hotfix) s.a. Frage davor jb 25.4.09 - $form->show_generic_error($ret, 'back_button' => 1); + $form->show_generic_error($ret); } delete @{$form}{qw(parts_id partnumber description qty unit chargenumber bestbefore comment)}; @@ -496,7 +496,7 @@ sub transfer_stock { $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty}); if ($form->{qty} <= 0) { - $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1); + $form->show_generic_error($locale->text('Invalid quantity.')); } if (!$form->{warehouse_id} || !$form->{bin_id}) { diff --git a/templates/webpages/generic/error.html b/templates/webpages/generic/error.html index a77f86211..2baa2e369 100644 --- a/templates/webpages/generic/error.html +++ b/templates/webpages/generic/error.html @@ -6,31 +6,3 @@

- - [%- IF SHOW_BACK_BUTTON %] -
-

- -

-
- - [%- ELSIF SHOW_BUTTON %] - -
- - [%- FOREACH var = VARIABLES %] - - [%- END %] - - - -

- -

-
- - [%- END %] - -- 2.20.1