summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/part_pkg/prepaid.pm24
-rw-r--r--FS/bin/freeside-prepaidd12
2 files changed, 25 insertions, 11 deletions
diff --git a/FS/FS/part_pkg/prepaid.pm b/FS/FS/part_pkg/prepaid.pm
index 5e7d2baae..ca4acb564 100644
--- a/FS/FS/part_pkg/prepaid.pm
+++ b/FS/FS/part_pkg/prepaid.pm
@@ -1,20 +1,30 @@
package FS::part_pkg::prepaid;
use strict;
-use vars qw(@ISA %info);
+use vars qw(@ISA %info %recur_action);
+use Tie::IxHash;
use FS::part_pkg::flat;
@ISA = qw(FS::part_pkg::flat);
+tie %recur_action, 'Tie::IxHash',
+ 'suspend' => 'suspend',
+ 'cancel' => 'cancel',
+;
+
%info = (
'name' => 'Prepaid, flat rate',
'fields' => {
- 'setup_fee' => { 'name' => 'One-time setup fee for this package',
- 'default' => 0,
- },
- 'recur_fee' => { 'name' => 'Initial and recharge fee for this package',
- 'default' => 0,
- }
+ 'setup_fee' => { 'name' => 'One-time setup fee for this package',
+ 'default' => 0,
+ },
+ 'recur_fee' => { 'name' => 'Initial and recharge fee for this package',
+ 'default' => 0,
+ },
+ 'recur_action' => { 'name' => 'Action to take upon reaching end of prepaid preiod',
+ 'type' => 'select',
+ 'select_options' => \%recur_action,
+ },
},
'fieldorder' => [ 'setup_fee', 'recur_fee', ],
'weight' => 25,
diff --git a/FS/bin/freeside-prepaidd b/FS/bin/freeside-prepaidd
index e51a56350..1f5731626 100644
--- a/FS/bin/freeside-prepaidd
+++ b/FS/bin/freeside-prepaidd
@@ -37,8 +37,12 @@ while (1) {
" AND ( cancel IS NULL OR cancel = 0)"
} )
) {
- my $error = $cust_pkg->suspend;
- warn "Error suspended package ". $cust_pkg->pkgnum.
+
+ my $action = $cust_pkg->part_pkg->option('recur_action') || 'suspend';
+
+ my $error = $cust_pkg->$action();
+
+ warn "Error ${action}ing package ". $cust_pkg->pkgnum.
" for custnum ". $cust_pkg->custnum.
": $error\n"
if $error;
@@ -65,8 +69,8 @@ freeside-prepaidd - Real-time daemon for prepaid packages
=head1 DESCRIPTION
-Runs continuously and suspendes any prepaid customer packages which have
-passed their renewal date (next bill date).
+Runs continuously and suspends or cancels any prepaid customer packages which
+have passed their renewal date (next bill date).
=head1 SEE ALSO