Fixed a bug where the condition is of the form array('field' => null). That's a valid condition, but was being treated the same as array('field'). This resolves it, although it will break anyone using the gridDataFilterConditionsStatement virtual function. I don't think anyone is at the moment, although I didn't check.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@450 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 03:46:59 +00:00
parent 4c7e3d1f58
commit 53a8d8fc60

View File

@@ -388,7 +388,11 @@ class AppController extends Controller {
continue;
$conditions[]
= $this->gridDataFilterConditionsStatement($params, $model, $table, $key, $split['value']);
= $this->gridDataFilterConditionsStatement($params, $model, $table, $key,
array_intersect_key
($split,
array('value'=>1,
'value_present'=>1)));
}
return $conditions;
@@ -409,17 +413,19 @@ class AppController extends Controller {
function gridDataFilterConditionsStatement(&$params, &$model, $table, $key, $value) {
$key = (empty($table)?"":"{$table}.") . $key;
if (isset($value))
return array($key => $value);
if (isset($value['value_present']) && $value['value_present'])
return array($key => $value['value']);
else
return array($key);
}
function gridDataFilterSplit(&$params, &$model, $filter, $value) {
$value_present = true;
if (!is_string($filter)) {
// only a filter condition was set, not filter=>value
$filter = $value;
$value = null;
$value_present = false;
}
$table = $field = null;
@@ -440,7 +446,7 @@ class AppController extends Controller {
$field = $filter;
}
return array('table' => $table, 'field' => $field, 'value' => $value);
return compact('table', 'field', 'value', 'value_present');
}
function gridDataFilterTableName(&$params, &$model, $table) {