Auftrags-Controller: customer/vendor als Methode in einer Variablen ablegen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 7 Sep 2015 13:13:09 +0000 (15:13 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Mon, 16 Nov 2015 15:15:57 +0000 (16:15 +0100)
SL/Controller/Order.pm

index 637df37..4dac30b 100644 (file)
@@ -140,7 +140,8 @@ sub action_add_item {
   $item->assign_attributes(%$form_attr);
 
   my $part        = SL::DB::Part->new(id => $form_attr->{parts_id})->load;
-  my $cv_discount = $self->order->customer? $self->order->customer->discount : 0.0;
+  my $cv_method   = $self->cv;
+  my $cv_discount = $self->order->$cv_method? $self->order->$cv_method->discount : 0.0;
 
   my %new_attr;
   $new_attr{part}        = $part;