dbconnect_noauto entfernt
[kivitendo-erp.git] / SL / PriceSource / Pricegroup.pm
index 127ec66..532b1ff 100644 (file)
@@ -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) = @_;