'extra_sql' => ( scalar(keys %options) ? ' AND ' : ' WHERE ' ).
' ( '.
join(' OR ', map "$_ = '$phonen'",
- qw( daytime night fax )
+ qw( daytime night mobile fax )
).
' ) '.
" AND $agentnums_sql", #agent virtualization
=item address
+=item zip
+
=item refnum
=item cancelled_pkgs
listref of start date, end date
+=item anniversary_date
+
+listref of start date, end date
+
=item payby
listref
'usernum' => '',
'status' => '',
'address' => '',
+ 'zip' => '',
'paydate_year' => '',
'invoice_terms' => '',
'custbatch' => '',
)";
}
+ ##
+ # zipcode
+ ##
+ if ( $params->{'zip'} =~ /\S/ ) {
+ my $zip = dbh->quote($params->{'zip'} . '%');
+ push @where, "EXISTS(
+ SELECT 1 FROM cust_location
+ WHERE cust_location.custnum = cust_main.custnum
+ AND cust_location.zip LIKE $zip
+ )";
+ }
+
###
# refnum
###
- if ( $params->{'refnum'} =~ /^(\d+)$/ ) {
- push @where, "refnum = $1";
+ if ( $params->{'refnum'} ) {
+
+ my @refnum = ref( $params->{'refnum'} )
+ ? @{ $params->{'refnum'} }
+ : ( $params->{'refnum'} );
+
+ @refnum = grep /^(\d*)$/, @refnum;
+
+ push @where, '( '. join(' OR ', map "cust_main.refnum = $_", @refnum ). ' )'
+ if @refnum;
+
}
##
# dates
##
- foreach my $field (qw( signupdate birthdate spouse_birthdate )) {
+ foreach my $field (qw( signupdate birthdate spouse_birthdate anniversary_date )) {
next unless exists($params->{$field});
my @select = (
'cust_main.custnum',
+ # there's a good chance that we'll need these
+ 'cust_main.bill_locationnum',
+ 'cust_main.ship_locationnum',
FS::UI::Web::cust_sql_fields($params->{'cust_fields'}),
);