[freeside-commits] branch master updated. 580dd345b7616365903b9fbedc162f77e5c8b91f
Mike Robinson
miker at 420.am
Thu Apr 26 10:22:32 PDT 2012
The branch, master has been updated
via 580dd345b7616365903b9fbedc162f77e5c8b91f (commit)
from 30d17233a3e064bb84417d16fd03feb52dc11dd0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 580dd345b7616365903b9fbedc162f77e5c8b91f
Author: Mike Robinson <miker at freeside.biz>
Date: Thu Apr 26 12:21:24 2012 -0500
pkg_dundate_age condition (#17394)
diff --git a/FS/FS/part_event/Condition/pkg_dundate_age.pm b/FS/FS/part_event/Condition/pkg_dundate_age.pm
new file mode 100644
index 0000000..2ea2a20
--- /dev/null
+++ b/FS/FS/part_event/Condition/pkg_dundate_age.pm
@@ -0,0 +1,43 @@
+package FS::part_event::Condition::pkg_dundate_age;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description {
+ "Skip until specified #days before package suspension delay date";
+}
+
+
+sub option_fields {
+ (
+ 'age' => { 'label' => 'Time before suspension delay date',
+ 'type' => 'freq',
+ },
+ );
+}
+
+sub eventtable_hashref {
+ { 'cust_main' => 0,
+ 'cust_bill' => 0,
+ 'cust_pkg' => 1,
+ };
+}
+
+sub condition {
+ my($self, $cust_pkg, %opt) = @_;
+
+ my $age = $self->option_age_from('age', $opt{'time'} );
+
+ $cust_pkg->dundate <= $age;
+}
+
+sub condition_sql {
+ my( $class, $table, %opt ) = @_;
+ return 'true' unless $table eq 'cust_pkg';
+
+ my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
+
+ "COALESCE($table.dundate,0) <= ". $age;
+}
+
+1;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_event/Condition/pkg_dundate_age.pm | 43 +++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
create mode 100644 FS/FS/part_event/Condition/pkg_dundate_age.pm
More information about the freeside-commits
mailing list