X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fpart_pkg%2Frecur_Common.pm;h=729fb61259df6348fc906d1c71fabe5e6be04d16;hb=929783d1045757abbe5c84ff2439547b0f8eca23;hp=03d5c2cb2205f97afd28e01f5cc44516558fd095;hpb=e881063d6e46d991003cf8fae96d8d36780fedcd;p=freeside.git diff --git a/FS/FS/part_pkg/recur_Common.pm b/FS/FS/part_pkg/recur_Common.pm index 03d5c2cb2..729fb6125 100644 --- a/FS/FS/part_pkg/recur_Common.pm +++ b/FS/FS/part_pkg/recur_Common.pm @@ -34,20 +34,26 @@ sub calc_setup { delete $param->{'setup_charge'}; } - sprintf('%.2f', $charge - $discount); + sprintf('%.2f', ($cust_pkg->quantity || 1) * ($charge - $discount) ); } sub cutoff_day { # prorate/subscription only; we don't support sync_bill_date here my( $self, $cust_pkg ) = @_; my $recur_method = $self->option('recur_method',1) || 'anniversary'; - return () unless $recur_method eq 'prorate' - || $recur_method eq 'subscription'; + my $cust_main = $cust_pkg->cust_main; - #false laziness w/prorate.pm::cutoff_day - my $prorate_day = $cust_pkg->cust_main->prorate_day; - $prorate_day ? ( $prorate_day ) - : split(/\s*,\s*/, $self->option('cutoff_day', 1) || '1'); + return ( $cust_main->prorate_day ) + if $cust_main->prorate_day and ( $cust_main->force_prorate_day + || $recur_method eq 'prorate' + || $recur_method eq 'subscription' + ); + + return split(/\s*,\s*/, $self->option('cutoff_day', 1) || '1') + if $recur_method eq 'prorate' + || $recur_method eq 'subscription'; + + return (); } sub calc_recur_Common { @@ -61,7 +67,7 @@ sub calc_recur_Common { my $recur_method = $self->option('recur_method', 1) || 'anniversary'; my @cutoff_day = $self->cutoff_day($cust_pkg); - $charges = $self->base_recur($cust_pkg); + $charges = $self->base_recur($cust_pkg, $sdate, $details, $param); $charges += $param->{'override_charges'} if $param->{'override_charges'}; if ( $recur_method eq 'prorate' ) {