'type' => 'select-part_pkg',
'multiple' => 1,
},
- 'age' => { 'label' => 'Cancellation in last',
+ '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,
},
);
}
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 $if_pkgpart = $self->option('if_pkgpart') || {};
- ! grep { $if_pkgpart->{ $_->pkgpart } && $_->get('cancel') > $age }
+
+ ! grep { $if_pkgpart->{ $_->pkgpart } && ($_->get('cancel') > $oldest) && ($_->get('cancel') <= $newest) }
$cust_main->cancelled_pkgs;
}