X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPriceSource.pm;h=89dffba89c8de659730e1aad256ec17eaa9c3129;hb=375f824f70509fa537c4342c4a0d14204f35e767;hp=e7a5906dd2f968b750b6ac9aae7c39e1fc792cd2;hpb=89b2668811eac6023ad58322e2f9970ddb6a27c9;p=kivitendo-erp.git diff --git a/SL/PriceSource.pm b/SL/PriceSource.pm index e7a5906dd..89dffba89 100644 --- a/SL/PriceSource.pm +++ b/SL/PriceSource.pm @@ -35,15 +35,16 @@ sub available_prices { } sub available_discounts { + return if $_[0]->record_item->part->not_discountable; map { $_->available_discounts } $_[0]->all_price_sources; } sub best_price { - min_by { $_->price } grep { $_->price > 0 } grep { $_ } map { $_->best_price } $_[0]->all_price_sources; + min_by { $_->price } max_by { $_->priority } grep { $_->price > 0 } grep { $_ } map { $_->best_price } $_[0]->all_price_sources; } sub best_discount { - max_by { $_->discount } grep { $_->discount } grep { $_ } map { $_->best_discount } $_[0]->all_price_sources; + max_by { $_->discount } max_by { $_->priority } grep { $_->discount } grep { $_ } map { $_->best_discount } $_[0]->all_price_sources; } sub empty_price {