Skip to content
Snippets Groups Projects
Commit 0226dc4c authored by Jared Hancock's avatar Jared Hancock Committed by Peter Rotich
Browse files

queue: oops: Fix crash searching fields on custom forms

parent e86bc5bc
No related branches found
No related tags found
No related merge requests found
......@@ -905,7 +905,8 @@ class SavedSearch extends VerySimpleModel {
->filter(array('form__type' => 'G'))
->select_related('form');
foreach ($dfs as $field) {
$otherFields[$field->getId()] = array($field->form, $field);
$otherFields[$field->getId()] = array($field->form,
$field->getImpl());
}
}
foreach ($otherFields as $id=>$F) {
......@@ -1154,24 +1155,20 @@ class SavedSearch extends VerySimpleModel {
// Ensure the special join is created to support custom data joins
$name = @static::getOrmPath($name, $qs);
$name2 = null;
if (preg_match('/__answers!\d+__/', $name)) {
// Ensure that only one record is returned from the join through
// the entry and answers joins
$name2 = $this->getAnnotationName().'2';
$query->annotate(array($name2 => SqlAggregate::MAX($name)));
$qs->annotate(array($name2 => SqlAggregate::MAX($name)));
}
// Fetch a criteria Q for the query
if (list(,$field) = $searchable[$name])
if ($q = $field->getSearchQ($method, $value, $name2 ?: $name))
if ($q = $field->getSearchQ($method, $value, $name))
$qs = $qs->filter($q);
}
}
return $qs;
}
function getOrmPath($name, $query=null) {
static function getOrmPath($name, $query=null) {
// Special case for custom data `__answers!id__value`. Only add the
// join and constraint on the query the first pass, when the query
// being mangled is received.
......
......@@ -27,9 +27,9 @@ if (!$view_all_tickets) {
}
$page = ($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1;
$count = count($tickets);
$pageNav = new Pagenate($count, $page, PAGE_LIMIT);
$pageNav->setURL('tickets.php', $args);
$count = count($tickets);
$tickets = $pageNav->paginate($tickets);
// Make sure the cdata materialized view is available
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment