more search improvements

This commit is contained in:
Devin Smith 2014-11-20 18:50:47 -08:00
parent 48341ce8dc
commit faa3921e6d
3 changed files with 4 additions and 0 deletions

View File

@ -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 ' : '').'(

View File

@ -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.'%"

View File

@ -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 ' : '').'(