RT#25563: Better handling of commissions which do not have rates configured [more...
[freeside.git] / FS / FS / part_event / Action / Mixin / credit_flat.pm
1 package FS::part_event::Action::Mixin::credit_flat;
2
3 # credit_flat: return a fixed amount for _calc_credit, specified in the 
4 # options
5
6 use strict;
7
8 sub option_fields {
9   (
10     'reasonnum' => { 'label'        => 'Credit reason',
11                      'type'         => 'select-reason',
12                      'reason_class' => 'R',
13                    },
14     'amount'    => { 'label'        => 'Credit amount',
15                      'type'         => 'money',
16                    },
17   );
18 }
19
20 sub _calc_credit {
21   my $self = shift;
22   my $warnref = $_[2]; #other input not used by credit_flat
23   my $warning = $self->option('amount') ? '' : 'Amount set to zero ';
24   $$warnref .= $warning if ref($warnref);
25   return $self->option('amount');
26 }
27
28 1;