Example #1
0
 public function _new()
 {
     parent::_new();
     $whlocation = $this->_uses[$this->modeltype];
     $account = new GLAccount();
     $glaccounts = array('' => 'None');
     $glaccounts += $account->nonControlAccounts();
     $this->view->set('accounts', $glaccounts);
     if (isset($_POST[$this->modeltype]['glaccount_id'])) {
         $default_glaccount_id = $_POST[$this->modeltype]['glaccount_id'];
     } elseif ($whlocation->isLoaded()) {
         $default_glaccount_id = $whlocation->glaccount_id;
     } else {
         $default_glaccount_id = '';
     }
     $this->view->set('centres', $this->getCentres($default_glaccount_id));
 }
Example #2
0
 public function _new()
 {
     parent::_new();
     $glaccount = new GLAccount();
     $accounts = $glaccount->nonControlAccounts();
     $this->view->set('accounts', $accounts);
     $budget = $this->_uses[$this->modeltype];
     if (isset($_POST[$this->modeltype]['glaccount_id'])) {
         $default_account_id = $_POST[$this->modeltype]['glaccount_id'];
     } elseif ($budget->isLoaded()) {
         $default_account_id = $budget->glaccount_id;
     } else {
         $account = new GLAccount();
         $accounts = $account->getAll();
         $default_account_id = key($accounts);
     }
     $this->view->set('centres', $this->getCentres($default_account_id));
 }