"Continue recurring billing while suspended" checkbox for event-triggered cancels...
[freeside.git] / FS / FS / part_event / Action / suspend.pm
1 package FS::part_event::Action::suspend;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Suspend all of this customer\'s packages'; }
7
8 sub option_fields {
9   ( 
10     'reasonnum'    => { 'label'        => 'Reason',
11                         'type'         => 'select-reason',
12                         'reason_class' => 'S',
13                       },
14     'suspend_bill' => { 'label' => 'Continue recurring billing while suspended',
15                         'type'  => 'checkbox',
16                         'value' => 'Y',
17                       },
18   );
19 }
20
21 sub default_weight { 10; }
22
23 sub do_action {
24   my( $self, $cust_object ) = @_;
25
26   my $cust_main = $self->cust_main($cust_object);
27
28   my @err = $cust_main->suspend(
29     'reason'  => $self->option('reasonnum'),
30     'options' => { 'suspend_bill' => $self->option('suspend_bill') },
31   );
32
33   die join(' / ', @err) if scalar(@err);
34
35   '';
36
37 }
38
39 1;