summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authormark <mark>2010-10-12 01:15:17 +0000
committermark <mark>2010-10-12 01:15:17 +0000
commit29472410e3b882a6a6b74fe48d28db411fe8fcff (patch)
tree727d1670a720d424ec2b5c5e3480657c992bcb44 /FS
parentfa5a1ac184e1fa9448453655b7e1f8e1297ef3b6 (diff)
package contract end date field, RT#9918
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Schema.pm1
-rw-r--r--FS/FS/cust_pkg.pm8
-rw-r--r--FS/FS/part_pkg/flat.pm11
3 files changed, 18 insertions, 2 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index a6018435e..6a987ceb1 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1303,6 +1303,7 @@ sub tables_hashref {
'adjourn', @date_type, '', '',
'cancel', @date_type, '', '',
'expire', @date_type, '', '',
+ 'contract_end', @date_type, '', '',
'change_date', @date_type, '', '',
'change_pkgnum', 'int', 'NULL', '', '', '',
'change_pkgpart', 'int', 'NULL', '', '', '',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 3e37ec9e9..ebc94e7eb 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -153,6 +153,10 @@ date
date
+=item contract_end
+
+date
+
=item cancel
date
@@ -259,7 +263,7 @@ sub insert {
$self->start_date( timelocal_nocheck(0,0,0,1,$mon,$year) );
}
- foreach my $action ( qw(expire adjourn) ) {
+ foreach my $action ( qw(expire adjourn contract_end) ) {
my $months = $self->part_pkg->option("${action}_months",1);
if($months and !$self->$action) {
my $start = $self->start_date || $self->setup || time;
@@ -2806,7 +2810,7 @@ sub search {
"NOT (".FS::cust_pkg->onetime_sql . ")";
}
else {
- foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
+ foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel )) {
next unless exists($params->{$field});
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index 975e80ab3..c52f96e12 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -20,6 +20,11 @@ tie my %temporalities, 'Tie::IxHash',
'preceding' => "Preceding (past)",
;
+tie my %contract_years, 'Tie::IxHash', (
+ '(none)' => '',
+ map { $_*12 => $_ } (1..5),
+);
+
%usage_fields = (
'seconds' => { 'name' => 'Time limit for this package',
@@ -117,6 +122,11 @@ tie my %temporalities, 'Tie::IxHash',
},
'adjourn_months'=> { 'name' => 'Auto-add a suspension date this number of months out',
},
+ 'contract_end_months'=> {
+ 'name' => 'Auto-add a contract end date this number of years out',
+ 'type' => 'select',
+ 'select_options' => \%contract_years,
+ },
#used in cust_pkg.pm so could add to any price plan where it made sense
'start_1st' => { 'name' => 'Auto-add a start date to the 1st, ignoring the current month.',
'type' => 'checkbox',
@@ -141,6 +151,7 @@ tie my %temporalities, 'Tie::IxHash',
'fieldorder' => [ qw( setup_fee recur_fee
recur_temporality unused_credit
expire_months adjourn_months
+ contract_end_months
start_1st sync_bill_date
unsuspend_adjust_bill
),