X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPriceSource%2FPricegroup.pm;h=532b1fffa3530d029a330e855e51635c09cfb08b;hb=d64013f4ba48d1f34e1d55f8c5f98d0ab2b5ed2b;hp=2a8adae13395a5beae6668ea4994f16ffae974e3;hpb=a87694dc525b4eabff11029f1e5401621e2bd3bc;p=kivitendo-erp.git diff --git a/SL/PriceSource/Pricegroup.pm b/SL/PriceSource/Pricegroup.pm index 2a8adae13..532b1fffa 100644 --- a/SL/PriceSource/Pricegroup.pm +++ b/SL/PriceSource/Pricegroup.pm @@ -23,7 +23,7 @@ sub available_prices { my $prices = SL::DB::Manager::Price->get_all( query => [ parts_id => $item->parts_id, price => { gt => 0 } ], with_objects => 'pricegroup', - order_by => 'pricegroup.id', + sort_by => 'pricegroup.id', ); return () unless @$prices; @@ -44,6 +44,8 @@ sub price_from_source { return $self->make_price($price); } +sub discount_from_source { } + sub best_price { my ($self, %params) = @_; @@ -52,9 +54,9 @@ sub best_price { my @prices = $self->available_prices; my $customer = $self->record->customer; - return () if !$customer || !$customer->klass; + return () if !$customer || !$customer->pricegroup_id; - my $best_price = first { $_->spec == $customer->klass } @prices; + my $best_price = first { $_->spec == $customer->pricegroup_id } @prices; return $best_price || (); }