X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPriceSource.pm;h=66daad285bdbce31dd0598338786ef0fd5de38a8;hb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44;hp=681210c00b2cd551662fa7667220dc2b12b752dd;hpb=d770b5b35198be42302e929a85a24f104b5dfd8c;p=kivitendo-erp.git diff --git a/SL/PriceSource.pm b/SL/PriceSource.pm index 681210c00..66daad285 100644 --- a/SL/PriceSource.pm +++ b/SL/PriceSource.pm @@ -31,6 +31,17 @@ sub price_from_source { : empty_price(); } +sub discount_from_source { + my ($self, $source) = @_; + my ($source_name, $spec) = split m{/}, $source, 2; + + my $class = SL::PriceSource::ALL->price_source_class_by_name($source_name); + + return $class + ? $class->new(record_item => $self->record_item, record => $self->record)->discount_from_source($source, $spec) + : empty_discount(); +} + sub available_prices { map { $_->available_prices } $_[0]->all_price_sources; } @@ -54,6 +65,12 @@ sub empty_price { ); } +sub empty_discount { + SL::PriceSource::Discount->new( + description => t8('None (PriceSource Discount)'), + ); +} + 1; __END__ @@ -136,25 +153,43 @@ not have to be registered in C. Attempts to retrieve a formerly calculated price with the same conditions +=item C + +Attempts to retrieve a formerly calculated discount with the same conditions + =item C Returns all available prices. +=item C + +Returns all available discounts. + =item C Attempts to get the best available price. returns L if no price is found. +=item C + +Attempts to get the best available discount. returns L if no discount is found. + =item C A special empty price, that does not change the previously entered price, and opens the price field to manual changes. +=item C + +A special empty discount, that does not change the previously entered discount, and +opens the discount field to manual changes. + =back =head1 SEE ALSO L, L, +L, L =head1 BUGS AND CAVEATS