summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-09-01 17:00:22 -0700
committerIvan Kohler <ivan@freeside.biz>2016-09-01 17:00:22 -0700
commitddb601f6bb7bdce8e0912e78472335f5613d20db (patch)
treec332e0d18be5f14e1cfb8c42ccd2a46122e3b163 /FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
parent4a896c6c3703b5f509fc75e98a7982fbcd85f9ae (diff)
parentf33281a9f445b06e319c45f393c71577701eff67 (diff)
Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH
Diffstat (limited to 'FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm')
-rw-r--r--FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm22
1 files changed, 15 insertions, 7 deletions
diff --git a/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm b/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
index 353e6469f..d54fb88fa 100644
--- a/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
+++ b/FS/FS/part_event/Condition/hasnt_pkg_class_cancelled.pm
@@ -21,9 +21,16 @@ sub option_fields {
'type' => 'select-pkg_class',
'multiple' => 1,
},
- 'age' => { 'label' => 'Cancellation in last',
- 'type' => 'freq',
- },
+ 'age_newest' => { 'label' => 'Cancelled more than',
+ 'type' => 'freq',
+ 'post_text' => ' ago (blank for no limit)',
+ 'allow_blank' => 1,
+ },
+ 'age' => { 'label' => 'Cancelled less than',
+ 'type' => 'freq',
+ 'post_text' => ' ago (blank for no limit)',
+ 'allow_blank' => 1,
+ },
);
}
@@ -32,11 +39,12 @@ sub condition {
my $cust_main = $self->cust_main($object);
- my $age = $self->option_age_from('age', $opt{'time'} );
+ my $oldest = length($self->option('age')) ? $self->option_age_from('age', $opt{'time'} ) : 0;
+ my $newest = $self->option_age_from('age_newest', $opt{'time'} );
+
+ my $pkgclass = $self->option('pkgclass') || {};
- #XXX test
- my $hashref = $self->option('pkgclass') || {};
- ! grep { $hashref->{ $_->part_pkg->classnum } && $_->get('cancel') > $age }
+ ! grep { $pkgclass->{ $_->part_pkg->classnum } && ($_->get('cancel') > $oldest) && ($_->get('cancel') <= $newest) }
$cust_main->cancelled_pkgs;
}