more search improvements
This commit is contained in:
parent
48341ce8dc
commit
faa3921e6d
@ -36,6 +36,7 @@ class Controller_api_customers extends Crunchbutton_Controller_RestAccount {
|
||||
';
|
||||
|
||||
if ($search) {
|
||||
$search = stripslashes($search);
|
||||
$words = preg_split("/[\s,]*\\\"([^\\\"]+)\\\"[\s,]*|" . "[\s,]*'([^']+)'[\s,]*|" . "[\s,]+/", $search, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
foreach ($words as $word) {
|
||||
$sq .= ($sq ? ' AND ' : '').'(
|
||||
|
||||
@ -70,7 +70,9 @@ class Controller_api_orders extends Crunchbutton_Controller_RestAccount {
|
||||
}
|
||||
|
||||
if ($search) {
|
||||
$search = stripslashes($search);
|
||||
$words = preg_split("/[\s,]*\\\"([^\\\"]+)\\\"[\s,]*|" . "[\s,]*'([^']+)'[\s,]*|" . "[\s,]+/", $search, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
foreach ($words as $word) {
|
||||
$sq .= ($sq ? ' AND ' : '').'(
|
||||
restaurant.name LIKE "%'.$word.'%"
|
||||
|
||||
@ -74,6 +74,7 @@ class Controller_api_staff extends Crunchbutton_Controller_RestAccount {
|
||||
|
||||
|
||||
if ($search) {
|
||||
$search = stripslashes($search);
|
||||
$words = preg_split("/[\s,]*\\\"([^\\\"]+)\\\"[\s,]*|" . "[\s,]*'([^']+)'[\s,]*|" . "[\s,]+/", $search, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
foreach ($words as $word) {
|
||||
$sq .= ($sq ? ' AND ' : '').'(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user