Added a check to ensure we're not adding a close with no accounts. This check should probably be in the model, but that can be done later.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@465 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-01 01:48:07 +00:00
parent 267357a0f7
commit a9ef3a75ae

View File

@@ -234,7 +234,9 @@ class TransactionsController extends AppController {
($deposit, $this->data['Deposit']['Account']['id']);
//pr(compact('deposit', 'result'));
// Now find out which accounts are to be closed...
// Close any ledgers necessary
if (!empty($close_type_ids)) {
// Find the accounts associated with the types to close ...
$accounts = $this->Transaction->DepositTender->find
('all',
array('contain' => array('TenderType.account_id'),
@@ -244,6 +246,7 @@ class TransactionsController extends AppController {
// ... and close them
$this->Transaction->Account->closeCurrentLedgers
(array_map(create_function('$item', 'return $item["TenderType"]["account_id"];'), $accounts));
}
// Look out for errors
if ($result['error']) {