summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-04-25 17:36:04 +0000
committerivan <ivan>2011-04-25 17:36:04 +0000
commitf7063ef834457763dfb8a8996e5b4af89cffb674 (patch)
tree5252dbe7188c2becb47ea353528b125cfdff1451 /FS
parent102a0db99bff20d5c653a34fd3b4999f90078e6f (diff)
add postal.pm condition, RT#12557
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_event/Condition/postal.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/FS/FS/part_event/Condition/postal.pm b/FS/FS/part_event/Condition/postal.pm
new file mode 100644
index 000000000..d0bd4194b
--- /dev/null
+++ b/FS/FS/part_event/Condition/postal.pm
@@ -0,0 +1,26 @@
+package FS::part_event::Condition::postal;
+use base qw( FS::part_event::Condition );
+use strict;
+
+sub description {
+ 'Customer receives a postal mail invoice';
+}
+
+sub condition {
+ my( $self, $object ) = @_;
+ my $cust_main = $self->cust_main($object);
+
+ scalar( grep { $_ eq 'POST' } $cust_main->invoicing_list );
+}
+
+sub condition_sql {
+ my( $self, $table ) = @_;
+
+ " EXISTS( SELECT 1 FROM cust_main_invoice
+ WHERE cust_main_invoice.custnum = cust_main.custnum
+ AND cust_main_invoice.dest = 'POST'
+ )
+ ";
+}
+
+1;