From 18430ed0fb606a05154a7ca748d9a2b85d158fb0 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 15 Jan 2014 16:05:37 -0800 Subject: [PATCH] add customer class event condition, RT#26997 --- FS/FS/part_event/Condition/cust_class.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 FS/FS/part_event/Condition/cust_class.pm diff --git a/FS/FS/part_event/Condition/cust_class.pm b/FS/FS/part_event/Condition/cust_class.pm new file mode 100644 index 000000000..791bb6378 --- /dev/null +++ b/FS/FS/part_event/Condition/cust_class.pm @@ -0,0 +1,29 @@ +package FS::part_event::Condition::cust_class; +use base qw( FS::part_event::Condition ); + +use strict; + +sub description { + 'Customer class'; +} + +sub option_fields { + ( + 'cust_class' => { 'label' => 'Customer Class', + 'type' => 'select-cust_class', + 'multiple' => 1, + }, + ); +} + +sub condition { + my( $self, $object ) = @_; + + my $cust_main = $self->cust_main($object); + + my $hashref = $self->option('cust_class') || {}; + + $hashref->{ $cust_main->classnum }; +} + +1; -- 2.11.0