[freeside-commits] branch FREESIDE_4_BRANCH updated. 5ffd5feb2cb13e0e26ae2c668d161aede8aef826

Ivan ivan at 420.am
Thu Feb 4 12:54:18 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  5ffd5feb2cb13e0e26ae2c668d161aede8aef826 (commit)
      from  7a4a4dc69ac7f2b97e477568ebce10b861461d8c (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 5ffd5feb2cb13e0e26ae2c668d161aede8aef826
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Feb 4 12:54:16 2016 -0800

    check most recent type condition, RT#40101

diff --git a/FS/FS/part_event/Condition/cust_pay_payby.pm b/FS/FS/part_event/Condition/cust_pay_payby.pm
new file mode 100644
index 0000000..d360564
--- /dev/null
+++ b/FS/FS/part_event/Condition/cust_pay_payby.pm
@@ -0,0 +1,40 @@
+package FS::part_event::Condition::cust_pay_payby;
+
+use strict;
+use base qw( FS::part_event::Condition );
+use FS::payby;
+use FS::Record qw( qsearchs );
+use FS::cust_pay;
+
+sub description { 'Type of most recent payment'; }
+
+tie my %payby, 'Tie::IxHash', FS::payby->payment_payby2payname;
+
+sub option_fields {
+  (
+    'payby' => {
+                 label         => 'Payment type',
+                 type          => 'checkbox-multiple',
+                 options       => [ keys %payby ],
+                 option_labels => \%payby,
+               },
+  );
+}
+
+sub condition {
+  my($self, $object) = @_;
+
+  my $cust_main = $self->cust_main($object);
+
+  my $cust_pay = qsearchs({ 'table'    => 'cust_pay',
+                            'hashref'  => { 'custnum'=>$cust_main->custnum },
+                            'order_by' => 'ORDER BY _date DESC LIMIT 1',
+                         })
+    or return 0;
+
+  my $payby = $self->option('payby') || {};
+  $payby->{ $cust_pay->payby };
+
+}
+
+1;

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

Summary of changes:
 FS/FS/part_event/Condition/cust_pay_payby.pm |   40 ++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 FS/FS/part_event/Condition/cust_pay_payby.pm




More information about the freeside-commits mailing list