Forums / Bug Reports / BUG - Parenthesis in last name breaks customer lookup

BUG - Parenthesis in last name breaks customer lookup

Locked

Views: 1,666

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
29 Jan 2007, 10:55 PM
#1
thedust2010 avatar

thedust2010

New Zenner

Join Date:
May 2005
Posts:
46
Plugin Contributions:
0

BUG - Parenthesis in last name breaks customer lookup

When there are any parenthesis in the customer's last name, the customer lookup is broken. For instance, I log in to admin and from the homepage I see a list of "New Customers". If I click to user's name there to search for them, I get the following error:

1139 Got error 'parentheses not balanced' from regexp
in:
[select count(*) as total from customers c left join customers_info ci on c.customers_id= ci.customers_info_id left join address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id where c.customers_lastname like '%List - ( Carniva Miracle%' or c.customers_firstname like '%List - ( Carniva Miracle%' or c.customers_email_address like '%List - ( Carniva Miracle%' or c.customers_telephone rlike 'List - ( Carniva Miracle' or a.entry_company rlike 'List - ( Carniva Miracle' or a.entry_street_address rlike 'List - ( Carniva Miracle' or a.entry_city rlike 'List - ( Carniva Miracle' or a.entry_postcode rlike 'List - ( Carniva Miracle']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

29 Jan 2007, 11:48 PM
#2
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: BUG - Parenthesis in last name breaks customer lookup

Just searched over Google for this type of error and this is what I have determined;

In your admin/customers.php file,

find :

$search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike '" . $keywords . "' or a.entry_company rlike '" . $keywords . "' or a.entry_street_address rlike '" . $keywords . "' or a.entry_city rlike '" . $keywords . "' or a.entry_postcode rlike '" . $keywords . "'";

replace with:

$search = "where (c.customers_lastname like '%" . $keywords . "%') or (c.customers_firstname like '%" . $keywords . "%') or (c.customers_email_address like '%" . $keywords . "%') or (c.customers_telephone rlike '" . $keywords . "') or (a.entry_company rlike '" . $keywords . "') or (a.entry_street_address rlike '" . $keywords . "') or (a.entry_city rlike '" . $keywords . "') or (a.entry_postcode rlike '" . $keywords . "')";
29 Jan 2007, 11:52 PM
#3
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: BUG - Parenthesis in last name breaks customer lookup

Just searched over Google for this type of error and this is what I have determined;

In your admin/customers.php file,

find :

$search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike '" . $keywords . "' or a.entry_company rlike '" . $keywords . "' or a.entry_street_address rlike '" . $keywords . "' or a.entry_city rlike '" . $keywords . "' or a.entry_postcode rlike '" . $keywords . "'";

replace with:

$search = "where (c.customers_lastname like '%" . $keywords . "%') or (c.customers_firstname like '%" . $keywords . "%') or (c.customers_email_address like '%" . $keywords . "%') or (c.customers_telephone rlike '" . $keywords . "') or (a.entry_company rlike '" . $keywords . "') or (a.entry_street_address rlike '" . $keywords . "') or (a.entry_city rlike '" . $keywords . "') or (a.entry_postcode rlike '" . $keywords . "')";

Additionally, this is what admin/linkpoint_review.php states similarly:

$search = "where lp.customer_id = c.customers_id and (c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike '" . $keywords . "' or c.customers_id='" . $keywords . "')";

The parenthese are in. :wink2: