X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pay.cgi;h=199c66d81837762ba0c8454ff722867865dca935;hb=a0ddcb6b2ac38076c48e8f0b69e0758d5283303a;hp=0664bf7960c63e8aaa8f9fe7957406b2e83629b9;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index 0664bf796..199c66d81 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -21,9 +21,13 @@ % or die "illegal payby ". $cgi->param('payby'); % push @search, "cust_pay.payby = '$1'"; % if ( $3 ) { -% if ( $3 eq 'VisaMC' ) { +% +% my $cardtype = $3; +% +% my $search; +% if ( $cardtype eq 'VisaMC' ) { % #avoid posix regexes for portability -% push @search, +% $search = % " ( ( substring(cust_pay.payinfo from 1 for 1) = '4' ". % " AND substring(cust_pay.payinfo from 1 for 4) != '4936' ". % " AND substring(cust_pay.payinfo from 1 for 6) ". @@ -43,19 +47,21 @@ % " OR substring(cust_pay.payinfo from 1 for 2) = '54' ". % " OR substring(cust_pay.payinfo from 1 for 2) = '54' ". % " OR substring(cust_pay.payinfo from 1 for 2) = '55' ". +% " OR substring(cust_pay.payinfo from 1 for 2) = '36' ". #Diner's int'l processed as Visa/MC inside US % " ) "; -% } elsif ( $3 eq 'Amex' ) { -% push @search, +% } elsif ( $cardtype eq 'Amex' ) { +% $search = % " ( substring(cust_pay.payinfo from 1 for 2 ) = '34' ". % " OR substring(cust_pay.payinfo from 1 for 2 ) = '37' ". % " ) "; -% } elsif ( $3 eq 'Discover' ) { -% push @search, +% } elsif ( $cardtype eq 'Discover' ) { +% $search = % " ( substring(cust_pay.payinfo from 1 for 4 ) = '6011' ". -% " OR substring(cust_pay.payinfo from 1 for 3 ) = '650' ". +% " OR substring(cust_pay.payinfo from 1 for 2 ) = '65' ". +% " OR substring(cust_pay.payinfo from 1 for 3 ) = '622' ". #China Union Pay processed as Discover outside CN % " ) "; -% } elsif ( $3 eq 'Maestro' ) { -% push @search, +% } elsif ( $cardtype eq 'Maestro' ) { +% $search = % " ( substring(cust_pay.payinfo from 1 for 2 ) = '63' ". % " OR substring(cust_pay.payinfo from 1 for 2 ) = '67' ". % " OR substring(cust_pay.payinfo from 1 for 6 ) = '564182' ". @@ -72,14 +78,23 @@ % " SIMILAR TO '49118[1-2]' ". % " ) "; % } else { -% die "unknown card type $3"; +% die "unknown card type $cardtype"; % } +% +% my $masksearch = $search; +% $masksearch =~ s/cust_pay\.payinfo/cust_pay.paymask/gi; +% +% push @search, +% "( $search OR ( cust_pay.paymask IS NOT NULL AND $masksearch ) )"; +% % } % } % % my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); % push @search, "_date >= $beginning ", % "_date <= $ending"; +% +% push @search, FS::UI::Web::parse_lt_gt($cgi, 'paid' ); % % $orderby = '_date'; % @@ -162,7 +177,7 @@ sub { my $cust_pay = shift; if ( $cust_pay->payby eq 'CARD' ) { - 'Card #'. $cust_pay->payinfo_masked; + 'Card #'. $cust_pay->paymask; } elsif ( $cust_pay->payby eq 'CHEK' ) { 'E-check acct#'. $cust_pay->payinfo; } elsif ( $cust_pay->payby eq 'BILL' ) {