suspend event option to skip packages with a start_date, RT#83847
[freeside.git] / FS / FS / part_event / Action / cust_bill_suspend.pm
1 package FS::part_event::Action::cust_bill_suspend;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Suspend packages on this invoice'; }
7
8 sub eventtable_hashref {
9   { 'cust_bill' => 1 };
10 }
11
12 sub option_fields {
13   (
14     'reasonnum'    => { 'label'        => 'Reason',
15                         'type'         => 'select-reason',
16                         'reason_class' => 'S',
17                       },
18     'suspend_bill' => { 'label' => 'Continue recurring billing while suspended',
19                         'type'  => 'checkbox',
20                         'value' => 'Y',
21                       },
22   );
23 }
24
25 sub default_weight { 10; }
26
27 sub do_action {
28   my( $self, $cust_bill ) = @_;
29
30   my @err = $cust_bill->suspend(
31     'reason'  => $self->option('reasonnum'),
32     'options' => { 'suspend_bill' => $self->option('suspend_bill') },
33   );
34
35   die join(' / ', @err) if scalar(@err);
36
37   return '';
38
39 }
40
41 1;