projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#30586: Discounts for ACH
[freeside.git]
/
FS
/
FS
/
part_event
/
Action
/
pkg_discount.pm
diff --git
a/FS/FS/part_event/Action/pkg_discount.pm
b/FS/FS/part_event/Action/pkg_discount.pm
index
04a3a0f
..
592e044
100644
(file)
--- 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 );
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 };
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_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+$/) }
#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;
return 'No qualifying packages' unless @cust_pkg;
my $gotit = 0;