[freeside-commits] branch master updated. 37056f018393b75600a9e330d9f06c882ff8e19a

Ivan Kohler ivan at freeside.biz
Wed Aug 1 14:05:16 PDT 2018


The branch, master has been updated
       via  37056f018393b75600a9e330d9f06c882ff8e19a (commit)
      from  7ecaf988ed810746534bf85abde34022f2b5d6b2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 37056f018393b75600a9e330d9f06c882ff8e19a
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Aug 1 14:05:02 2018 -0700

    spacing, and order like sql, RT#77532

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 815304bb4..0c33bd694 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -96,8 +96,11 @@ sub smart_search {
 
     #cust_main phone numbers and contact phone number
     push @cust_main, qsearch( {
-      'table'   => 'cust_main',
-      'hashref' => { %options },
+      'select'    => 'cust_main.*',
+      'table'     => 'cust_main',
+      'addl_from' => ' left join cust_contact  using (custnum) '.
+                     ' left join contact_phone using (contactnum) ',
+      'hashref'   => { %options },
       'extra_sql' => ( scalar(keys %options) ? ' AND ' : ' WHERE ' ).
                      ' ( '.
                          join(' OR ', map "$_ = '$phonen'",
@@ -106,15 +109,14 @@ sub smart_search {
                           " OR phonenum = '$phonenum' ".
                      ' ) '.
                      " AND $agentnums_sql", #agent virtualization
-      'addl_from' => ' left join cust_contact using (custnum) left join contact_phone using (contactnum) ',
     } );
 
     unless ( @cust_main || $phonen =~ /x\d+$/ ) { #no exact match
       #try looking for matches with extensions unless one was specified
 
       push @cust_main, qsearch( {
-        'table'   => 'cust_main',
-        'hashref' => { %options },
+        'table'     => 'cust_main',
+        'hashref'   => { %options },
         'extra_sql' => ( scalar(keys %options) ? ' AND ' : ' WHERE ' ).
                        ' ( '.
                            join(' OR ', map "$_ LIKE '$phonen\%'",
@@ -132,8 +134,12 @@ sub smart_search {
   if ( $search =~ /@/ ) { #email address from cust_main_invoice and contact_email
 
     push @cust_main, qsearch( {
-      'table'   => 'cust_main',
-      'hashref' => { %options },
+      'select'    => 'cust_main.*',
+      'table'     => 'cust_main',
+      'addl_from' => ' left join cust_main_invoice using (custnum) '.
+                     ' left join cust_contact      using (custnum) '.
+                     ' left join contact_email     using (contactnum) ',
+      'hashref'   => { %options },
       'extra_sql' => ( scalar(keys %options) ? ' AND ' : ' WHERE ' ).
                      ' ( '.
                          join(' OR ', map "$_ = '$search'",
@@ -141,7 +147,6 @@ sub smart_search {
                              ).
                      ' ) '.
                      " AND $agentnums_sql", #agent virtualization
-      'addl_from' => ' left join cust_main_invoice using (custnum) left join cust_contact using (custnum) left join contact_email using (contactnum) ',
     } );
 
   # custnum search (also try agent_custid), with some tweaking options if your
@@ -282,11 +287,12 @@ sub smart_search {
 
       #cust_main and contacts
       push @cust_main, qsearch( {
+        'select'    => 'cust_main.*',
         'table'     => 'cust_main',
-        'select'    => 'cust_main.*, cust_contact.*, contact.contactnum, contact.last as contact_last, contact.first as contact_first, contact.title',
+        'addl_from' => ' left join cust_contact using (custnum) '.
+                       ' left join contact using (contactnum) ',
         'hashref'   => { %options },
         'extra_sql' => "$sql AND $agentnums_sql", #agent virtualization
-        'addl_from' => ' left join cust_contact on cust_main.custnum = cust_contact.custnum left join contact using (contactnum) ',
       } );
 
       # or it just be something that was typed in... (try that in a sec)
@@ -314,11 +320,12 @@ sub smart_search {
       if $conf->exists('address1-search');
 
     push @cust_main, qsearch( {
+      'select'    => 'cust_main.*',
       'table'     => 'cust_main',
-      'select'    => 'cust_main.*, cust_contact.*, contact.contactnum, contact.last as contact_last, contact.first as contact_first, contact.title',
+      'addl_from' => ' left join cust_contact using (custnum) '.
+                     ' left join contact using (contactnum) ',
       'hashref'   => { %options },
       'extra_sql' => "$sql AND $agentnums_sql", #agent virtualization
-      'addl_from' => 'left join cust_contact on cust_main.custnum = cust_contact.custnum left join contact using (contactnum) ',
     } );
 
     #no exact match, trying substring/fuzzy

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Search.pm | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list