diff --git a/site/app_controller.php b/site/app_controller.php index fd73846..c081397 100644 --- a/site/app_controller.php +++ b/site/app_controller.php @@ -948,13 +948,22 @@ class AppController extends Controller { 'value' => $params['filtValue']); } + // Translate a user specified date into the SQL date format + foreach ($searches AS &$search) { + if (preg_match('/(_date|stamp)$/', $search['field']) && + preg_match('%(\d{1,2})[-/](\d{1,2})[-/](\d{2,4})%', $search['value'], $matches)) { + $search['value'] = sprintf('%04d%02d%02d', $matches[3], $matches[2], $matches[1]); + } + } + unset($search); + $ops = array('eq' => array('op' => null, 'pre' => '', 'post' => ''), 'ne' => array('op' => '<>', 'pre' => '', 'post' => ''), 'lt' => array('op' => '<', 'pre' => '', 'post' => ''), 'le' => array('op' => '<=', 'pre' => '', 'post' => ''), 'gt' => array('op' => '>', 'pre' => '', 'post' => ''), 'ge' => array('op' => '>=', 'pre' => '', 'post' => ''), - 'in' => array('op' => 'IN', 'pre' => '(', 'post' => ')'), + 'in' => array('op' => 'IN', 'pre' => '(', 'post' => ')'), 'bw' => array('op' => 'LIKE', 'pre' => '', 'post' => '%'), 'ew' => array('op' => 'LIKE', 'pre' => '%', 'post' => ''), 'cn' => array('op' => 'LIKE', 'pre' => '%', 'post' => '%'), @@ -1157,7 +1166,7 @@ class AppController extends Controller { } function gridDataOutputSummary(&$params, &$model, $pagination) { - if ($params['debug']) + if ($params['debug']) echo " \n"; echo " {$pagination['page']}\n"; echo " {$pagination['total']}\n";