[freeside-commits] freeside/FS/FS/part_event/Condition billday.pm, 1.2, 1.3
Erik Levinson
levinse at wavetail.420.am
Fri Jun 3 11:10:24 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail.420.am:/tmp/cvs-serv24148/FS/FS/part_event/Condition
Modified Files:
billday.pm
Log Message:
per-customer configurable payment date for auto CHEK/CARD, RT10813
Index: billday.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/billday.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- billday.pm 26 Apr 2011 00:19:19 -0000 1.2
+++ billday.pm 3 Jun 2011 18:10:22 -0000 1.3
@@ -9,6 +9,16 @@
"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 ) = @_;
@@ -16,15 +26,20 @@
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
- (!$cust_main->billday) || ($mday >= $cust_main->billday);
+ my $delay = $self->option('delay');
+ $delay = 0 unless length($delay);
+
+ (!$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;
More information about the freeside-commits
mailing list