This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / part_event / Action / writeoff.pm
1 package FS::part_event::Action::writeoff;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Write off bad debt with a credit entry.'; }
7
8 sub option_fields {
9   ( 
10     #'charge' => { label=>'Amount', type=>'money', }, # size=>7, },
11     'reasonnum' => { 'label'        => 'Reason',
12                      'type'         => 'select-reason',
13                      'reason_class' => 'R',
14                    },
15   );
16 }
17
18 sub default_weight { 65; }
19
20 sub do_action {
21   my( $self, $cust_object ) = @_;
22
23   my $cust_main = $self->cust_main($cust_object);
24
25   my $reasonnum = $self->option('reasonnum');
26
27   my $error = $cust_main->credit( $cust_main->balance, \$reasonnum );
28   die $error if $error;
29
30   '';
31 }
32
33 1;