[freeside-commits] branch master updated. 46fe3dbcb3ca97d1f3c70d49351846cf0ab6461d

Ivan ivan at 420.am
Mon Apr 25 09:58:17 PDT 2016


The branch, master has been updated
       via  46fe3dbcb3ca97d1f3c70d49351846cf0ab6461d (commit)
       via  cc4caa54e9974ea3d6ac7cf55cf45863d2a8905e (commit)
       via  395927e9939742a20f8f5bf8578f6b8f9b6387b4 (commit)
       via  8873189f93ad32da7f619959c51a35ed66e19b30 (commit)
      from  55447b350a12dc435730bd8ab7ef300991ac4660 (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 46fe3dbcb3ca97d1f3c70d49351846cf0ab6461d
Merge: cc4caa5 55447b3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 25 09:58:14 2016 -0700

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit cc4caa54e9974ea3d6ac7cf55cf45863d2a8905e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 25 09:58:11 2016 -0700

    add conditions for customer cancelled packages, RT#42043

diff --git a/FS/FS/part_event/Condition/has_pkgpart_cancelled.pm b/FS/FS/part_event/Condition/has_pkgpart_cancelled.pm
new file mode 100644
index 0000000..7e2a567
--- /dev/null
+++ b/FS/FS/part_event/Condition/has_pkgpart_cancelled.pm
@@ -0,0 +1,45 @@
+package FS::part_event::Condition::has_pkgpart_cancelled;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description { 'Customer has canceled specific package(s)'; }
+
+sub eventtable_hashref {
+    { 'cust_main' => 1,
+      'cust_bill' => 1,
+      'cust_pkg'  => 1,
+    };
+}
+
+sub option_fields {
+  ( 
+    'if_pkgpart' => { 'label'    => 'Only 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;

commit 395927e9939742a20f8f5bf8578f6b8f9b6387b4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 25 09:57:16 2016 -0700

    add conditions for customer cancelled packages, RT#42043

diff --git a/FS/FS/part_event/Condition/has_pkg_class_cancelled.pm b/FS/FS/part_event/Condition/has_pkg_class_cancelled.pm
new file mode 100644
index 0000000..d6e25a4
--- /dev/null
+++ b/FS/FS/part_event/Condition/has_pkg_class_cancelled.pm
@@ -0,0 +1,43 @@
+package FS::part_event::Condition::has_pkg_class_cancelled;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description {
+  'Customer has 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'      => 'Cacnellation 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;

commit 8873189f93ad32da7f619959c51a35ed66e19b30
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 25 09:55:45 2016 -0700

    debug

diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 73658f6..748bcae 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -719,6 +719,8 @@ sub setx {
 sub part_svc {
   my $self = shift;
 
+  cluck 'svc_X->part_svc called' if $DEBUG;
+
   #get part_svc
   my $svcpart;
   if ( $self->get('svcpart') ) {

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

Summary of changes:
 ...{has_pkg_class.pm => has_pkg_class_cancelled.pm} |   19 +++++++++++--------
 .../{has_pkgpart.pm => has_pkgpart_cancelled.pm}    |   17 +++++++++++------
 FS/FS/svc_Common.pm                                 |    2 ++
 3 files changed, 24 insertions(+), 14 deletions(-)
 copy FS/FS/part_event/Condition/{has_pkg_class.pm => has_pkg_class_cancelled.pm} (55%)
 copy FS/FS/part_event/Condition/{has_pkgpart.pm => has_pkgpart_cancelled.pm} (54%)




More information about the freeside-commits mailing list