This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / part_event / Action / suspend_if_pkgpart.pm
1 package FS::part_event::Action::suspend_if_pkgpart;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Suspend packages'; }
7
8 #i should be deprecated in favor of using the if_pkgpart condition
9
10 sub option_fields {
11   ( 
12     'if_pkgpart' => { 'label'    => 'Suspend packages:',
13                       'type'     => 'select-part_pkg',
14                       'multiple' => 1,
15                     },
16     'reasonnum' => { 'label'        => 'Reason',
17                      'type'         => 'select-reason',
18                      'reason_class' => 'S',
19                    },
20   );
21 }
22
23 sub default_weight { 10; }
24
25 sub do_action {
26   my( $self, $cust_object ) = @_;
27
28   my $cust_main = $self->cust_main($cust_object);
29
30   my @err = $cust_main->suspend_if_pkgpart( {
31     'pkgparts' => [ split(/\s*,\s*/, $self->option('if_pkgpart') ) ],
32     'reason'   => $self->option('reasonnum'),
33   } );
34
35   die join(' / ', @err) if scalar(@err);
36
37   '';
38 }
39
40 1;