add customer class event condition, RT#26997
authorIvan Kohler <ivan@freeside.biz>
Thu, 16 Jan 2014 00:05:37 +0000 (16:05 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 16 Jan 2014 00:05:37 +0000 (16:05 -0800)
FS/FS/part_event/Condition/cust_class.pm [new file with mode: 0644]

diff --git a/FS/FS/part_event/Condition/cust_class.pm b/FS/FS/part_event/Condition/cust_class.pm
new file mode 100644 (file)
index 0000000..791bb63
--- /dev/null
@@ -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;