summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/postal.pm
blob: d0bd4194b50c444855215c382730896b6ef3d360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;