summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorjeff <jeff>2006-10-18 23:07:08 +0000
committerjeff <jeff>2006-10-18 23:07:08 +0000
commit52281cbeaf8d4e02345eca3c1aa0500133823558 (patch)
treec0174e1f4b9fb952c7976db92d464b74d82cf11f /FS
parent609fe46a015c92be8a93c1b05a2fb67133bfd22b (diff)
suspension and cancellation reasons
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/AccessRight.pm2
-rw-r--r--FS/FS/Schema.pm52
-rw-r--r--FS/FS/part_bill_event.pm22
-rw-r--r--FS/MANIFEST8
4 files changed, 70 insertions, 14 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 6fdb0b0ce..64c4f6b38 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -107,6 +107,8 @@ assigned to users and/or groups.
'Unsuspend customer package',
'Cancel customer package immediately',
'Cancel customer package later',
+ 'Add on-the-fly cancel reason',
+ 'Add on-the-fly suspend reason',
###
# customer service rights
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 607b2d9f3..d6725fc5f 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -319,6 +319,7 @@ sub tables_hashref {
'weight', 'int', '', '', '', '',
'plan', 'varchar', 'NULL', $char_d, '', '',
'plandata', 'text', 'NULL', '', '', '',
+ 'reason', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'eventpart',
@@ -650,6 +651,19 @@ sub tables_hashref {
'index' => [ ['custnum'], ['pkgpart'] ],
},
+ 'cust_pkg_reason' => {
+ 'columns' => [
+ 'num', 'serial', '', '', '', '',
+ 'pkgnum', 'int', '', '', '', '',
+ 'reasonnum','int', '', '', '', '',
+ 'otaker', 'varchar', '', 32, '', '',
+ 'date', @date_type, '', '',
+ ],
+ 'primary_key' => 'num',
+ 'unique' => [],
+ 'index' => [],
+ },
+
'cust_refund' => {
'columns' => [
'refundnum', 'serial', '', '', '', '',
@@ -1352,17 +1366,6 @@ sub tables_hashref {
'index' => [],
},
- 'cancel_reason' => {
- 'columns' => [
- 'reasonnum', 'serial', '', '', '', '',
- 'reason', 'varchar', '', $char_d, '', '',
- 'disabled', 'char', 'NULL', 1, '', '',
- ],
- 'primary_key' => 'reasonnum',
- 'unique' => [],
- 'index' => [ [ 'disabled' ] ],
- },
-
'pkg_class' => {
'columns' => [
'classnum', 'serial', '', '', '', '',
@@ -1607,7 +1610,30 @@ sub tables_hashref {
'index' => [ [ 'countrycode', 'phonenum' ] ],
},
- };
+ 'reason_type' => {
+ 'columns' => [
+ 'typenum', 'serial', '', '', '', '',
+ 'class', 'char', '', 1, '', '',
+ 'type', 'varchar', '', $char_d, '', '',
+ ],
+ 'primary_key' => 'typenum',
+ 'unique' => [],
+ 'index' => [],
+ },
+
+ 'reason' => {
+ 'columns' => [
+ 'reasonnum', 'serial', '', '', '', '',
+ 'reason_type', 'int', '', '', '', '',
+ 'reason', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'reasonnum',
+ 'unique' => [],
+ 'index' => [],
+ },
+
+ # name type nullability length default local
#'new_table' => {
# 'columns' => [
@@ -1618,6 +1644,8 @@ sub tables_hashref {
# 'index' => [],
#},
+ };
+
}
=back
diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm
index 473e0bd46..3f49d292f 100644
--- a/FS/FS/part_bill_event.pm
+++ b/FS/FS/part_bill_event.pm
@@ -60,6 +60,8 @@ FS::Record. The following fields are currently supported:
=item plandata - additional plan data
+=item reason - an associated reason for this event to fire
+
=item disabled - Disabled flag, empty or `Y'
=back
@@ -161,6 +163,7 @@ sub check {
|| $self->ut_number('weight')
|| $self->ut_textn('plan')
|| $self->ut_anything('plandata')
+ || $self->ut_numbern('reason')
;
#|| $self->ut_snumber('seconds')
return $error if $error;
@@ -184,6 +187,9 @@ sub check {
}
}
+ my $reasonr = qsearchs('reason', {'reasonnum' => $self->reason});
+ return "Unknown reason" unless $reasonr;
+
$self->SUPER::check;
}
@@ -304,6 +310,22 @@ sub do_event {
'';
}
+=item reasontext
+
+Returns the text of any reason associated with this event.
+
+=cut
+
+sub reasontext {
+ my $self = shift;
+ my $r = qsearchs('reason', { 'reasonnum' => $self->reason });
+ if ($r){
+ $r->reason;
+ }else{
+ '';
+ }
+}
+
=back
=head1 BUGS
diff --git a/FS/MANIFEST b/FS/MANIFEST
index c67145b42..c14be0759 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -311,8 +311,6 @@ FS/agent_payment_gateway.pm
t/agent_payment_gateway.t
FS/banned_pay.pm
t/banned_pay.t
-FS/cancel_reason.pm
-t/cancel_reason.t
bin/freeside-prepaidd
FS/cdr.pm
t/cdr.t
@@ -358,3 +356,9 @@ FS/cust_credit_bill_pkg.pm
t/cust_credit_bill_pkg.t
FS/cust_main_note.pm
t/cust_main_note.t
+FS/cust_pkg_reason.pm
+t/cust_pkg_reason.t
+FS/reason.pm
+t/reason.t
+FS/reason_type.pm
+t/reason_type.t