Added Payment, other minor fixes
This commit is contained in:
@@ -135,7 +135,7 @@ class Model_Invoice extends ORMOSB {
|
||||
}
|
||||
|
||||
public function payments() {
|
||||
return ($this->loaded() AND ! $this->_changed) ? $this->payment_item->find_all() : NULL;
|
||||
return ($this->loaded() AND ! $this->_changed) ? $this->payment_item->find_all() : array();
|
||||
}
|
||||
|
||||
public function payments_total($format=FALSE) {
|
||||
@@ -406,6 +406,30 @@ class Model_Invoice extends ORMOSB {
|
||||
|
||||
/** LIST FUNCTIONS **/
|
||||
|
||||
/**
|
||||
* Search for invoices matching a term
|
||||
*/
|
||||
public function list_autocomplete($term,$index='id') {
|
||||
$return = array();
|
||||
|
||||
if (is_numeric($term)) {
|
||||
$this->clear();
|
||||
$value = 'account->name(TRUE)';
|
||||
|
||||
// Build our where clause
|
||||
$this->where('id','like','%'.$term.'%');
|
||||
|
||||
// @todo This should limit the results so that users dont see other users services.
|
||||
foreach ($this->find_all() as $o)
|
||||
$return[$o->$index] = array(
|
||||
'value'=>$o->$index,
|
||||
'label'=>sprintf('INV %s: %s',$o->id,Table::resolve($o,$value)),
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function _list_active() {
|
||||
return ORM::factory('invoice')->where('status','=',1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user