Let parent handle deciding which columns to search - gives advanced search functionality to link searches

This commit is contained in:
Nathan Gray 2010-06-14 14:27:27 +00:00
parent cab28f03b6
commit 62ddbda9f0

View File

@ -676,19 +676,14 @@ class timesheet_bo extends so_sql_cf
*/ */
function link_query( $pattern, Array &$options = array() ) function link_query( $pattern, Array &$options = array() )
{ {
$criteria = array();
$limit = false; $limit = false;
$need_count = false; $need_count = false;
foreach(array('ts_project','ts_title','ts_description') as $col)
{
$criteria[$col] = $pattern;
}
if($options['start'] || $options['num_rows']) { if($options['start'] || $options['num_rows']) {
$limit = array($options['start'], $options['num_rows']); $limit = array($options['start'], $options['num_rows']);
$need_count = true; $need_count = true;
} }
$result = array(); $result = array();
foreach((array) $this->search($criteria,false,'','','%',false,'OR', $limit, null, '', $need_count) as $ts ) foreach((array) $this->search($pattern,false,'','','%',false,'OR', $limit, null, '', $need_count) as $ts )
{ {
if ($ts) $result[$ts['ts_id']] = $this->link_title($ts); if ($ts) $result[$ts['ts_id']] = $this->link_title($ts);
} }