Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 30683648

Von Bernd Bleßmann vor etwa 3 Jahren hinzugefügt

  • ID 30683648cea6389ea0938654004b1c5153dd91ef
  • Vorgänger 95f5cbc1
  • Nachfolger a5c1b85d

CsvImport Lieferscheine: ShippedQty-Helper für Prüfung, ob komplett geliefert

Unterschiede anzeigen:

SL/Controller/CsvImport/DeliveryOrder.pm
21 21
use SL::DB::Inventory;
22 22
use SL::DB::TransferType;
23 23
use SL::DBUtils;
24
use SL::Helper::ShippedQty;
24 25
use SL::PriceSource;
25 26
use SL::TransNumber;
26 27
use SL::Util qw(trim);
......
1112 1113

  
1113 1114
  # delivery order for all positions created?
1114 1115
  if (scalar(@$orders)) {
1115
    foreach my $order (@{ $orders }) {
1116
      my $all_deliverd;
1117
      foreach my $orderitem (@{ $order->items }) {
1118
        my $delivered_qty = 0;
1119
        foreach my $do_item (@{$orderitem->linked_records(to => 'DeliveryOrderItem')}) {
1120
          $delivered_qty += $do_item->unit_obj->convert_to($do_item->qty, $orderitem->unit_obj);
1121
        }
1122
        $all_deliverd = $orderitem->qty <= $delivered_qty;
1123
        last if !$all_deliverd;
1124
      }
1125
      $order->update_attributes(delivered => !!$all_deliverd);
1126
    }
1116
    SL::Helper::ShippedQty->new->calculate($orders)->write_to_objects;
1117
    $_->update_attributes(delivered => $_->delivered) for @{ $orders };
1127 1118
  }
1128 1119

  
1129 1120
  # inventory (or use WH->transfer?)

Auch abrufbar als: Unified diff