Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 088bf5a0

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 088bf5a0944051fe84c0e8e3fff7991a2a172895
  • Vorgänger 31eb98ad
  • Nachfolger f0864171

Lieferscheine: immer vor Aus- und Einlagern speichern

Behebt zwei Probleme:

1. Wenn die Benutzerin wichtige Informationen
entfernt (Kunde/Lieferant, Lieferscheindatum), die "save()" bemängeln
würde, so wird nichts ausgelagert.

2. Wenn ohne zu speichern gleich ausgelagert wird, so wurden vorher
Lagertransfers eingetragen, deren Feld "oe_id" nicht gesetzt war.

Fix für Bug 1463.

Unterschiede anzeigen:

bin/mozilla/do.pl
34 34
use POSIX qw(strftime);
35 35
use YAML;
36 36

  
37
use SL::DB::DeliveryOrder;
37 38
use SL::DO;
38 39
use SL::IR;
39 40
use SL::IS;
......
606 607
sub save {
607 608
  $main::lxdebug->enter_sub();
608 609

  
610
  my (%params) = @_;
611

  
609 612
  check_do_access();
610 613

  
611 614
  my $form     = $main::form;
......
656 659
  # /saving the history
657 660

  
658 661
  $form->{simple_save} = 1;
659
  if(!$form->{print_and_save}) {
662
  if (!$params{no_redirect} && !$form->{print_and_save}) {
660 663
    set_headings("edit");
661 664
    update();
662 665
    ::end_of_request();
......
1245 1248
sub transfer_in {
1246 1249
  $main::lxdebug->enter_sub();
1247 1250

  
1251
  save(no_redirect => 1);
1252

  
1248 1253
  my $form     = $main::form;
1249 1254
  my %myconfig = %main::myconfig;
1250 1255
  my $locale   = $main::locale;
......
1289 1294
    if (@{ $form->{ERRORS} }) {
1290 1295
      push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
1291 1296

  
1297
      set_headings('edit');
1292 1298
      update();
1293 1299
      $main::lxdebug->leave_sub();
1294 1300

  
......
1299 1305
  DO->transfer_in_out('direction' => 'in',
1300 1306
                      'requests'  => \@all_requests);
1301 1307

  
1302
  $form->{delivered} = 1;
1308
  SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
1303 1309

  
1304
  save();
1310
  $form->{callback} = 'do.pl?action=edit&type=purchase_delivery_order&id=' . $form->escape($form->{id});
1311
  $form->redirect;
1305 1312

  
1306 1313
  $main::lxdebug->leave_sub();
1307 1314
}
......
1309 1316
sub transfer_out {
1310 1317
  $main::lxdebug->enter_sub();
1311 1318

  
1319
  save(no_redirect => 1);
1320

  
1312 1321
  my $form     = $main::form;
1313 1322
  my %myconfig = %main::myconfig;
1314 1323
  my $locale   = $main::locale;
......
1350 1359

  
1351 1360
      next if (0 == $row_sum_base_qty);
1352 1361

  
1353
      my $do_base_qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
1362
      my $do_base_qty = $form->{"qty_$i"} * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
1354 1363

  
1355 1364
#      if ($do_base_qty != $row_sum_base_qty) {
1356 1365
#        push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
......
1404 1413
    if (@{ $form->{ERRORS} }) {
1405 1414
      push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
1406 1415

  
1416
      set_headings('edit');
1407 1417
      update();
1408 1418
      $main::lxdebug->leave_sub();
1409 1419

  
......
1413 1423
  DO->transfer_in_out('direction' => 'out',
1414 1424
                      'requests'  => \@all_requests);
1415 1425

  
1416
  $form->{delivered} = 1;
1426
  SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
1417 1427

  
1418
  save();
1428
  $form->{callback} = 'do.pl?action=edit&type=sales_delivery_order&id=' . $form->escape($form->{id});
1429
  $form->redirect;
1419 1430

  
1420 1431
  $main::lxdebug->leave_sub();
1421 1432
}

Auch abrufbar als: Unified diff