From: Moritz Bunkus Date: Tue, 3 May 2016 16:09:54 +0000 (+0200) Subject: Dispatcher: end_of_request() sub aus main namespace verbannt X-Git-Tag: release-3.4.1~160 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=09479f022ab9e0815ceee55923ae46df51afbd42;p=kivitendo-erp.git Dispatcher: end_of_request() sub aus main namespace verbannt --- diff --git a/SL/Auth.pm b/SL/Auth.pm index 30aa40bfc..8b7ea5545 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -89,7 +89,7 @@ sub mini_error { } else { print STDERR "Error: @msg\n"; } - ::end_of_request(); + $::dispatcher->end_request; } sub _read_auth_config { diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index 46857cbd0..b5c2151fb 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -145,7 +145,7 @@ sub _save { title => ($self->is_vendor() ? t8('Edit Vendor') : t8('Edit Customer')), %{$self->{template_args}} ); - ::end_of_request(); + $::dispatcher->end_request; } my $db = $self->{cv}->db; diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index da2c0bfff..1590e614d 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -79,7 +79,7 @@ sub action_login { } # Database update available? - ::end_of_request() if User::LOGIN_DBUPDATE_AVAILABLE() == $result; + $::dispatcher->end_request if User::LOGIN_DBUPDATE_AVAILABLE() == $result; # Other login errors. if (User::LOGIN_OK() != $result) { diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 840a1dd7c..01af8f6e5 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -262,10 +262,10 @@ sub process_perl_script { if (!defined($result)) { print $::form->parse_html_template("dbupgrade/error", { file => $filename, error => $error }); - ::end_of_request(); + $::dispatcher->end_request; } elsif (1 != $result) { SL::System::InstallationLock->unlock if 2 == $result; - ::end_of_request(); + $::dispatcher->end_request; } if (ref($version_or_control) eq "HASH") { diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 7126513eb..a37a01ed9 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -143,7 +143,7 @@ sub show_error { print $::form->parse_html_template($template, \%params); $::lxdebug->leave_sub; - ::end_of_request(); + end_request(); } sub pre_startup_setup { @@ -305,7 +305,7 @@ sub handle_request { action => $action, ); - ::end_of_request() unless $auth_result{auth_ok}; + $self->end_request unless $auth_result{auth_ok}; delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } } unless $auth_result{keep_auth_vars}; @@ -370,7 +370,7 @@ sub redirect_to_login { $action .= '&error=' . $params{error} if $params{error}; print $::request->cgi->redirect("controller.pl?action=${action}"); - ::end_of_request(); + $self->end_request; } sub unrequire_bin_mozilla { @@ -498,7 +498,7 @@ sub _check_for_old_config_files { $::form->header; print $::form->parse_html_template('login_screen/old_configuration_files', { FILES => \@old_files }); - ::end_of_request(); + end_request(); } sub _parse_number_with_unit { @@ -549,11 +549,7 @@ sub _memory_usage_is_too_high { return 0; } -package main; - -use strict; - -sub end_of_request { +sub end_request { die SL::Dispatcher->END_OF_REQUEST; } diff --git a/SL/Form.pm b/SL/Form.pm index 41cb8612d..fbcbe56f3 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -608,7 +608,7 @@ sub _prepare_html_template { my $info = "Web page template '${file}' not found.\n"; $::form->header; print qq|
$info
|; - ::end_of_request(); + $::dispatcher->end_request; } $additional_params->{AUTH} = $::auth; @@ -685,7 +685,7 @@ sub show_generic_error { SL::ClientJS->new ->error($error) ->render(SL::Controller::Base->new); - ::end_of_request(); + $::dispatcher->end_request; } my $add_params = { @@ -716,7 +716,7 @@ sub show_generic_error { $main::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } sub show_generic_information { @@ -736,7 +736,7 @@ sub show_generic_information { $main::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } sub _store_redirect_info_in_session { @@ -762,7 +762,7 @@ sub redirect { print $::form->redirect_header($self->{callback}); } - ::end_of_request(); + $::dispatcher->end_request; $main::lxdebug->leave_sub(); } @@ -2630,7 +2630,7 @@ sub mtime_ischanged { t8("The document has been changed by another user. No mail was sent. Please reopen it in another window and copy the changes to the new window") : t8("The document has been changed by another user. Please reopen it in another window and copy the changes to the new window") ); - ::end_of_request(); + $::dispatcher->end_request; } } diff --git a/SL/USTVA.pm b/SL/USTVA.pm index a80372b28..93f83df0e 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -401,7 +401,7 @@ sub info { |; - ::end_of_request(); + $::dispatcher->end_request; } else { diff --git a/SL/User.pm b/SL/User.pm index 37e1a9b5f..00c25d55a 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -149,7 +149,7 @@ sub login { if ($form->{"show_dbupdate_warning"}) { print $form->parse_html_template("dbupgrade/warning", { unapplied_scripts => \@unapplied_scripts }); - ::end_of_request(); + $::dispatcher->end_request; } # update the tables @@ -164,7 +164,7 @@ sub login { # If $self->dbupdate2 returns than this means all upgrade scripts # have been applied successfully, none required user # interaction. Otherwise the deeper layers would have called - # ::end_of_request() already, and return would not have returned to + # $::dispatcher->end_request already, and return would not have returned to # us. Therefore we can now use RDBO instances because their supposed # table structures do match the actual structures. So let's ensure # that the "employee" table contains the appropriate entries for all diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 20005138e..62c645a6f 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1634,7 +1634,7 @@ sub delete_warehouse { $form->header(); print $form->parse_html_template('am/confirm_delete_warehouse'); - ::end_of_request(); + $::dispatcher->end_request; } if (AM->delete_warehouse(\%myconfig, $form)) { diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index b3b111a65..dd9a46dd1 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -693,7 +693,7 @@ sub post { my ($vendor) = split /--/, $form->{vendor}; if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") { &update; - ::end_of_request(); + $::dispatcher->end_request; } my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected}; my ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 444f7f92a..8a0d780e3 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -723,7 +723,7 @@ sub post { my ($customer) = split /--/, $form->{customer}; if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") { update(); - ::end_of_request(); + $::dispatcher->end_request; } $form->{AR}{receivables} = $form->{ARselected}; diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 75764a434..a1ba9f279 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -109,7 +109,7 @@ sub check_name { $form->error($locale->text("More than one #1 found matching, please be more specific.", $locale->text(ucfirst $name))); } else { &select_name($name); - ::end_of_request(); + $::dispatcher->end_request; } } diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index d448685f3..fe8a3fa38 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -135,7 +135,7 @@ sub print { print $::locale->text('done'); $::form->redirect($::locale->text('Marked entries printed!')); } - ::end_of_request(); + $::dispatcher->end_request; } } @@ -198,4 +198,3 @@ sub list_spool { } sub continue { call_sub($::form->{"nextsub"}); } - diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 888bf8a9f..ccecac306 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -459,7 +459,7 @@ sub check_form { if ($form->{currency} ne $form->{oldcurrency}) { &update; - ::end_of_request(); + $::dispatcher->end_request; } $form->error($locale->text('Date missing!')) unless $form->{datepaid}; my $selected_check = 1; diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index b5015e781..7e3ccb4de 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -429,7 +429,7 @@ sub update_delivery_order { if ($rows > 1) { select_item(mode => $mode, pre_entered_qty => $form->{"qty_$i"}); - ::end_of_request(); + $::dispatcher->end_request; } else { @@ -741,7 +741,7 @@ sub save { # if the name changed get new values if (check_name($form->{vc})) { update(); - ::end_of_request(); + $::dispatcher->end_request; } $form->{id} = 0 if $form->{saveasnew}; @@ -759,7 +759,7 @@ sub save { if (!$params{no_redirect} && !$form->{print_and_save}) { delete @{$form}{ary_diff([keys %{ $form }], [qw(login id script type cursor_fokus)])}; edit(); - ::end_of_request(); + $::dispatcher->end_request; } $main::lxdebug->leave_sub(); } @@ -783,7 +783,7 @@ sub delete { # /saving the history $form->info($locale->text('Delivery Order deleted!')); - ::end_of_request(); + $::dispatcher->end_request; } $form->error($locale->text('Cannot delete delivery order!')); @@ -1405,7 +1405,7 @@ sub transfer_in { update(); $main::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } } @@ -1524,7 +1524,7 @@ sub transfer_out { update(); $main::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } } DO->transfer_in_out('direction' => 'out', diff --git a/bin/mozilla/fu.pl b/bin/mozilla/fu.pl index 5cd6a0745..660e98283 100644 --- a/bin/mozilla/fu.pl +++ b/bin/mozilla/fu.pl @@ -126,7 +126,7 @@ sub save_follow_up { if ($form->{POPUP_MODE}) { $form->header(); print $form->parse_html_template('fu/close_window'); - ::end_of_request(); + $::dispatcher->end_request; } $form->{SAVED_MESSAGE} = $locale->text('Follow-Up saved.'); @@ -172,7 +172,7 @@ sub finish { if ($form->{POPUP_MODE}) { $form->header(); print $form->parse_html_template('fu/close_window'); - ::end_of_request(); + $::dispatcher->end_request; } $form->redirect() if ($form->{callback}); @@ -210,7 +210,7 @@ sub delete { if ($form->{POPUP_MODE}) { $form->header(); print $form->parse_html_template('fu/close_window'); - ::end_of_request(); + $::dispatcher->end_request; } $form->redirect() if ($form->{callback}); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 519ab79d8..6cb9e9cd8 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1846,7 +1846,7 @@ sub update { if ($rows > 1) { $form->{makemodel_rows}--; select_item(mode => 'IC', pre_entered_qty => $form->parse_amount(\%myconfig, $form->{"qty_$i"})); - ::end_of_request(); + $::dispatcher->end_request; } else { map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit partsgroup); diff --git a/bin/mozilla/installationcheck.pl b/bin/mozilla/installationcheck.pl index fdffa64f0..f52cc521d 100644 --- a/bin/mozilla/installationcheck.pl +++ b/bin/mozilla/installationcheck.pl @@ -87,7 +87,7 @@ sub verify_installation { |); - ::end_of_request(); + $::dispatcher->end_request; } 1; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index cdf43d339..d8f53dbc8 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -860,7 +860,7 @@ sub validate_items { if ($form->{rowcount} == 1) { flash('warning', $::locale->text('The action you\'ve chosen has not been executed because the document does not contain any item yet.')); &update; - ::end_of_request(); + $::dispatcher->end_request; } for my $i (1 .. $form->{rowcount} - 1) { @@ -1147,7 +1147,7 @@ sub print { $form->{formname} = $formname; &edit(); $::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } &print_form($old_form); @@ -1591,7 +1591,7 @@ sub print_form { } call_sub($display_form); - ::end_of_request(); + $::dispatcher->end_request; } my $msg = @@ -1605,7 +1605,7 @@ sub print_form { } if ($form->{printing}) { call_sub($display_form); - ::end_of_request(); + $::dispatcher->end_request; } $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 46119899a..5b62ea5c4 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -525,7 +525,7 @@ sub update { if ($rows > 1) { select_item(mode => 'IR', pre_entered_qty => $form->{"qty_$i"}); - ::end_of_request(); + $::dispatcher->end_request; } else { @@ -746,7 +746,7 @@ sub post { # if the vendor changed get new values if (&check_name('vendor')) { &update; - ::end_of_request(); + $::dispatcher->end_request; } if ($myconfig{mandatory_departments} && !$form->{department_id}) { diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 16127500e..fa5e31903 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -605,7 +605,7 @@ sub update { if ($rows > 1) { select_item(mode => 'IS', pre_entered_qty => $form->{"qty_$i"}); - ::end_of_request(); + $::dispatcher->end_request; } else { @@ -760,7 +760,7 @@ sub post { # if oldcustomer ne customer redo form if (&check_name('customer')) { &update; - ::end_of_request(); + $::dispatcher->end_request; } if ($myconfig{mandatory_departments} && !$form->{department_id}) { diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 4870287e7..0e7dc7a35 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -651,7 +651,7 @@ sub update { if ($rows > 1) { select_item(mode => $mode, pre_entered_qty => $form->{"qty_$i"}); - ::end_of_request(); + $::dispatcher->end_request; } else { @@ -1195,7 +1195,7 @@ sub save_and_close { $form->{payment_id} = $payment_id; } &update; - ::end_of_request(); + $::dispatcher->end_request; } $form->{id} = 0 if $form->{saveasnew}; @@ -1303,7 +1303,7 @@ sub save { $form->{payment_id} = $payment_id; } &update; - ::end_of_request(); + $::dispatcher->end_request; } $form->{id} = 0 if $form->{saveasnew}; @@ -1366,7 +1366,7 @@ sub save { if(!$form->{print_and_save}) { delete @{$form}{ary_diff([keys %{ $form }], [qw(login id script type cursor_fokus)])}; edit(); - ::end_of_request(); + $::dispatcher->end_request; } $main::lxdebug->leave_sub(); } @@ -1402,7 +1402,7 @@ sub delete { } # /saving the history $form->info($msg); - ::end_of_request(); + $::dispatcher->end_request; } $form->error($err); @@ -1454,7 +1454,7 @@ sub invoice { if (&check_name($form->{vc})) { $form->{payment_id} = $payment_id if $form->{payment_id} eq ""; &update; - ::end_of_request(); + $::dispatcher->end_request; } _oe_remove_delivered_or_billed_rows(id => $form->{id}, type => 'billed'); @@ -1756,7 +1756,7 @@ sub check_for_direct_delivery { $main::lxdebug->leave_sub(); - ::end_of_request(); + $::dispatcher->end_request; } sub purchase_order { diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index b66fead82..f88fce524 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -818,12 +818,12 @@ sub generate_ustva { } elsif ( $form->{format} eq '' ){ # No format error. $form->header; USTVA::error( $locale->text('Application Error. No Format given' ) . "!"); - ::end_of_request(); + $::dispatcher->end_request; } else { # All other Formats are wrong $form->header; USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} ); - ::end_of_request(); + $::dispatcher->end_request; } diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 5c0a5e7d0..5ffa38289 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -290,7 +290,7 @@ sub transfer_parts { if (!scalar @transfers) { $form->show_generic_information($locale->text('Nothing has been selected for transfer.')); - ::end_of_request(); + $::dispatcher->end_request; } WH->transfer(@transfers); @@ -624,7 +624,7 @@ sub remove_parts { if (!scalar @transfers) { $form->show_generic_information($locale->text('Nothing has been selected for removal.')); - ::end_of_request(); + $::dispatcher->end_request; } WH->transfer(@transfers); diff --git a/scripts/task_server.pl b/scripts/task_server.pl index 2fd93de0f..c946371d0 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -297,17 +297,6 @@ sub gd_run { } } -sub end_of_request { - $main::lxdebug->show_backtrace(); - die <