Revision e1c3b6b7
Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt
SL/PriceSource.pm | ||
---|---|---|
31 | 31 |
: empty_price(); |
32 | 32 |
} |
33 | 33 |
|
34 |
sub discount_from_source { |
|
35 |
my ($self, $source) = @_; |
|
36 |
my ($source_name, $spec) = split m{/}, $source, 2; |
|
37 |
|
|
38 |
my $class = SL::PriceSource::ALL->price_source_class_by_name($source_name); |
|
39 |
|
|
40 |
return $class |
|
41 |
? $class->new(record_item => $self->record_item, record => $self->record)->discount_from_source($source, $spec) |
|
42 |
: empty_discount(); |
|
43 |
} |
|
44 |
|
|
34 | 45 |
sub available_prices { |
35 | 46 |
map { $_->available_prices } $_[0]->all_price_sources; |
36 | 47 |
} |
... | ... | |
54 | 65 |
); |
55 | 66 |
} |
56 | 67 |
|
68 |
sub empty_discount { |
|
69 |
SL::PriceSource::Discount->new( |
|
70 |
description => t8('None (PriceSource Discount)'), |
|
71 |
); |
|
72 |
} |
|
73 |
|
|
57 | 74 |
1; |
58 | 75 |
|
59 | 76 |
__END__ |
... | ... | |
136 | 153 |
|
137 | 154 |
Attempts to retrieve a formerly calculated price with the same conditions |
138 | 155 |
|
156 |
=item C<discount_from_source> |
|
157 |
|
|
158 |
Attempts to retrieve a formerly calculated discount with the same conditions |
|
159 |
|
|
139 | 160 |
=item C<available_prices> |
140 | 161 |
|
141 | 162 |
Returns all available prices. |
142 | 163 |
|
164 |
=item C<available_discounts> |
|
165 |
|
|
166 |
Returns all available discounts. |
|
167 |
|
|
143 | 168 |
=item C<best_price> |
144 | 169 |
|
145 | 170 |
Attempts to get the best available price. returns L<empty_price> if no price is found. |
146 | 171 |
|
172 |
=item C<best_discount> |
|
173 |
|
|
174 |
Attempts to get the best available discount. returns L<empty_discount> if no discount is found. |
|
175 |
|
|
147 | 176 |
=item C<empty_price> |
148 | 177 |
|
149 | 178 |
A special empty price, that does not change the previously entered price, and |
150 | 179 |
opens the price field to manual changes. |
151 | 180 |
|
181 |
=item C<empty_discount> |
|
182 |
|
|
183 |
A special empty discount, that does not change the previously entered discount, and |
|
184 |
opens the discount field to manual changes. |
|
185 |
|
|
152 | 186 |
=back |
153 | 187 |
|
154 | 188 |
=head1 SEE ALSO |
155 | 189 |
|
156 | 190 |
L<SL::PriceSource::Base>, |
157 | 191 |
L<SL::PriceSource::Price>, |
192 |
L<SL::PriceSource::Discount>, |
|
158 | 193 |
L<SL::PriceSource::ALL> |
159 | 194 |
|
160 | 195 |
=head1 BUGS AND CAVEATS |
Auch abrufbar als: Unified diff
PriceSources: discount_from_source analog zu price_from_source implemeniert.
Wenn keine zur Rabatt-Quelle passende Klasse gefunden werden kann, wird auch
hier ein spezieller leerer Rabatt zurückgeliefert.