[freeside-commits] branch master updated. faf400898c4fa9d784c83c54b8a27309caacd62a

Ivan ivan at 420.am
Sun Nov 2 17:46:48 PST 2014


The branch, master has been updated
       via  faf400898c4fa9d784c83c54b8a27309caacd62a (commit)
      from  6d47b55c98b1a8e145a4b63579e148241c65b6ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit faf400898c4fa9d784c83c54b8a27309caacd62a
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Nov 2 17:46:47 2014 -0800

    add condition on lack of customer tag, RT#28784

diff --git a/FS/FS/part_event/Condition/hasnt_cust_tag.pm b/FS/FS/part_event/Condition/hasnt_cust_tag.pm
new file mode 100644
index 0000000..e56151d
--- /dev/null
+++ b/FS/FS/part_event/Condition/hasnt_cust_tag.pm
@@ -0,0 +1,49 @@
+package FS::part_event::Condition::hasnt_cust_tag;
+use base qw( FS::part_event::Condition );
+
+use strict;
+#use FS::Record qw( qsearch );
+
+sub description {
+  'Customer does not have (any selected) tag',
+}
+
+sub eventtable_hashref {
+    { 'cust_main' => 1,
+      'cust_bill' => 1,
+      'cust_pkg'  => 1,
+    };
+}
+
+sub option_fields {
+  (
+    'tagnum'  => { 'label'    => 'Customer tag',
+                   'type'     => 'select-cust_tag',
+                   'multiple' => 1,
+                 },
+  );
+}
+
+sub condition {
+  my( $self, $object ) = @_;
+
+  my $cust_main = $self->cust_main($object);
+
+  my $hashref = $self->option('tagnum') || {};
+  ! grep $hashref->{ $_->tagnum }, $cust_main->cust_tag;
+
+}
+
+sub condition_sql {
+  my( $self, $table ) = @_;
+
+  my $matching_tags = 
+    "SELECT tagnum FROM cust_tag WHERE cust_tag.custnum = $table.custnum".
+    " AND cust_tag.tagnum IN ".
+    $self->condition_sql_option_option_integer('tagnum');
+
+  "NOT EXISTS($matching_tags)";
+}
+
+1;
+

-----------------------------------------------------------------------

Summary of changes:
 .../Condition/{has_cust_tag.pm => hasnt_cust_tag.pm}   |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
 copy FS/FS/part_event/Condition/{has_cust_tag.pm => hasnt_cust_tag.pm} (77%)




More information about the freeside-commits mailing list