Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a8459f49

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID a8459f498a58bdabcd87bcdf1cd08e9f5726abe4
  • Vorgänger b9f5d35e
  • Nachfolger e9e60985

Form->show_generic_error: Parameter action, back_button entfernt

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.

Unterschiede anzeigen:

SL/Form.pm
681 681
    'label_error' => $error,
682 682
  };
683 683

  
684
  if ($params{action}) {
685
    my @vars;
686

  
687
    map { delete($self->{$_}); } qw(action);
688
    map { push @vars, { "name" => $_, "value" => $self->{$_} } if (!ref($self->{$_})); } keys %{ $self };
689

  
690
    $add_params->{SHOW_BUTTON}  = 1;
691
    $add_params->{BUTTON_LABEL} = $params{label} || $params{action};
692
    $add_params->{VARIABLES}    = \@vars;
693

  
694
  } elsif ($params{back_button}) {
695
    $add_params->{SHOW_BACK_BUTTON} = 1;
696
  }
697

  
698 684
  $self->{title} = $params{title} if $params{title};
699 685

  
700 686
  $self->header();
bin/mozilla/do.pl
914 914
  my @do_ids = map { $form->{"trans_id_$_"} } grep { $form->{"multi_id_$_"} } (1..$form->{rowcount});
915 915

  
916 916
  if (!scalar @do_ids) {
917
    $form->show_generic_error($locale->text('You have not selected any delivery order.'), 'back_button' => 1);
917
    $form->show_generic_error($locale->text('You have not selected any delivery order.'));
918 918
  }
919 919

  
920 920
  map { delete $form->{$_} } grep { m/^(?:trans|multi)_id_\d+/ } keys %{ $form };
......
1357 1357
  my $locale   = $main::locale;
1358 1358

  
1359 1359
  if ($form->{id} && DO->is_marked_as_delivered(id => $form->{id})) {
1360
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.'), 'back_button' => 1);
1360
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.'));
1361 1361
  }
1362 1362

  
1363 1363
  save(no_redirect => 1);
......
1427 1427
  my $locale   = $main::locale;
1428 1428

  
1429 1429
  if ($form->{id} && DO->is_marked_as_delivered(id => $form->{id})) {
1430
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.'), 'back_button' => 1);
1430
    $form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.'));
1431 1431
  }
1432 1432

  
1433 1433
  save(no_redirect => 1);
......
1653 1653
      my $base_unit_factor = $units->{ $part_info_map{$form->{"id_$i"}}->{unit} }->{factor} || 1;
1654 1654
      my $qty =   $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
1655 1655

  
1656
      $form->show_generic_error($locale->text("Cannot transfer negative entries." ), 'back_button' => 1) if ($qty < 0);
1656
      $form->show_generic_error($locale->text("Cannot transfer negative entries." )) if ($qty < 0);
1657 1657
      # if we do not want to transfer services and this part is a service, set qty to zero
1658 1658
      # ... and do not create a hash entry in %qty_parts below (will skip check for bins for the transfer == out case)
1659 1659
      # ... 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 1740
        }
1741 1741
      } else {
1742 1742
        #$main::lxdebug->message(0, 'Fehlertext: ' . $fehlertext);
1743
        $form->show_generic_error($locale->text("Cannot transfer. <br> Reason:<br>#1", $fehlertext ), 'back_button' => 1);
1743
        $form->show_generic_error($locale->text("Cannot transfer. <br> Reason:<br>#1", $fehlertext ));
1744 1744
      }
1745 1745
    }
1746 1746
  }
bin/mozilla/ic.pl
153 153
  $form->header();
154 154

  
155 155
  if (@errors) {
156
    $form->show_generic_error(join('<br>', @errors), 'back_button' => 1);
156
    $form->show_generic_error(join('<br>', @errors));
157 157
  }
158 158

  
159 159
  $form->{nextsub} = "update_prices";
bin/mozilla/oe.pl
770 770
    $form->{ordlabel}  = $locale->text('Quotation Number');
771 771

  
772 772
  } else {
773
    $form->show_generic_error($locale->text('oe.pl::search called with unknown type'), back_button => 1);
773
    $form->show_generic_error($locale->text('oe.pl::search called with unknown type'));
774 774
  }
775 775

  
776 776
  # setup vendor / customer data
bin/mozilla/sepa.pl
329 329
    @ids = map $_->{id}, grep { $_->{selected} } @{ $form->{exports} || [] };
330 330

  
331 331
    if (!@ids) {
332
      $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
332
      $form->show_generic_error($locale->text('You have not selected any export.'));
333 333
    }
334 334
  }
335 335

  
......
353 353
    $export->{items} = [ grep { !$_->{export_closed} && !$_->{executed} } @{ $export->{items} } ];
354 354

  
355 355
    if (!@{ $export->{items} }) {
356
      $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);
356
      $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'));
357 357
    }
358 358

  
359 359
  } elsif (!$export) {
......
382 382
  my @items  = grep { $_->{selected} } @{ $form->{items} || [] };
383 383

  
384 384
  if (!@items) {
385
    $form->show_generic_error($locale->text('You have not selected any item.'), 'back_button' => 1);
385
    $form->show_generic_error($locale->text('You have not selected any item.'));
386 386
  }
387 387
  my @export_ids    = uniq map { $_->{sepa_export_id} } @items;
388 388
  my %exports       = map { $_ => SL::SEPA->retrieve_export('id' => $_, 'details' => 1, vc => $vc) } @export_ids;
......
396 396
  }
397 397

  
398 398
  if (!@items_to_post) {
399
    $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);
399
    $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'));
400 400
  }
401 401

  
402 402
  if (any { !$_->{execution_date} } @items_to_post) {
403
    $form->show_generic_error($locale->text('You have to specify an execution date for each antry.'), 'back_button' => 1);
403
    $form->show_generic_error($locale->text('You have to specify an execution date for each antry.'));
404 404
  }
405 405

  
406 406
  SL::SEPA->post_payment('items' => \@items_to_post, vc => $vc);
......
421 421
  my @ids        = @{ $form->{items} || [] };
422 422
  my @export_ids = uniq map { $_->{export_id} } @ids;
423 423

  
424
  $form->show_generic_error($locale->text('Multi mode not supported.'), 'back_button' => 1) if 1 != scalar @export_ids;
424
  $form->show_generic_error($locale->text('Multi mode not supported.')) if 1 != scalar @export_ids;
425 425

  
426 426
  my $export = SL::SEPA->retrieve_export('id' => $export_ids[0], 'details' => 1, vc => $vc);
427 427
  my @items  = ();
......
431 431
    push @items, $item if $item;
432 432
  }
433 433

  
434
  $form->show_generic_error($locale->text('No transfers were executed in this export.'), 'back_button' => 1) if 1 > scalar @items;
434
  $form->show_generic_error($locale->text('No transfers were executed in this export.')) if 1 > scalar @items;
435 435

  
436 436
  my $report         =  SL::ReportGenerator->new(\%main::myconfig, $form);
437 437

  
......
484 484
  my $defaults = SL::DB::Default->get;
485 485

  
486 486
  if (!$defaults->company) {
487
    $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.'), 'back_button' => 1);
487
    $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.'));
488 488
  }
489 489

  
490 490
  if (($vc eq 'customer') && !$defaults->sepa_creditor_id) {
491
    $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.'), 'back_button' => 1);
491
    $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.'));
492 492
  }
493 493

  
494 494
  my @ids;
......
500 500
  }
501 501

  
502 502
  if (!@ids) {
503
    $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
503
    $form->show_generic_error($locale->text('You have not selected any export.'));
504 504
  }
505 505

  
506 506
  my @items = ();
......
511 511
  }
512 512

  
513 513
  if (!@items) {
514
    $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);
514
    $form->show_generic_error($locale->text('All the selected exports have already been closed, or all of their items have already been executed.'));
515 515
  }
516 516

  
517 517
  my $message_id = strftime('MSG%Y%m%d%H%M%S', localtime) . sprintf('%06d', $$);
......
586 586
  my @export_ids = map { $_->{id} } grep { $_->{selected} } @{ $form->{exports} || [] };
587 587

  
588 588
  if (!@export_ids) {
589
    $form->show_generic_error($locale->text('You have not selected any export.'), 'back_button' => 1);
589
    $form->show_generic_error($locale->text('You have not selected any export.'));
590 590
  }
591 591

  
592 592
  my @open_export_ids = ();
......
596 596
  }
597 597

  
598 598
  if (!@open_export_ids) {
599
    $form->show_generic_error($locale->text('All of the exports you have selected were already closed.'), 'back_button' => 1);
599
    $form->show_generic_error($locale->text('All of the exports you have selected were already closed.'));
600 600
  }
601 601

  
602 602
  $form->{title} = $locale->text('Close SEPA exports');
bin/mozilla/wh.pl
436 436

  
437 437
  $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
438 438
  if ($form->{qty} <= 0) {
439
    $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1);
439
    $form->show_generic_error($locale->text('Invalid quantity.'));
440 440
  }
441 441
  # TODO Es wäre schön, hier schon die maximale Anzahl der zu fertigenden Erzeugnisse zu haben
442 442
  #else { if ($form->{qty} > $maxcreate) { #s.o.
443
  #     $form->show_generic_error($locale->text('Can not create that quantity with current stock'), 'back_button' => 1);
444
  #     $form->show_generic_error('Maximale Stückzahl' . $maxcreate , 'back_button' => 1);
443
  #     $form->show_generic_error($locale->text('Can not create that quantity with current stock'));
444
  #     $form->show_generic_error('Maximale Stückzahl' . $maxcreate);
445 445
  #   }
446 446
  #  }
447 447

  
......
473 473
  # Ideen? jb 18.3.09
474 474
  if ($ret ne "1"){
475 475
    # 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
476
    $form->show_generic_error($ret, 'back_button' => 1);
476
    $form->show_generic_error($ret);
477 477
  }
478 478

  
479 479
  delete @{$form}{qw(parts_id partnumber description qty unit chargenumber bestbefore comment)};
......
496 496
  $form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
497 497

  
498 498
  if ($form->{qty} <= 0) {
499
    $form->show_generic_error($locale->text('Invalid quantity.'), 'back_button' => 1);
499
    $form->show_generic_error($locale->text('Invalid quantity.'));
500 500
  }
501 501

  
502 502
  if (!$form->{warehouse_id} || !$form->{bin_id}) {
templates/webpages/generic/error.html
6 6
 </div>
7 7

  
8 8
 <p style="text-align: left;"><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"></p>
9

  
10
 [%- IF SHOW_BACK_BUTTON %]
11
 <form>
12
  <p>
13
   <!--- TODO: show back button always hack
14
         In which situation is it necessary to hide it?
15
   <input type="button" onclick="history.back()" value="[% 'Back' | $T8 %]">
16
   -->
17
  </p>
18
 </form>
19

  
20
 [%- ELSIF SHOW_BUTTON %]
21

  
22
 <form action="[% HTML.escape(script) %]" method="post">
23

  
24
  [%- FOREACH var = VARIABLES %]
25
  <input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
26
  [%- END %]
27

  
28
  <input type="hidden" name="action" value="[% HTML.escape(action) %]">
29

  
30
  <p>
31
   <input type="submit" value="[% BUTTON_LABEL %]">
32
  </p>
33
 </form>
34

  
35
 [%- END %]
36

  

Auch abrufbar als: Unified diff