Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b2945bf6

Von Sven Schöling vor mehr als 14 Jahren hinzugefügt

  • ID b2945bf61775161f9ce9be9bdbd106ad44247a14
  • Vorgänger fdbd1e07
  • Nachfolger a07567c2

Aufrufe von 'exit' durch eigene Funktion '::end_of_request()' ersetzt.

Außerdem dafür gesorgt, dass Meldungen, die per
$form->show_generic_(error|information) ausgegeben werden, nicht
doppelt angezeigt werden.

Conflicts:

bin/mozilla/io.pl
bin/mozilla/oe.pl

Unterschiede anzeigen:

SL/DATEV.pm
405 405

  
406 406
      if ($ref2->{trans_id} != $trans->[0]->{trans_id}) {
407 407
        $form->error("Unbalanced ledger! old trans_id " . $trans->[0]->{trans_id} . " new trans_id " . $ref2->{trans_id} . " count $count");
408
        exit 1;
408
        ::end_of_request();
409 409
      }
410 410

  
411 411
      push @{ $trans }, $ref2;
SL/Dispatcher.pm
14 14
use Rose::DB::Object;
15 15
use File::Basename;
16 16

  
17
# Trailing new line is added so that Perl will not add the line
18
# number 'die' was called in.
19
use constant END_OF_REQUEST => "END-OF-REQUEST\n";
20

  
17 21
sub pre_request_checks {
18 22
  show_error('login/auth_db_unreachable') unless $::auth->session_tables_present;
19 23
  $::auth->expire_sessions;
......
33 37
  print $::form->parse_html_template($template);
34 38
  $::lxdebug->leave_sub;
35 39

  
36
  exit;
40
  ::end_of_request();
37 41
}
38 42

  
39 43
sub pre_startup_setup {
......
159 163

  
160 164
    1;
161 165
  } or do {
162
    $::form->{label_error} = $::cgi->pre($EVAL_ERROR);
163
    show_error('generic/error');
166
    if ($EVAL_ERROR ne END_OF_REQUEST) {
167
      $::form->{label_error} = $::cgi->pre($EVAL_ERROR);
168
      eval { show_error('generic/error') };
169
    }
164 170
  };
165 171

  
166 172
  # cleanup
......
181 187
  }
182 188
}
183 189

  
190
package main;
191

  
192
use strict;
193

  
194
sub end_of_request {
195
  die SL::Dispatcher->END_OF_REQUEST;
196
}
197

  
184 198
1;
SL/Form.pm
455 455
    $self->show_generic_error($msg);
456 456

  
457 457
  } else {
458

  
459
    die "Error: $msg\n";
458
    print STDERR "Error: $msg\n";
459
    ::end_of_request();
460 460
  }
461 461

  
462 462
  $main::lxdebug->leave_sub();
......
772 772
      my $info = "Developer information: templates/webpages/${file}.html is newer than the translation file locale/${language}/all.\n" .
773 773
        "Please re-run 'locales.pl' in 'locale/${language}'.";
774 774
      print(qq|<pre>$info</pre>|);
775
      die($info);
775
      ::end_of_request();
776 776
    }
777 777

  
778 778
    $file = "templates/webpages/${file}.html";
......
781 781
    my $info = "Web page template '${file}' not found.\n" .
782 782
      "Please re-run 'locales.pl' in 'locale/${language}'.";
783 783
    print(qq|<pre>$info</pre>|);
784
    die($info);
784
    ::end_of_request();
785 785
  }
786 786

  
787 787
  if ($self->{"DEBUG"}) {
......
895 895
  $self->header();
896 896
  print $self->parse_html_template("generic/error", $add_params);
897 897

  
898
  print STDERR "Error: $error\n";
899

  
898 900
  $main::lxdebug->leave_sub();
899 901

  
900
  die("Error: $error\n");
902
  ::end_of_request();
901 903
}
902 904

  
903 905
sub show_generic_information {
......
917 919

  
918 920
  $main::lxdebug->leave_sub();
919 921

  
920
  die("Information: $text\n");
922
  ::end_of_request();
921 923
}
922 924

  
923 925
# write Trigger JavaScript-Code ($qty = quantity of Triggers)
......
975 977
  if (!$self->{callback}) {
976 978

  
977 979
    $self->info($msg);
978
    exit;
980
    ::end_of_request();
979 981
  }
980 982

  
981 983
#  my ($script, $argv) = split(/\?/, $self->{callback}, 2);
SL/USTVA.pm
412 412
    </body>
413 413
    |;
414 414

  
415
    exit;
415
    ::end_of_request();
416 416

  
417 417
  } else {
418 418

  
SL/User.pm
144 144

  
145 145
      if ($form->{"show_dbupdate_warning"}) {
146 146
        print $form->parse_html_template("dbupgrade/warning");
147
        exit(0);
147
        ::end_of_request();
148 148
      }
149 149

  
150 150
      # update the tables
......
412 412
# Process a Perl script which updates the database.
413 413
# If the script returns 1 then the update was successful.
414 414
# Return code "2" means "needs more interaction; remove
415
# users/nologin and exit".
415
# users/nologin and end current request".
416 416
# All other return codes are fatal errors.
417 417
sub process_perl_script {
418 418
  $main::lxdebug->enter_sub();
......
466 466
    print $form->parse_html_template("dbupgrade/error",
467 467
                                     { "file"  => $filename,
468 468
                                       "error" => $@ });
469
    exit(0);
469
    ::end_of_request();
470 470
  } elsif (1 != $result) {
471 471
    unlink("users/nologin") if (2 == $result);
472
    exit(0);
472
    ::end_of_request();
473 473
  }
474 474

  
475 475
  if (ref($version_or_control) eq "HASH") {
bin/mozilla/admin.pl
132 132
    $form->header();
133 133
    print $form->parse_html_template('admin/check_auth_database', \%params);
134 134

  
135
    exit 0;
135
    ::end_of_request();
136 136
  }
137 137

  
138 138
  if (!$main::auth->check_tables()) {
......
140 140
    $form->header();
141 141
    print $form->parse_html_template('admin/check_auth_tables', \%params);
142 142

  
143
    exit 0;
143
    ::end_of_request();
144 144
  }
145 145

  
146 146
  if (-f $main::memberfile) {
......
157 157
    print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile,
158 158
                                                               'backupdir'  => $backupdir });
159 159

  
160
    exit 0
160
    ::end_of_request();
161 161
  }
162 162
}
163 163

  
bin/mozilla/am.pl
3545 3545

  
3546 3546
    $form->header();
3547 3547
    print $form->parse_html_template('am/confirm_delete_warehouse');
3548
    exit 0;
3548
    ::end_of_request();
3549 3549
  }
3550 3550

  
3551 3551
  if (AM->delete_warehouse(\%myconfig, $form)) {
bin/mozilla/ap.pl
1064 1064
  my ($vendor) = split /--/, $form->{vendor};
1065 1065
  if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
1066 1066
    &update;
1067
    exit;
1067
    ::end_of_request();
1068 1068
  }
1069 1069
  my ($debitaccno,    $debittaxkey)    = split /--/, $form->{AP_amountselected};
1070 1070
  my ($taxkey,        $NULL)           = split /--/, $form->{taxchartselected};
bin/mozilla/ar.pl
1127 1127
  my ($customer) = split /--/, $form->{customer};
1128 1128
  if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
1129 1129
    update();
1130
    exit;
1130
    ::end_of_request();
1131 1131
  }
1132 1132

  
1133 1133
  $form->{AR}{receivables} = $form->{ARselected};
bin/mozilla/arap.pl
108 108
          $form->error($locale->text("More than one #1 found matching, please be more specific.", $locale->text(ucfirst $name)));
109 109
        } else {
110 110
          &select_name($name);
111
          exit;
111
          ::end_of_request();
112 112
        }
113 113
      }
114 114

  
......
318 318
          # check form->{project_list} how many there are
319 319
          $form->{rownumber} = $i;
320 320
          &select_project($i ? undef : 1, $nextsub);
321
          exit;
321
          ::end_of_request();
322 322
        }
323 323

  
324 324
        if ($rows == 1) {
bin/mozilla/bp.pl
390 390
        print $locale->text('done');
391 391
        $form->redirect($locale->text('Marked entries printed!'));
392 392
      }
393
      exit;
393
      ::end_of_request();
394 394
    }
395 395
  }
396 396

  
bin/mozilla/cp.pl
771 771

  
772 772
  if ($form->{currency} ne $form->{oldcurrency}) {
773 773
    &update;
774
    exit;
774
    ::end_of_request();
775 775
  }
776 776

  
777 777
  $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount});
bin/mozilla/ct.pl
574 574
  }
575 575
  # /saving the history
576 576
  &edit;
577
  exit;
577

  
578 578
  $main::lxdebug->leave_sub();
579
  ::end_of_request();
579 580
}
580 581

  
581 582
sub delete {
bin/mozilla/do.pl
367 367
      if ($rows > 1) {
368 368

  
369 369
        select_item();
370
        exit;
370
        ::end_of_request();
371 371

  
372 372
      } else {
373 373

  
......
619 619
  # if the name changed get new values
620 620
  if (check_name($form->{vc})) {
621 621
    update();
622
    exit;
622
    ::end_of_request();
623 623
  }
624 624

  
625 625
  $form->{id} = 0 if $form->{saveasnew};
......
647 647
  if(!$form->{print_and_save}) {
648 648
    set_headings("edit");
649 649
    update();
650
    exit;
650
    ::end_of_request();
651 651
  }
652 652
  $main::lxdebug->leave_sub();
653 653
}
......
690 690
    # /saving the history
691 691

  
692 692
    $form->info($locale->text('Delivery Order deleted!'));
693
    exit();
693
    ::end_of_request();
694 694
  }
695 695

  
696 696
  $form->error($locale->text('Cannot delete delivery order!'));
......
1232 1232
      update();
1233 1233
      $main::lxdebug->leave_sub();
1234 1234

  
1235
      exit 0;
1235
      ::end_of_request();
1236 1236
    }
1237 1237
  }
1238 1238

  
......
1346 1346
      update();
1347 1347
      $main::lxdebug->leave_sub();
1348 1348

  
1349
      exit 0;
1349
      ::end_of_request();
1350 1350
    }
1351 1351
  }
1352 1352

  
bin/mozilla/fu.pl
118 118
  if ($form->{POPUP_MODE}) {
119 119
    $form->header();
120 120
    print $form->parse_html_template('fu/close_window');
121
    exit 0;
121
    ::end_of_request();
122 122
  }
123 123

  
124 124
  $form->{SAVED_MESSAGE} = $locale->text('Follow-Up saved.');
......
162 162
  if ($form->{POPUP_MODE}) {
163 163
    $form->header();
164 164
    print $form->parse_html_template('fu/close_window');
165
    exit 0;
165
    ::end_of_request();
166 166
  }
167 167

  
168 168
  $form->redirect() if ($form->{callback});
......
198 198
  if ($form->{POPUP_MODE}) {
199 199
    $form->header();
200 200
    print $form->parse_html_template('fu/close_window');
201
    exit 0;
201
    ::end_of_request();
202 202
  }
203 203

  
204 204
  $form->redirect() if ($form->{callback});
bin/mozilla/ic.pl
1723 1723
        if ($rows > 1) {
1724 1724
          $form->{makemodel_rows}--;
1725 1725
          &select_item;
1726
          exit;
1726
          ::end_of_request();
1727 1727
        } else {
1728 1728
          map { $form->{item_list}[$i]{$_} =~ s/\"/&quot;/g }
1729 1729
            qw(partnumber description unit partsgroup);
bin/mozilla/installationcheck.pl
85 85
 </body>
86 86
</html>
87 87
|);
88
  exit(0);
88

  
89
  ::end_of_request();
89 90
}
90 91

  
91 92
1;
bin/mozilla/invoice_io.pl
159 159
  # if we have a display_form
160 160
  if ($form->{display_form}) {
161 161
    call_sub($form->{"display_form"});
162
    exit;
162
    ::end_of_request();
163 163
  }
164 164

  
165 165
  Common::webdav_folder($form) if ($main::webdav);
......
176 176
  #     $form->{print_and_post} = 0;
177 177
  #
178 178
  #     &print_form($old_form);
179
  #     exit;
179
  #     ::end_of_request();
180 180
  #   }
181 181
  #
182 182
  #   $form->{action}   = "";
bin/mozilla/io.pl
882 882
  # check if items are valid
883 883
  if ($form->{rowcount} == 1) {
884 884
    &update;
885
    exit;
885
    ::end_of_request();
886 886
  }
887 887

  
888 888
  for my $i (1 .. $form->{rowcount} - 1) {
......
1265 1265
    &save();
1266 1266
    $form->{formname} = $formname;
1267 1267
    &edit();
1268
    exit;
1268
    ::end_of_request();
1269 1269
  }
1270 1270

  
1271 1271
  &print_form($old_form);
......
1432 1432
        $form->save_history($form->dbconnect(\%myconfig));
1433 1433
      }
1434 1434
      # /saving the history
1435
      exit;
1435
      ::end_of_request();
1436 1436
    }
1437 1437
  }
1438 1438

  
......
1705 1705
      }
1706 1706

  
1707 1707
      call_sub($display_form);
1708
      exit;
1708
      ::end_of_request();
1709 1709
    }
1710 1710

  
1711 1711
    my $msg =
......
1716 1716
  }
1717 1717
  if ($form->{printing}) {
1718 1718
   call_sub($display_form);
1719
   exit;
1719
   ::end_of_request();
1720 1720
  }
1721 1721

  
1722 1722
  $main::lxdebug->leave_sub();
bin/mozilla/ir.pl
468 468
      if ($rows > 1) {
469 469

  
470 470
        &select_item;
471
        exit;
471
        ::end_of_request();
472 472

  
473 473
      } else {
474 474

  
......
664 664
  # if the vendor changed get new values
665 665
  if (&check_name('vendor')) {
666 666
    &update;
667
    exit;
667
    ::end_of_request();
668 668
  }
669 669

  
670 670
  if ($myconfig{mandatory_departments} && !$form->{department_id}) {
bin/mozilla/is.pl
512 512
      if ($rows > 1) {
513 513

  
514 514
        &select_item;
515
        exit;
515
        ::end_of_request();
516 516

  
517 517
      } else {
518 518

  
......
652 652
  # if oldcustomer ne customer redo form
653 653
  if (&check_name('customer')) {
654 654
    &update;
655
    exit;
655
    ::end_of_request();
656 656
  }
657 657

  
658 658
  if ($myconfig{mandatory_departments} && !$form->{department_id}) {
bin/mozilla/licenses.pl
611 611
            . $locale->text(
612 612
                      "No licenses were found that match the search criteria.")
613 613
            . qq|</body></html>|);
614
    exit(0);
614
    ::end_of_request();
615 615
  }
616 616

  
617 617
  print(
bin/mozilla/login.pl
57 57
  if (SL::Auth::SESSION_EXPIRED == $session_result) {
58 58
    $form->{error_message} = $locale->text('The session is invalid or has expired.');
59 59
    login_screen();
60
    exit;
60
    ::end_of_request();
61 61
  }
62 62
  my $action = $form->{action};
63 63
  if (!$action && $auth->{SESSION}->{login}) {
......
104 104

  
105 105
  unless ($form->{login}) {
106 106
    login_screen($locale->text('You did not enter a name!'));
107
    exit;
107
    ::end_of_request();
108 108
  }
109 109

  
110 110
  my $user = new User $form->{login};
......
112 112
  # if we get an error back, bale out
113 113
  my $result;
114 114
  if (($result = $user->login($form)) <= -1) {
115
    exit if $result == -2;
115
    ::end_of_request() if $result == -2;
116 116
    login_screen($locale->text('Incorrect username or password!'));
117
    exit;
117
    ::end_of_request();
118 118
  }
119 119

  
120 120
  my %style_to_script_map = ( 'v3'  => 'v3',
......
188 188
  # $form->parse_html_template('login/auth_db_unreachable');
189 189
  # $form->parse_html_template('login/authentication_pl_missing');
190 190

  
191
  exit;
191
  ::end_of_request();
192 192
}
193 193

  
194 194
1;
bin/mozilla/oe.pl
563 563
      if ($rows > 1) {
564 564

  
565 565
        &select_item;
566
        exit;
566
        ::end_of_request();
567 567

  
568 568
      } else {
569 569

  
......
1010 1010
      $form->{payment_id} = $payment_id;
1011 1011
    }
1012 1012
    &update;
1013
    exit;
1013
    ::end_of_request();
1014 1014
  }
1015 1015

  
1016 1016
  $form->{id} = 0 if $form->{saveasnew};
......
1119 1119
      $form->{payment_id} = $payment_id;
1120 1120
    }
1121 1121
    &update;
1122
    exit;
1122
    ::end_of_request();
1123 1123
  }
1124 1124

  
1125 1125
  $form->{id} = 0 if $form->{saveasnew};
......
1180 1180
  if(!$form->{print_and_save}) {
1181 1181
    delete @{$form}{ary_diff([keys %{ $form }], [qw(login stylesheet id script type cursor_fokus)])};
1182 1182
    edit();
1183
    exit;
1183
    ::end_of_request();
1184 1184
  }
1185 1185
  $main::lxdebug->leave_sub();
1186 1186
}
......
1264 1264
    }
1265 1265
    # /saving the history
1266 1266
    $form->info($msg);
1267
    exit();
1267
    ::end_of_request();
1268 1268
  }
1269 1269
  $form->error($err);
1270 1270

  
......
1310 1310
  if (&check_name($form->{vc})) {
1311 1311
    $form->{payment_id} = $payment_id if $form->{payment_id} eq "";
1312 1312
    &update;
1313
    exit;
1313
    ::end_of_request();
1314 1314
  }
1315 1315

  
1316 1316
  $form->{cp_id} *= 1;
......
1333 1333

  
1334 1334
    if (!$exchangerate) {
1335 1335
      &backorder_exchangerate($orddate, $buysell);
1336
      exit;
1336
      ::end_of_request();
1337 1337
    }
1338 1338
  }
1339 1339

  
......
1681 1681

  
1682 1682
  $main::lxdebug->leave_sub();
1683 1683

  
1684
  exit 0;
1684
  ::end_of_request();
1685 1685
}
1686 1686

  
1687 1687
sub purchase_order {
bin/mozilla/ustva.pl
915 915
      } else {
916 916
        $form->header;
917 917
        USTVA::error( $locale->text('Wrong Period' ));
918
        exit(0);
918
        ::end_of_request();
919 919
      }
920 920

  
921 921
      my $tax_office           = first { $_->{name} eq $form->{elsterland} } @{ $ustva->{tax_office_information} };
......
983 983
    } elsif ( $form->{format} eq '' ){ # No format error.
984 984
      $form->header;
985 985
      USTVA::error( $locale->text('Application Error. No Format given' ) . "!");
986
      exit(0);
986
      ::end_of_request();
987 987

  
988 988
    } else { # All other Formats are wrong
989 989
      $form->header;
990 990
      USTVA::error( $locale->text('Application Error. Wrong Format') . ": " . $form->{format} );
991
      exit(0);
991
      ::end_of_request();
992 992
    }
993 993

  
994 994

  
bin/mozilla/wh.pl
277 277

  
278 278
  if (!scalar @transfers) {
279 279
    $form->show_generic_information($locale->text('Nothing has been selected for transfer.'));
280
    exit 0;
280
    ::end_of_request();
281 281
  }
282 282

  
283 283
  WH->transfer(@transfers);
......
611 611

  
612 612
  if (!scalar @transfers) {
613 613
    $form->show_generic_information($locale->text('Nothing has been selected for removal.'));
614
    exit 0;
614
    ::end_of_request();
615 615
  }
616 616

  
617 617
  WH->transfer(@transfers);
doc/INSTALL.fcgi
49 49

  
50 50
4. TODO
51 51

  
52
4.1. Fehlermeldungen, die per $form->error() ausgegeben werden, werden momentan doppelt angezeigt.
53

  
54
4.2. "exit" sollte unter FastCGI nicht verwendet werden, startet ja den Prozess neu. Nur die Abhandlung des Requests sollte beendet werden.

Auch abrufbar als: Unified diff