clarify interface difference between calc_setup and calc_recur: calc_setup takes...
[freeside.git] / FS / FS / part_pkg / currency_fixed.pm
index bbd95e8..d4c1487 100644 (file)
@@ -39,24 +39,25 @@ sub price_info {
 }
 
 sub base_setup {
-  my($self, $cust_pkg, $sdate, $details, $param ) = @_;
+  my($self, $cust_pkg, $time, $details, $param ) = @_;
 
-  $self->calc_currency_option('setup_fee', $cust_pkg, $sdate, $details, $param);
+  $self->calc_currency_option('setup_fee', $cust_pkg, $time, $details, $param);
 }
 
 sub calc_setup {
-  my($self, $cust_pkg, $sdate, $details, $param) = @_;
+  my($self, $cust_pkg, $time, $details, $param) = @_;
 
-  return 0 if $self->prorate_setup($cust_pkg, $sdate);
+  return 0 if $self->prorate_setup($cust_pkg, $time);
 
-  $self->base_setup($cust_pkg, $sdate, $details, $param);
+  $self->base_setup($cust_pkg, $time, $details, $param);
 }
 
 use FS::Conf;
 sub calc_currency_option {
-  my($self, $optionname, $cust_pkg, $sdate, $details, $param) = @_;
+  my($self, $optionname, $cust_or_quotation_pkg, $time, $details, $param) = @_;
 
-  my($currency, $amount) = $cust_pkg->part_pkg_currency_option($optionname);
+  my($currency, $amount) =
+    $cust_or_quotation_pkg->part_pkg_currency_option($optionname);
   return sprintf('%.2f', $amount ) unless $currency;
 
   $param->{'billed_currency'} = $currency;
@@ -73,9 +74,10 @@ sub calc_currency_option {
 }
 
 sub base_recur {
-  my( $self, $cust_pkg, $sdate, $details, $param ) = @_;
-  $param ||= {};
-  $self->calc_currency_option('recur_fee', $cust_pkg, $sdate, $details, $param);
+  my( $self, $cust_or_quotation_pkg, $sdate, $details, $param ) = @_;
+  $self->calc_currency_option(
+    'recur_fee', $cust_or_quotation_pkg, $sdate, $details, $param || {}
+  );
 }
 
 sub can_discount { 0; } #can't discount yet (percentage would work, but amount?)