diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/part_event/Condition/pkg_not_reason_type.pm | 58 | ||||
-rw-r--r-- | FS/FS/part_event/Condition/pkg_reason_type.pm | 58 |
2 files changed, 116 insertions, 0 deletions
diff --git a/FS/FS/part_event/Condition/pkg_not_reason_type.pm b/FS/FS/part_event/Condition/pkg_not_reason_type.pm new file mode 100644 index 000000000..3fa08b762 --- /dev/null +++ b/FS/FS/part_event/Condition/pkg_not_reason_type.pm @@ -0,0 +1,58 @@ +package FS::part_event::Condition::pkg_not_reason_type; +use base qw( FS::part_event::Condition ); + +use strict; +use Tie::IxHash; +#use FS::Record qw( qsearch ); + +sub description { + 'Package Not Reason Type'; +} + +sub eventtable_hashref { + { 'cust_main' => 0, + 'cust_bill' => 0, + 'cust_pkg' => 1, + 'svc_acct' => 1, + }; +} + +tie my %actions, 'Tie::IxHash', + #'adjourn' => + 'susp' => 'Suspension', + #'expire' => + 'cancel' => 'Cancellation' +; + +sub option_fields { + ( + 'action' => { 'label' => 'Package Action', + 'type' => 'select', + 'options' => [ keys %actions ], + 'labels' => \%actions, + }, + 'typenum' => { 'label' => 'Not Reason Type', + 'type' => 'select-reason_type', + 'multiple' => 1, + }, + ); +} + +sub condition { + my( $self, $object ) = @_; + + my $cust_pkg = $self->cust_pkg($object); + + my $reason = $cust_pkg->last_reason( $self->option('action') ) + or return 0; + + my $hashref = $self->option('typenum') || {}; + ! $hashref->{ $reason->reason_type }; +} + +#sub condition_sql { +# my( $self, $table ) = @_; +# +#} + +1; diff --git a/FS/FS/part_event/Condition/pkg_reason_type.pm b/FS/FS/part_event/Condition/pkg_reason_type.pm new file mode 100644 index 000000000..f110e1b04 --- /dev/null +++ b/FS/FS/part_event/Condition/pkg_reason_type.pm @@ -0,0 +1,58 @@ +package FS::part_event::Condition::pkg_reason_type; +use base qw( FS::part_event::Condition ); + +use strict; +use Tie::IxHash; +#use FS::Record qw( qsearch ); + +sub description { + 'Package Reason Type'; +} + +sub eventtable_hashref { + { 'cust_main' => 0, + 'cust_bill' => 0, + 'cust_pkg' => 1, + 'svc_acct' => 1, + }; +} + +tie my %actions, 'Tie::IxHash', + #'adjourn' => + 'susp' => 'Suspension', + #'expire' => + 'cancel' => 'Cancellation' +; + +sub option_fields { + ( + 'action' => { 'label' => 'Package Action', + 'type' => 'select', + 'options' => [ keys %actions ], + 'labels' => \%actions, + }, + 'typenum' => { 'label' => 'Reason Type', + 'type' => 'select-reason_type', + 'multiple' => 1, + }, + ); +} + +sub condition { + my( $self, $object ) = @_; + + my $cust_pkg = $self->cust_pkg($object); + + my $reason = $cust_pkg->last_reason( $self->option('action') ) + or return 0; + + my $hashref = $self->option('typenum') || {}; + $hashref->{ $reason->reason_type }; +} + +#sub condition_sql { +# my( $self, $table ) = @_; +# +#} + +1; |