From 60ca6141ee3efd2479dc89615504433a0d950356 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 23 Sep 2015 10:51:29 -0700 Subject: [PATCH] fix searches for cust_pay events, RT#35167 --- FS/FS/cust_event.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/FS/FS/cust_event.pm b/FS/FS/cust_event.pm index c35e1185b..1d8af1e6e 100644 --- a/FS/FS/cust_event.pm +++ b/FS/FS/cust_event.pm @@ -9,6 +9,7 @@ use FS::Record qw( qsearch qsearchs dbdef ); use FS::cust_main; use FS::cust_pkg; use FS::cust_bill; +use FS::cust_pay; use FS::svc_acct; $DEBUG = 0; @@ -305,11 +306,13 @@ sub join_sql { LEFT JOIN cust_pay ON ( eventtable = 'cust_pay' AND tablenum = paynum ) LEFT JOIN cust_svc ON ( eventtable = 'svc_acct' AND tablenum = svcnum ) LEFT JOIN cust_pkg AS cust_pkg_for_svc ON ( cust_svc.pkgnum = cust_pkg_for_svc.pkgnum ) - LEFT JOIN cust_main ON ( ( eventtable = 'cust_main' AND tablenum = cust_main.custnum ) - OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum ) - OR ( eventtable = 'cust_pkg' AND cust_pkg.custnum = cust_main.custnum ) - OR ( eventtable = 'svc_acct' AND cust_pkg_for_svc.custnum = cust_main.custnum ) - ) + LEFT JOIN cust_main ON ( + ( eventtable = 'cust_main' AND tablenum = cust_main.custnum ) + OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum ) + OR ( eventtable = 'cust_pkg' AND cust_pkg.custnum = cust_main.custnum ) + OR ( eventtable = 'cust_pay' AND cust_pay.custnum = cust_main.custnum ) + OR ( eventtable = 'svc_acct' AND cust_pkg_for_svc.custnum = cust_main.custnum ) + ) "; } @@ -389,6 +392,11 @@ sub search_sql_where { "tablenum = '$1'"; } + if ( $param->{'paynum'} =~ /^(\d+)$/ ) { + push @search, "part_event.eventtable = 'cust_pay'", + "tablenum = '$1'"; + } + if ( $param->{'svcnum'} =~ /^(\d+)$/ ) { push @search, "part_event.eventtable = 'svc_acct'", "tablenum = '$1'"; -- 2.11.0