summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/billday.pm
blob: e067f87f7dbf733b970206aec1c244d562b7c2f0 (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
package FS::part_event::Condition::billday;

use strict;
use Tie::IxHash;

use base qw( FS::part_event::Condition );

sub description {
  "Customer's monthly billing day is before or on current day or customer has no billing day";
}

sub condition {
  my( $self, $object ) = @_;

  my $cust_main = $self->cust_main($object);

  my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

  (!$cust_main->billday) || ($mday >= $cust_main->billday);
}

sub condition_sql {
  my( $self, $table ) = @_;

  my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

  "cust_main.billday is null or $mday >= cust_main.billday";
}

1;