Revision 89b26688
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/PriceSource/Base.pm | ||
---|---|---|
13 | 13 |
|
14 | 14 |
sub available_prices { die 'available_prices needs to be implemented' } |
15 | 15 |
|
16 |
sub available_discounts { die 'available_discounts needs to be implemented' } |
|
17 |
|
|
16 | 18 |
sub best_price { die 'best_price needs to be implemented' } |
17 | 19 |
|
20 |
sub best_discounts { die 'best_discounts needs to be implemented' } |
|
21 |
|
|
18 | 22 |
sub price_from_source { die 'price_from_source needs to be implemented:' . "@_" } |
19 | 23 |
|
20 | 24 |
sub part { |
21 | 25 |
$_[0]->record_item->part; |
22 | 26 |
} |
23 | 27 |
|
28 |
sub customer_vendor { |
|
29 |
$_[0]->record->is_sales ? $_[0]->record->customer : $_[0]->record->vendor; |
|
30 |
} |
|
31 |
|
|
24 | 32 |
1; |
25 | 33 |
|
26 | 34 |
__END__ |
... | ... | |
98 | 106 |
|
99 | 107 |
Shortcut to C<< record_item->part >> |
100 | 108 |
|
109 |
=item C<customer_vendor> |
|
110 |
|
|
111 |
Shortcut to C<< record->is_sales ? record->customer : record->vendor >> |
|
112 |
|
|
101 | 113 |
=back |
102 | 114 |
|
103 | 115 |
=head1 INTERFACE METHODS |
... | ... | |
121 | 133 |
to recreate it later. Try to be brief, no one needs 20 different price |
122 | 134 |
suggestions. |
123 | 135 |
|
136 |
=item C<available_discounts> |
|
137 |
|
|
138 |
Must return a list of all prices that you algorithm can recommend the user |
|
139 |
for the current situation. Each discount must have a unique spec that can be |
|
140 |
used to recreate it later. Try to be brief, no one needs 20 different discount |
|
141 |
suggestions. |
|
142 |
|
|
124 | 143 |
=item C<best_price> |
125 | 144 |
|
126 | 145 |
Must return what you think of as the best matching price in your |
127 | 146 |
C<available_prices>. This does not have to be the lowest price, but it will be |
128 | 147 |
compared later to other price sources, and the lowest will be set. |
129 | 148 |
|
149 |
=item C<best_discount> |
|
150 |
|
|
151 |
Must return what you think of as the best matching discount in your |
|
152 |
C<available_discounts>. This does not have to be the highest discount, but it |
|
153 |
will be compared later to other price sources, and the highest will be set. |
|
154 |
|
|
130 | 155 |
=item C<price_from_source SOURCE, SPEC> |
131 | 156 |
|
132 |
Must recreate the price from C<SPEC> and return. For reference, the complete |
|
133 |
C<SOURCE> entry from C<record_item.active_price_source> is included. |
|
157 |
Must recreate the price or discount from C<SPEC> and return. For reference, the |
|
158 |
complete C<SOURCE> entry from C<record_item.active_price_source> or |
|
159 |
C<record_item.active_discount_source> is included. |
|
134 | 160 |
|
135 | 161 |
Note that constraints from the rest of the C<record> do not apply anymore. If |
136 | 162 |
information needed for the retrieval can be deleted elsewhere, then you must |
Auch abrufbar als: Unified diff
PriceSource: Rabattbehandlung