referral credits overhaul, use billing events, agents can self-configure, limit to...
[freeside.git] / FS / FS / part_event / Condition / pkg_unless_pkgpart.pm
diff --git a/FS/FS/part_event/Condition/pkg_unless_pkgpart.pm b/FS/FS/part_event/Condition/pkg_unless_pkgpart.pm
new file mode 100644 (file)
index 0000000..47fa8c3
--- /dev/null
@@ -0,0 +1,39 @@
+package FS::part_event::Condition::pkg_unless_pkgpart;
+
+use strict;
+
+use base qw( FS::part_event::Condition );
+
+sub description { 'Except package definitions'; }
+
+sub eventtable_hashref {
+    { 'cust_main' => 0,
+      'cust_bill' => 0,
+      'cust_pkg'  => 1,
+    };
+}
+
+sub option_fields {
+  ( 
+    'unless_pkgpart' => { 'label'    => 'Except packages: ',
+                          'type'     => 'select-part_pkg',
+                          'multiple' => 1,
+                        },
+  );
+}
+
+sub condition {
+  my( $self, $cust_pkg) = @_;
+
+  #XXX test
+  my $unless_pkgpart = $self->option('unless_pkgpart') || {};
+  ! $unless_pkgpart->{ $cust_pkg->pkgpart };
+
+}
+
+#XXX
+#sub condition_sql {
+#
+#}
+
+1;