X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/89b2668811eac6023ad58322e2f9970ddb6a27c9..77061a7b4a39fe5fedbc1186bf9f048e78627cde:/SL/PriceSource.pm 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 {