]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Order.pm
Bankverbuchungen: freies Skonto auch abziehen. Code-Vereinfachung (not_assigned)
[mfinanz.git] / SL / Controller / Order.pm
index 91cdebba665a200e23254d18a9bc4aa8776a30f1..f6afed9a807d80e0c3af46326dffd34adcfb4710 100644 (file)
@@ -1208,7 +1208,7 @@ sub make_order {
   # be retrieved via items until the order is saved. Adding empty items to new
   # order here solves this problem.
   my $order;
-  $order   = SL::DB::Manager::Order->find_by(id => $::form->{id}) if $::form->{id};
+  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
   $order ||= SL::DB::Order->new(orderitems => [],
                                 quotation  => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type())));
 
@@ -1383,7 +1383,7 @@ sub recalc {
                                 tax       => $tax });
   }
 
-  pairwise { $a->{linetotal} = $b->{linetotal} } @{$self->order->items}, @{$pat{items}};
+  pairwise { $a->{linetotal} = $b->{linetotal} } @{$self->order->items_sorted}, @{$pat{items}};
 }
 
 # get data for saving, printing, ..., that is not changed in the form