Hi,
you have to create static method in Common part of module called "search" with one parameter - search string.
Return array of links to records.
Contacts and companies search method
public static function search($word){
$ret = array();
if(Utils_RecordBrowserCommon::get_access('contact','browse')) {
$wo = explode(' ', $word);
$crits = array();
foreach ($wo as $w)
$crits = Utils_RecordBrowserCommon::merge_crits($crits, array('("~first_name'=>DB::Concat(DB::qstr('%'),DB::qstr($w),DB::qstr('%')), '|"~last_name'=>DB::Concat(DB::qstr('%'),DB::qstr($w),DB::qstr('%'))));
$result = self::get_contacts($crits);
foreach ($result as $row)
$ret[] = Utils_RecordBrowserCommon::record_link_open_tag('contact', $row['id']).__( 'Contact #%d, %s %s', array($row['id'], $row['first_name'], $row['last_name'])).Utils_RecordBrowserCommon::record_link_close_tag();
}
if(Utils_RecordBrowserCommon::get_access('company','browse')) {
$crits = array('("~company_name' => DB::Concat(DB::qstr('%'),DB::qstr($word),DB::qstr('%')),
'|"~short_name' => DB::Concat(DB::qstr('%'),DB::qstr($word),DB::qstr('%')));
$result = self::get_companies($crits);
foreach ($result as $row)
$ret[] = Utils_RecordBrowserCommon::record_link_open_tag('company', $row['id']).__( 'Company #%d, %s', array($row['id'], $row['company_name'])).Utils_RecordBrowserCommon::record_link_close_tag();
}
return $ret;
}
We have a plans to rewrite search engine to use all recordsets, with some nice admin tool to set fields to search etc, but it's low priority now.
Regards,
Adam