multi-currency, RT#21565
[freeside.git] / FS / FS / part_pkg / flat.pm
index f86db2e..9737a94 100644 (file)
@@ -122,7 +122,7 @@ sub calc_setup {
 
   my $quantity = $cust_pkg->quantity || 1;
 
-  my $charge = $quantity * $self->unit_setup($cust_pkg, $sdate, $details);
+  my $charge = $quantity * $self->base_setup($cust_pkg, $sdate, $details);
 
   my $discount = 0;
   if ( $charge > 0 ) {
@@ -134,7 +134,7 @@ sub calc_setup {
   sprintf('%.2f', $charge - $discount);
 }
 
-sub unit_setup {
+sub base_setup {
   my($self, $cust_pkg, $sdate, $details ) = @_;
 
   $self->option('setup_fee') || 0;
@@ -151,8 +151,9 @@ sub calc_recur {
     if $self->recur_temporality eq 'preceding' && !$last_bill;
 
   my $charge = $self->base_recur($cust_pkg, $sdate);
-  if ( my $cutoff_day = $self->cutoff_day($cust_pkg) ) {
-    $charge = $self->calc_prorate(@_, $cutoff_day);
+  # always treat cutoff_day as a list
+  if ( my @cutoff_day = $self->cutoff_day($cust_pkg) ) {
+    $charge = $self->calc_prorate(@_, @cutoff_day);
   }
   elsif ( $param->{freq_override} ) {
     # XXX not sure if this should be mutually exclusive with sync_bill_date.
@@ -177,7 +178,7 @@ sub cutoff_day {
       return (localtime($next_bill))[3];
     }
   }
-  return 0;
+  return ();
 }
 
 sub base_recur {