e067f87f7dbf733b970206aec1c244d562b7c2f0
[freeside.git] / FS / FS / part_event / Condition / billday.pm
1 package FS::part_event::Condition::billday;
2
3 use strict;
4 use Tie::IxHash;
5
6 use base qw( FS::part_event::Condition );
7
8 sub description {
9   "Customer's monthly billing day is before or on current day or customer has no billing day";
10 }
11
12 sub condition {
13   my( $self, $object ) = @_;
14
15   my $cust_main = $self->cust_main($object);
16
17   my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
18
19   (!$cust_main->billday) || ($mday >= $cust_main->billday);
20 }
21
22 sub condition_sql {
23   my( $self, $table ) = @_;
24
25   my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
26
27   "cust_main.billday is null or $mday >= cust_main.billday";
28 }
29
30 1;