[freeside-commits] branch master updated. 9e120a90dac851bec98c5bd597e690714ffd93ad

Jonathan Prykop jonathan at 420.am
Wed Feb 11 14:08:34 PST 2015


The branch, master has been updated
       via  9e120a90dac851bec98c5bd597e690714ffd93ad (commit)
      from  68dc4147208b554d3442bd463ca6d1c576af880d (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 9e120a90dac851bec98c5bd597e690714ffd93ad
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Feb 11 16:07:58 2015 -0600

    RT#30586: Discounts for ACH

diff --git a/FS/FS/part_event/Action/pkg_discount.pm b/FS/FS/part_event/Action/pkg_discount.pm
index 04a3a0f..592e044 100644
--- a/FS/FS/part_event/Action/pkg_discount.pm
+++ b/FS/FS/part_event/Action/pkg_discount.pm
@@ -3,7 +3,7 @@ package FS::part_event::Action::pkg_discount;
 use strict;
 use base qw( FS::part_event::Action );
 
-sub description { "Discount active customer packages"; }
+sub description { "Discount unsuspended customer packages (monthly recurring only)"; }
 
 sub eventtable_hashref {
   { 'cust_main' => 1 };
@@ -41,10 +41,12 @@ sub do_action {
 
   my $cust_main = $self->cust_main($object);
   my %if_pkgpart = map { $_=>1 } split(/\s*,\s*/, $self->option('if_pkgpart') );
-  my @cust_pkg = grep { $if_pkgpart{ $_->pkgpart } && $_->part_pkg->freq
+  my $allpkgs = (keys %if_pkgpart) ? 0 : 1;
+  my @cust_pkg = grep { ( $allpkgs || $if_pkgpart{ $_->pkgpart } ) 
+                          && $_->part_pkg->freq
                           #can remove after fixing discount bug with non-monthly pkgs
                           && ( $_->part_pkg->freq =~ /^\d+$/) } 
-                      $cust_main->active_pkgs;
+                      $cust_main->unsuspended_pkgs;
   return 'No qualifying packages' unless @cust_pkg;
 
   my $gotit = 0;

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

Summary of changes:
 FS/FS/part_event/Action/pkg_discount.pm |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list