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