Enabled Search, Improved Navbar, Fixed Application Authorisation and some other minor fixes
This commit is contained in:
@@ -529,25 +529,25 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
/**
|
||||
* Search for invoices matching a term
|
||||
*/
|
||||
public function list_autocomplete($term,$index='id') {
|
||||
$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();
|
||||
|
||||
if (is_numeric($term)) {
|
||||
$this->clear();
|
||||
$value = 'account->name(TRUE)';
|
||||
$ao = Auth::instance()->get_user();
|
||||
|
||||
// Build our where clause
|
||||
$this->where('id','like','%'.$term.'%');
|
||||
$this->clear();
|
||||
$this->where_active();
|
||||
|
||||
// @todo This should limit the results so that users dont see other users services.
|
||||
foreach ($this->find_all() as $o)
|
||||
$result[$o->$index] = array(
|
||||
'value'=>$o->$index,
|
||||
'label'=>sprintf('INV %s: %s',$o->id,Table::resolve($o,$value)),
|
||||
);
|
||||
}
|
||||
// Build our where clause
|
||||
$this->where_open()
|
||||
->where('id','like','%'.$term.'%')
|
||||
->where_close();
|
||||
|
||||
return $result;
|
||||
// Restrict results to authorised accounts
|
||||
array_push($limit,array('account_id','IN',$ao->RTM->customers($ao->RTM)));
|
||||
|
||||
return parent::list_autocomplete($term,$index,$value,$label,$limit,$options);
|
||||
}
|
||||
|
||||
private function _list_due() {
|
||||
|
Reference in New Issue
Block a user