diff options
Diffstat (limited to 'FS/FS/part_event/Condition/pkg_contract_date.pm')
-rw-r--r-- | FS/FS/part_event/Condition/pkg_contract_date.pm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/FS/FS/part_event/Condition/pkg_contract_date.pm b/FS/FS/part_event/Condition/pkg_contract_date.pm new file mode 100644 index 0000000..9cb75f6 --- /dev/null +++ b/FS/FS/part_event/Condition/pkg_contract_date.pm @@ -0,0 +1,34 @@ +package FS::part_event::Condition::pkg_contract_date; +use base qw( FS::part_event::Condition ); + +use strict; + +sub description { + 'Package contract date nearing'; +} + +sub eventtable_hashref { + { + 'cust_pkg' => 1, + }; +} + +sub option_fields { + my $class = shift; + ( + 'within' => { 'label' => 'Package contract date with in', + 'type' => 'freq', + }, + ); +} + +sub condition { + my( $self, $cust_pkg, %opt ) = @_; + + my $contract_end_date = $cust_pkg->contract_end ? $cust_pkg->contract_end : 0; + my $contract_within_time = $self->option_age_from('within', $contract_end_date ); + + $opt{'time'} >= $contract_within_time and $contract_within_time > 0; +} + +1;
\ No newline at end of file |