Created
March 31, 2020 19:04
-
-
Save xxxrazorxxx/7c930d4b31a49a99770e37cc0cbc4238 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/functions/fn.cart.php b/app/functions/fn.cart.php | |
index 444b53a40ae..bc436b5a759 100644 | |
--- a/app/functions/fn.cart.php | |
+++ b/app/functions/fn.cart.php | |
@@ -6972,11 +6972,24 @@ function fn_get_orders($params, $items_per_page = 0, $get_totals = false, $lang_ | |
if (isset($params['cname']) && fn_string_not_empty($params['cname'])) { | |
$customer_name = fn_explode(' ', $params['cname']); | |
- $customer_name = array_filter($customer_name, "fn_string_not_empty"); | |
+ $customer_name = array_filter($customer_name, 'fn_string_not_empty'); | |
if (sizeof($customer_name) == 2) { | |
- $_condition .= db_quote(" $union_condition ?:orders.firstname LIKE ?l AND ?:orders.lastname LIKE ?l", "%" . array_shift($customer_name) . "%", "%" . array_shift($customer_name) . "%"); | |
+ $_condition .= db_quote( | |
+ ' ?p ((?:orders.firstname LIKE ?l AND ?:orders.lastname LIKE ?l)' | |
+ . ' OR (?:orders.firstname LIKE ?l AND ?:orders.lastname LIKE ?l))', | |
+ $union_condition, | |
+ '%' . $customer_name[0] . '%', | |
+ '%' . $customer_name[1] . '%', | |
+ '%' . $customer_name[1] . '%', | |
+ '%' . $customer_name[0] . '%' | |
+ ); | |
} else { | |
- $_condition .= db_quote(" $union_condition (?:orders.firstname LIKE ?l OR ?:orders.lastname LIKE ?l)", "%" . trim($params['cname']) . "%", "%" . trim($params['cname']) . "%"); | |
+ $_condition .= db_quote( | |
+ ' ?p (?:orders.firstname LIKE ?l OR ?:orders.lastname LIKE ?l)', | |
+ $union_condition, | |
+ '%' . trim($params['cname']) . '%', | |
+ '%' . trim($params['cname']) . '%' | |
+ ); | |
} | |
} | |
diff --git a/app/functions/fn.users.php b/app/functions/fn.users.php | |
index 0b1ee5151e1..24d1180681c 100644 | |
--- a/app/functions/fn.users.php | |
+++ b/app/functions/fn.users.php | |
@@ -1310,8 +1310,10 @@ function fn_get_users($params, &$auth, $items_per_page = 0, $custom_view = '') | |
$search_string = '%' . trim($params['name']) . '%'; | |
if (sizeof($arr) == 2) { | |
- $like_expression .= db_quote('?:users.firstname LIKE ?l', '%' . array_shift($arr) . '%'); | |
- $like_expression .= db_quote(' OR ?:users.lastname LIKE ?l', '%' . array_shift($arr) . '%'); | |
+ $like_expression .= db_quote('(?:users.firstname LIKE ?l', '%' . $arr[0] . '%'); | |
+ $like_expression .= db_quote(' AND ?:users.lastname LIKE ?l)', '%' . $arr[1] . '%'); | |
+ $like_expression .= db_quote(' OR (?:users.firstname LIKE ?l', '%' . $arr[1] . '%'); | |
+ $like_expression .= db_quote(' AND ?:users.lastname LIKE ?l)', '%' . $arr[0] . '%'); | |
} else { | |
$like_expression .= db_quote('?:users.firstname LIKE ?l', $search_string); | |
$like_expression .= db_quote(' OR ?:users.lastname LIKE ?l', $search_string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment