Enabled Search, Improved Navbar, Fixed Application Authorisation and some other minor fixes

This commit is contained in:
Deon George
2013-05-08 19:00:47 +10:00
parent 364cb58b7b
commit ce17247db6
27 changed files with 877 additions and 67 deletions

View File

@@ -178,31 +178,25 @@ class Model_Service extends ORM_OSB {
/**
* Search for services matching a term
*/
public function list_autocomplete($term,$index='id',array $limit=array()) {
$result = array();
public function list_autocomplete($term,$index,$value,array $label,array $limit=array(),array $options=NULL) {
// We only show invoice numbers.
if (! is_numeric($term))
return array();
$ao = Auth::instance()->get_user();
$this->clear();
$this->where_active();
$value = 'service_name()';
// Build our where clause
$this->where_open()
->where('id','like','%'.$term.'%')
->where_close();
->where('id','like','%'.$term.'%')
->where_close();
foreach ($limit as $w) {
list($k,$s,$v) = $w;
// Restrict results to authorised accounts
array_push($limit,array('account_id','IN',$ao->RTM->customers($ao->RTM)));
$this->and_where($k,$s,$v);
}
foreach ($this->find_all() as $o)
$result[$o->$index] = array(
'value'=>$o->$index,
'label'=>sprintf('SVC %s: %s',$o->id,Table::resolve($o,$value)),
);
return $result;
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
}
public function list_bylistgroup($cat) {