blob: 460e6a4be8cfc521acfbf4669f1817d82b1744ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package FS::part_event::Condition::cust_bill_owed_under;
use strict;
use FS::cust_bill;
use base qw( FS::part_event::Condition );
sub description {
'Amount owed on specific invoice (under)';
}
sub eventtable_hashref {
{ 'cust_main' => 0,
'cust_bill' => 1,
'cust_pkg' => 0,
};
}
sub option_fields {
(
'owed' => { 'label' => 'Amount owed under (or equal to)',
'type' => 'money',
'value' => '0.00', #default
},
);
}
sub condition {
#my($self, $cust_bill, %opt) = @_;
my($self, $cust_bill) = @_;
my $under = $self->option('owed');
$under = 0 unless length($under);
$cust_bill->owed <= $under;
}
sub condition_sql {
my( $class, $table ) = @_;
my $under = $class->condition_sql_option('owed');
my $owed_sql = FS::cust_bill->owed_sql;
"$owed_sql <= $under";
}
1;
|