X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FPriceSource%2FPricegroup.pm;h=532b1fffa3530d029a330e855e51635c09cfb08b;hb=d38eaef8d62fc0826fa963c0ebea4fced33f5410;hp=127ec660e3036d7ae54b8ba65f5abe37a1c5d446;hpb=df1b03d578280d71fb839b437505dd283f6dd749;p=kivitendo-erp.git diff --git a/SL/PriceSource/Pricegroup.pm b/SL/PriceSource/Pricegroup.pm index 127ec660e..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 => 'pricegroun.id', + sort_by => 'pricegroup.id', ); return () unless @$prices; @@ -33,6 +33,8 @@ sub available_prices { } @$prices; } +sub available_discounts { } + sub price_from_source { my ($self, $source, $spec) = @_; @@ -42,6 +44,8 @@ sub price_from_source { return $self->make_price($price); } +sub discount_from_source { } + sub best_price { my ($self, %params) = @_; @@ -50,13 +54,15 @@ 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 || (); } +sub best_discount { } + sub make_price { my ($self, $price_obj) = @_;