summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Action
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-12-04 13:06:20 -0500
committerChristopher Burger <burgerc@freeside.biz>2018-04-02 10:47:03 -0400
commit48bbf0e77b2350ef14d2dc47fe1d2d768a89fd8a (patch)
tree078705be3f02635c34b93b38c4d2cc202b74b40a /FS/FS/part_event/Action
parent5ec5514cc0b77a4ba930223bccca71f3877ce6d7 (diff)
RT# 33362 - fixed discount_mixin to not throw perl error when trying to discount non monthly recuring.
Diffstat (limited to 'FS/FS/part_event/Action')
-rw-r--r--FS/FS/part_event/Action/pkg_discount.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/FS/FS/part_event/Action/pkg_discount.pm b/FS/FS/part_event/Action/pkg_discount.pm
index dd85ada..d245ef4 100644
--- a/FS/FS/part_event/Action/pkg_discount.pm
+++ b/FS/FS/part_event/Action/pkg_discount.pm
@@ -23,10 +23,10 @@ sub option_fields {
'extra_sql' => q(AND freq NOT LIKE '0%' AND freq NOT LIKE '%d' AND freq NOT LIKE '%h' AND freq NOT LIKE '%w'),
'multiple' => 1,
},
- 'if_pkg_class' => { label => 'Only package class',
- type => 'select-pkg_class',
- multiple => 1,
- },
+ 'if_pkg_class' => { 'label' => 'Only package class',
+ 'type' => 'select-pkg_class',
+ 'multiple' => 1,
+ },
'discountnum' => { 'label' => 'Discount',
'type' => 'select-table', #we don't handle the select-discount create a discount case
'table' => 'discount',
@@ -54,7 +54,7 @@ sub do_action {
my $cust_main = $self->cust_main($object);
my %if_pkgpart = map { $_=>1 } split(/\s*,\s*/, $self->option('if_pkgpart') );
- my $if_pkg_class = $self->option('if_pkg_class') || {};
+ my %if_pkg_class = map { $_=>1 } split(/\s*,\s*/, $self->option('if_pkg_class') );
my $allpkgs = (keys %if_pkgpart) ? 0 : 1;
@@ -65,8 +65,8 @@ sub do_action {
return 'Package not selected'
if ! $allpkgs && ! $if_pkgpart{ $object->pkgpart };
return 'Package not of selected class'
- if keys %$if_pkg_class
- && ! $if_pkg_class->{ $object->part_pkg->classnum };
+ if keys %if_pkg_class
+ && ! $if_pkg_class{ $object->part_pkg->classnum };
return 'Package frequency not monthly or a multiple'
if $object->part_pkg->freq !~ /^\d+$/;
@@ -76,7 +76,7 @@ sub do_action {
@cust_pkg = grep {
( $allpkgs || $if_pkgpart{ $_->pkgpart } )
- && ( ! keys %$if_pkg_class || $if_pkg_class->{ $_->part_pkg->classnum } )
+ && ( ! keys %if_pkg_class || $if_pkg_class{ $_->part_pkg->classnum } )
&& $_->part_pkg->freq
#remove after fixing discount bug with non-monthly pkgs
&& ( $_->part_pkg->freq =~ /^\d+$/)