Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / PriceSource / Base.pm
index 513f3d4..8cc3888 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 
 use parent qw(SL::DB::Object);
 use Rose::Object::MakeMethods::Generic (
-  scalar => [ qw(record_item record) ],
+  scalar => [ qw(record_item record fast) ],
 );
 
 sub name { die 'name needs to be implemented' }
@@ -21,6 +21,8 @@ sub best_discounts { die 'best_discounts needs to be implemented' }
 
 sub price_from_source { die 'price_from_source needs to be implemented:' . "@_" }
 
+sub discount_from_source { die 'discount_from_source needs to be implemented:' . "@_" }
+
 sub part {
   $_[0]->record_item->part;
 }
@@ -123,19 +125,19 @@ L<SL::PriceSource::ALL>.
 
 =item C<description>
 
-Must return a translated name to be used in frontend. Will be used, to
+Must return a translated name to be used in the frontend. Will be used to
 distinguish the origin of different prices.
 
 =item C<available_prices>
 
-Must return a list of all prices that you algorithm can recommend the user
+Must return a list of all prices that your algorithm can recommend to the user
 for the current situation. Each price must have a unique spec that can be used
 to recreate it later. Try to be brief, no one needs 20 different price
 suggestions.
 
 =item C<available_discounts>
 
-Must return a list of all prices that you algorithm can recommend the user
+Must return a list of all prices that your algorithm can recommend to the user
 for the current situation. Each discount must have a unique spec that can be
 used to recreate it later. Try to be brief, no one needs 20 different discount
 suggestions.
@@ -162,7 +164,7 @@ Note that constraints from the rest of the C<record> do not apply anymore. If
 information needed for the retrieval can be deleted elsewhere, then you must
 guard against that.
 
-If the price for the same coditions changed, return the new price. It will be
+If the price for the same conditions changed, return the new price. It will be
 presented as an option to the user if the record is still editable.
 
 If the price is not valid anymore or not reconstructable, return a price with
@@ -178,7 +180,7 @@ C<invalid> or C<missing> set.
 =item *
 
 Be aware that all 8 types of record will be passed to your algorithm. If you
-don't serve some of them, just return emptry lists on C<available_prices> and
+don't serve some of them, just return empty lists on C<available_prices> and
 C<best_price>
 
 =item *
@@ -189,7 +191,7 @@ created records there might be fields not set at all.
 =item *
 
 Records will not be calculated. If you need tax data or position totals, you
-need to invoke that for yourself.
+need to invoke that yourself.
 
 =item *
 
@@ -198,7 +200,7 @@ Accessor methods might not be present in some of the record types.
 =item *
 
 You do not need to do price factor and row discount calculation. These will be
-done automatically afterwards. You do have to include customer/vendor discount
+done automatically afterwards. You do have to include customer/vendor discounts
 if your price interacts with those.
 
 =item *