[freeside-commits] branch FREESIDE_4_BRANCH updated. 28388a4676ab0429ce51ebf94caa37b86e806162

Jonathan Prykop jonathan at 420.am
Sat Jun 4 00:49:10 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  28388a4676ab0429ce51ebf94caa37b86e806162 (commit)
      from  c43a82b640f8c4ec8a43debf7b6e11379aef53e4 (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 28388a4676ab0429ce51ebf94caa37b86e806162
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Sat Jun 4 00:18:16 2016 -0500

    RT#42043: Check for cancelled packages with a cancellation date age option [hasnt cancelled conditions]

diff --git a/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm b/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
new file mode 100644
index 0000000..353e646
--- /dev/null
+++ b/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
@@ -0,0 +1,44 @@
+package FS::part_event::Condition::hasnt_pkg_class_cancelled;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description {
+  'Customer does not have canceled package with class';
+}
+
+sub eventtable_hashref {
+    { 'cust_main' => 1,
+      'cust_bill' => 1,
+      'cust_pkg'  => 1,
+    };
+}
+
+#something like this
+sub option_fields {
+  (
+    'pkgclass'  => { 'label'    => 'Package Class',
+                     'type'     => 'select-pkg_class',
+                     'multiple' => 1,
+                   },
+    'age'       => { 'label'      => 'Cancellation in last',
+                     'type'       => 'freq',
+                   },
+  );
+}
+
+sub condition {
+  my( $self, $object, %opt ) = @_;
+
+  my $cust_main = $self->cust_main($object);
+
+  my $age = $self->option_age_from('age', $opt{'time'} );
+
+  #XXX test
+  my $hashref = $self->option('pkgclass') || {};
+  ! grep { $hashref->{ $_->part_pkg->classnum } && $_->get('cancel') > $age }
+    $cust_main->cancelled_pkgs;
+}
+
+1;
+
diff --git a/FS/FS/part_event/Condition/hasnt_pkgpart_cancelled.pm b/FS/FS/part_event/Condition/hasnt_pkgpart_cancelled.pm
new file mode 100644
index 0000000..b4ff6c3
--- /dev/null
+++ b/FS/FS/part_event/Condition/hasnt_pkgpart_cancelled.pm
@@ -0,0 +1,46 @@
+package FS::part_event::Condition::hasnt_pkgpart_cancelled;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description { 'Customer does not have canceled specific package(s)'; }
+
+sub eventtable_hashref {
+    { 'cust_main' => 1,
+      'cust_bill' => 1,
+      'cust_pkg'  => 1,
+    };
+}
+
+sub option_fields {
+  ( 
+    'if_pkgpart' => { 'label'    => 'Packages: ',
+                      'type'     => 'select-part_pkg',
+                      'multiple' => 1,
+                    },
+    'age'        => { 'label'      => 'Cancellation in last',
+                      'type'       => 'freq',
+                    },
+  );
+}
+
+sub condition {
+  my( $self, $object, %opt ) = @_;
+
+  my $cust_main = $self->cust_main($object);
+
+  my $age = $self->option_age_from('age', $opt{'time'} );
+
+  my $if_pkgpart = $self->option('if_pkgpart') || {};
+  ! grep { $if_pkgpart->{ $_->pkgpart } && $_->get('cancel') > $age }
+    $cust_main->cancelled_pkgs;
+
+}
+
+#XXX 
+#sub condition_sql {
+#
+#}
+
+1;
+

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

Summary of changes:
 ...as_pkg_class_cancelled.pm => hasnt_pkg_class_cancelled.pm} |    9 +++++----
 .../{has_pkgpart_cancelled.pm => hasnt_pkgpart_cancelled.pm}  |    9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)
 copy FS/FS/part_event/Condition/{has_pkg_class_cancelled.pm => hasnt_pkg_class_cancelled.pm} (73%)
 copy FS/FS/part_event/Condition/{has_pkgpart_cancelled.pm => hasnt_pkgpart_cancelled.pm} (74%)




More information about the freeside-commits mailing list