Skip to content

Commit

Permalink
Merge pull request #181 from Lonnen/inline-simple
Browse files Browse the repository at this point in the history
Bug 705025 - inline _simple method for great justice
  • Loading branch information
adngdb committed Nov 24, 2011
2 parents 4e7eb60 + b43d6e7 commit 220d616
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions webapp-php/application/controllers/query.php
Expand Up @@ -87,31 +87,7 @@ private function _option_types()
'startswith' => 'starts with'
);
}

/**
* Handle a quick search query for either a OOID or stack signature.
*
* @param array An array of _GET parameters
* @return array An array of updated _GET parameters
*/
public function _simple($params)
{
if (!empty($params['query'])) {
$crash = new Crash();
$ooid = $crash->parseOOID($params['query']);

if ($ooid !== FALSE) {
return url::redirect('report/index/' . $ooid);
} else {
$params['query_search'] = 'signature';
$params['query_type'] = 'exact';
$params['range_value'] = 1;
$params['range_unit'] = 'weeks';
}
}
return $params;
}


/**
* Update search parameters as needed.
*
Expand Down Expand Up @@ -171,7 +147,19 @@ public function query() {

// Handle simple queries. Determine if searching for OOID or Signature.
if (isset($_GET['query_type']) && $_GET['query_type'] == 'simple') {
$params = $this->_simple($params);
if (!empty($params['query'])) {
$crash = new Crash();
$ooid = $crash->parseOOID($params['query']);

if ($ooid !== FALSE) {
return url::redirect('report/index/' . $ooid);
} else {
$params['query_search'] = 'signature';
$params['query_type'] = 'exact';
$params['range_value'] = 1;
$params['range_unit'] = 'weeks';
}
}
}

$queryFormData = $this->queryFormHelper->prepareCommonViewData($this->branch_model, $this->platform_model);
Expand Down

0 comments on commit 220d616

Please sign in to comment.