suspend event option to skip packages with a start_date, RT#83847
[freeside.git] / FS / FS / part_event / Action / cust_bill_cancel.pm
1 package FS::part_event::Action::cust_bill_cancel;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Cancel 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' => 'C',
17                       },
18   );
19 }
20
21 sub default_weight { 10; }
22
23 sub do_action {
24   my( $self, $cust_bill ) = @_;
25
26   my @err = $cust_bill->cancel(
27     'reason'  => $self->option('reasonnum'),
28   );
29
30   die join(' / ', @err) if scalar(@err);
31
32   return '';
33 }
34
35 1;