summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-07-02 02:02:46 +0000
committerivan <ivan>2009-07-02 02:02:46 +0000
commit8db53bcb53bbb32855c38f62afa4d1b39777cb7d (patch)
tree4e90bbb357c289ae1db365bf4fc9dcd2869cdb0f
parent883f6c25e41831d9183e9500accb89f4cb23ae73 (diff)
fix late fees, RT#5665
-rw-r--r--FS/FS/cust_main.pm2
-rw-r--r--FS/FS/part_event/Action/cust_bill_fee_percent.pm11
-rw-r--r--FS/FS/part_event/Action/fee.pm11
3 files changed, 17 insertions, 7 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 1e4351931..a1b891226 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -6790,7 +6790,7 @@ sub charge {
$setuptax = exists($_[0]->{setuptax}) ? $_[0]->{setuptax} : '';
$taxclass = exists($_[0]->{taxclass}) ? $_[0]->{taxclass} : '';
$classnum = exists($_[0]->{classnum}) ? $_[0]->{classnum} : '';
- $additional = $_[0]->{additional};
+ $additional = $_[0]->{additional} || [];
$taxproduct = $_[0]->{taxproductnum};
$override = { '' => $_[0]->{tax_override} };
} else {
diff --git a/FS/FS/part_event/Action/cust_bill_fee_percent.pm b/FS/FS/part_event/Action/cust_bill_fee_percent.pm
index c6f37265a..354778f7d 100644
--- a/FS/FS/part_event/Action/cust_bill_fee_percent.pm
+++ b/FS/FS/part_event/Action/cust_bill_fee_percent.pm
@@ -14,6 +14,7 @@ sub option_fields {
'percent' => { label=>'Percent', size=>2, },
'reason' => 'Reason',
'taxclass' => { label=>'Tax class', type=>'select-taxclass', },
+ 'nextbill' => { label=>'Hold late fee until next invoice', type=>'checkbox', value=>'Y' },
);
}
@@ -28,12 +29,16 @@ sub do_action {
my $amount =
sprintf('%.2f', $cust_bill->owed * $self->option('percent') / 100 );
- my $error = $cust_main->charge( {
+ my %charge = (
'amount' => $amount,
'pkg' => $self->option('reason'),
'taxclass' => $self->option('taxclass'),
- #'start_date' => $cust_main->next_bill_date, #unless its more than N months away?
- } );
+ );
+
+ $charge{'start_date'} = $cust_main->next_bill_date #unless its more than N months away?
+ if $self->option('nextbill');
+
+ my $error = $cust_main->charge( \%charge );
die $error if $error;
diff --git a/FS/FS/part_event/Action/fee.pm b/FS/FS/part_event/Action/fee.pm
index 7d07df5c7..6ea7103ab 100644
--- a/FS/FS/part_event/Action/fee.pm
+++ b/FS/FS/part_event/Action/fee.pm
@@ -10,6 +10,7 @@ sub option_fields {
'charge' => { label=>'Amount', type=>'money', }, # size=>7, },
'reason' => 'Reason',
'taxclass' => { label=>'Tax class', type=>'select-taxclass', },
+ 'nextbill' => { label=>'Hold late fee until next invoice', type=>'checkbox', value=>'Y' },
);
}
@@ -20,12 +21,16 @@ sub do_action {
my $cust_main = $self->cust_main($cust_object);
- my $error = $cust_main->charge( {
+ my %charge = (
'amount' => $self->option('charge'),
'pkg' => $self->option('reason'),
'taxclass' => $self->option('taxclass')
- #'start_date' => $cust_main->next_bill_date, #unless its more than N months away?
- } );
+ );
+
+ $charge{'start_date'} = $cust_main->next_bill_date #unless its more than N months away?
+ if $self->option('nextbill');
+
+ my $error = $cust_main->charge( \%charge );
die $error if $error;