[freeside-commits] branch FREESIDE_3_BRANCH updated. fd5d458eda666a60ec0cdf35e5cbdff438b4ed76

Christopher Burger burgerc at 420.am
Wed Jul 12 13:29:36 PDT 2017


The branch, FREESIDE_3_BRANCH has been updated
       via  fd5d458eda666a60ec0cdf35e5cbdff438b4ed76 (commit)
       via  109a0744cf4da3acec4c8638adc9f5771a56ed45 (commit)
      from  ce0dabc99cf469db3abc85800b23be8dfcdd5790 (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 fd5d458eda666a60ec0cdf35e5cbdff438b4ed76
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Wed Jul 12 13:21:55 2017 -0400

    RT# 76307 - changed from returning an error to die on error.

diff --git a/FS/FS/part_event/Action/addtag.pm b/FS/FS/part_event/Action/addtag.pm
index 947f0c3..c4e9820 100644
--- a/FS/FS/part_event/Action/addtag.pm
+++ b/FS/FS/part_event/Action/addtag.pm
@@ -42,9 +42,7 @@ sub do_action {
       my $cust_tag = new FS::cust_tag { 'tagnum'  => $tagnum,
                                         'custnum' => $object->custnum, };
       my $error = $cust_tag->insert;
-      if ( $error ) {
-        return $error;
-      }
+      die $error if $error;
     }
   }
   '';

commit 109a0744cf4da3acec4c8638adc9f5771a56ed45
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Jul 11 11:35:14 2017 -0400

    RT# 76307 - Added billing event action to add a tag

diff --git a/FS/FS/part_event/Action/addtag.pm b/FS/FS/part_event/Action/addtag.pm
new file mode 100644
index 0000000..947f0c3
--- /dev/null
+++ b/FS/FS/part_event/Action/addtag.pm
@@ -0,0 +1,53 @@
+package FS::part_event::Action::addtag;
+
+use strict;
+use base qw( FS::part_event::Action );
+use FS::Record qw( qsearch );
+
+sub description { 'Add customer tag'; }
+
+sub eventtable_hashref {
+    { 'cust_main'      => 1,
+      'cust_bill'      => 1,
+      'cust_pkg'       => 1,
+      'cust_pay'       => 1,
+      'cust_pay_batch' => 1,
+      'cust_statement' => 1,
+    };
+}
+
+sub option_fields {
+  (
+    'tagnum'  => { 'label'    => 'Customer tag',
+                   'type'     => 'select-cust_tag',
+                   'multiple' => 1,
+                 },
+  );
+}
+
+sub default_weight { 20; }
+
+sub do_action {
+  my( $self, $object, $tagnum ) = @_;
+
+  my %exists = map { $_->tagnum => $_->tagnum } 
+        qsearch({
+          table     => 'cust_tag',
+          hashref   => { custnum  => $object->custnum, },
+        });
+
+  my @tags = split(/\,/, $self->option('tagnum'));
+  foreach my $tagnum ( split(/\,/, $self->option('tagnum') ) ) {
+    if ( !$exists{$tagnum} ) {
+      my $cust_tag = new FS::cust_tag { 'tagnum'  => $tagnum,
+                                        'custnum' => $object->custnum, };
+      my $error = $cust_tag->insert;
+      if ( $error ) {
+        return $error;
+      }
+    }
+  }
+  '';
+}
+
+1;

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

Summary of changes:
 FS/FS/part_event/Action/addtag.pm |   51 +++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 FS/FS/part_event/Action/addtag.pm




More information about the freeside-commits mailing list