summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorlevinse <levinse>2011-06-03 18:10:45 +0000
committerlevinse <levinse>2011-06-03 18:10:45 +0000
commit23ceb08c948d848556555840ffde296caebd6df6 (patch)
treef8e6b4e906ef29e64452dd1d5461772f6a105370 /FS
parent645538bbc9e4d15f399181db04411f45805d37c8 (diff)
per-customer configurable payment date for auto CHEK/CARD, RT10813
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_event/Condition/billday.pm23
1 files changed, 19 insertions, 4 deletions
diff --git a/FS/FS/part_event/Condition/billday.pm b/FS/FS/part_event/Condition/billday.pm
index e067f87f7..7cd74a1f9 100644
--- a/FS/FS/part_event/Condition/billday.pm
+++ b/FS/FS/part_event/Condition/billday.pm
@@ -9,22 +9,37 @@ sub description {
"Customer's monthly billing day is before or on current day or customer has no billing day";
}
+sub option_fields {
+ (
+ 'delay' => { label => 'Delay additional days',
+ type => 'text',
+ value => '1',
+ },
+ );
+}
+
+
sub condition {
my( $self, $object ) = @_;
my $cust_main = $self->cust_main($object);
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+
+ my $delay = $self->option('delay');
+ $delay = 0 unless length($delay);
- (!$cust_main->billday) || ($mday >= $cust_main->billday);
+ (!$cust_main->billday) || ($mday >= $cust_main->billday + $delay);
}
sub condition_sql {
- my( $self, $table ) = @_;
+ my( $class, $table, %opt ) = @_;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
-
- "cust_main.billday is null or $mday >= cust_main.billday";
+
+ my $delay = $class->condition_sql_option_integer('delay', $opt{'driver_name'});
+
+ "cust_main.billday is null or $mday >= (cust_main.billday + $delay)";
}
1;