[freeside-commits] branch FREESIDE_3_BRANCH updated. 44f4f5987dd09783b74fef7b569aabdc5c67d8cd

Jeremy Davis jeremyd at 420.am
Tue Dec 9 10:52:36 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  44f4f5987dd09783b74fef7b569aabdc5c67d8cd (commit)
      from  6199f898a744f2cc2f9f03450d49286866a3f4d0 (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 44f4f5987dd09783b74fef7b569aabdc5c67d8cd
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Dec 5 15:30:19 2014 -0800

    add condition on signupdate age, RT#31213

diff --git a/FS/FS/part_event/Condition/signupdate_age.pm b/FS/FS/part_event/Condition/signupdate_age.pm
new file mode 100644
index 0000000..70b4bbd
--- /dev/null
+++ b/FS/FS/part_event/Condition/signupdate_age.pm
@@ -0,0 +1,44 @@
+package FS::part_event::Condition::signupdate_age;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description { 'Customer signup age'; }
+
+#lots of falze laziness w/cust_bill_age, basically just swapped out the field
+
+sub option_fields {
+  (
+    'age' => { label=>'Age', type=>'freq', },
+  );
+}
+
+sub condition {
+  my( $self, $cust_bill, %opt ) = @_;
+
+  my $age = $self->option_age_from('age', $opt{'time'} );
+
+  ( $cust_main->signupdate - 60 ) <= $age;
+
+}
+
+sub condition_sql {
+  my( $class, $table, %opt ) = @_;
+
+  my $age  = $class->condition_sql_option_age_from('age', $opt{'time'} );
+
+  "( cust_main.signupdate - 60 ) <= $age";
+}
+
+# i don't think it really matters what order, since we're a customer condition?
+#  this is for ordering different events for a customer
+sub order_sql {
+  shift->condition_sql_option_age('age');
+}
+
+sub order_sql_weight {
+  -1;
+}
+
+1;
+1;

-----------------------------------------------------------------------

Summary of changes:
 .../{cust_bill_age.pm => signupdate_age.pm}        |   22 +++++++++-----------
 1 file changed, 10 insertions(+), 12 deletions(-)
 copy FS/FS/part_event/Condition/{cust_bill_age.pm => signupdate_age.pm} (54%)




More information about the freeside-commits mailing list