add per-customer configurable billing date, RT10813
[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 matches 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   ($mday == $cust_main->billday) || (!$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 cust_main.billday = $mday";
28 }
29
30 1;