From 52281cbeaf8d4e02345eca3c1aa0500133823558 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 18 Oct 2006 23:07:08 +0000 Subject: suspension and cancellation reasons --- FS/FS/part_bill_event.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'FS/FS/part_bill_event.pm') diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm index 473e0bd..3f49d29 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 -- cgit v1.1