1 package SL::PriceSource::Price;
5 use parent 'SL::DB::Object';
6 use Rose::Object::MakeMethods::Generic (
7 scalar => [ qw(price description spec price_source invalid missing) ],
10 use SL::DB::Helper::Attr;
11 SL::DB::Helper::Attr::make(__PACKAGE__,
12 price => 'numeric(15,5)',
17 ? $_[0]->price_source->name . '/' . $_[0]->spec
21 sub full_description {
25 ? $self->price_source->description . ': ' . $self->description
29 sub source_description {
33 ? $self->price_source->description
38 "source: @{[ $_[0]->source ]}, price: @{[ $_[0]->price]}, description: @{[ $_[0]->description ]}"
49 SL::PriceSource::Price - contrainer to pass calculated prices around
53 # in PriceSource::Base implementation
54 $price = SL::PriceSource::Price->new(
56 spec => '10.3', # something you can easily parse later
57 description => t8('Fix price 10.3'),
58 price_source => $self,
61 # special empty price in SL::PriceSource
62 SL::PriceSource::Price->new(
63 description => t8('None (PriceSource)'),
67 SL::PriceSource::Price->new(
68 price => $original_price,
69 spec => $original_spec,
70 description => $original_description,
71 invalid => t8('Offer expired #1 weeks ago', $dt->delta_weeks),
72 price_source => $self,
76 SL::PriceSource::Price->new(
77 price => $original_price, # will keep last entered price
78 spec => $original_spec,
80 missing => t8('Um, sorry, cannot find that one'),
81 price_source => $self,
87 See L<SL::PriceSource> for information about the mechanism.
89 This is a container for prices that are generated by L<SL::PriceSource::Base>
92 =head1 CONSTRUCTOR FIELDS
98 The price. A price of 0 is special and is considered undesirable. If passed as
99 part of C<available_prices> it will be filtered out. If returned as
100 C<best_price> or C<price_from_source> it will be warned about.
104 A unique string that can later be understood by the creating implementation.
105 Can be empty if the implementation only supports one price for a given
110 A localized short description of the origins of this price.
112 =item C<price_source>
114 A ref to the creating algorithm.
118 OPTIONAL. Both indicator and localized message that the price with this spec
119 could not be reproduced and should be changed.
123 OPTIONAL. Both indicator and localized message that the conditions for this
124 price are no longer valid, and that the price should be changed.
131 L<SL::PriceSource::Base>,
132 L<SL::PriceSource::ALL>
140 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>