Several changes in an effort to support charge reversals. I can't imagine this is all working flawlessly, as I'm not quite sure how it even _should_ work.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@490 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-05 07:54:57 +00:00
parent a84655bcb7
commit adc901b7e7
5 changed files with 217 additions and 211 deletions

View File

@@ -191,7 +191,7 @@ class StatementEntriesController extends AppController {
function waive($id) {
$this->StatementEntry->waive($id);
//$this->redirect(array('action'=>'view', $id));
$this->redirect(array('action'=>'view', $id));
}
@@ -223,44 +223,6 @@ class StatementEntriesController extends AppController {
$reconciled = $this->StatementEntry->reconciledEntries($id);
/* // REVISIT <AP>: 20090711 */
/* // It's not clear whether we should be able to reverse charges that have */
/* // already been paid/cleared/reconciled. Certainly, that will be the */
/* // case when someone has pre-paid and then moves out early. However, this */
/* // will work well for items accidentally charged but not yet paid for. */
/* if ((!$entry['DebitLedger']['Account']['trackable'] || */
/* $stats['debit']['amount_reconciled'] == 0) && */
/* (!$entry['CreditLedger']['Account']['trackable'] || */
/* $stats['credit']['amount_reconciled'] == 0) */
/* && 0 */
/* ) */
/* { */
/* // Set up dynamic menu items */
/* $this->sidemenu_links[] = */
/* array('name' => 'Operations', 'header' => true); */
/* $this->sidemenu_links[] = */
/* array('name' => 'Undo', */
/* 'url' => array('action' => 'reverse', */
/* $id)); */
/* } */
/* if ($this->StatementEntry->Ledger->Account->type */
/* ($entry['CreditLedger']['Account']['id']) == 'INCOME') */
/* { */
/* // Set up dynamic menu items */
/* $this->sidemenu_links[] = */
/* array('name' => 'Operations', 'header' => true); */
/* $this->sidemenu_links[] = */
/* array('name' => 'Reverse', */
/* 'url' => array('action' => 'reverse', */
/* $id)); */
/* } */
$stats = $this->StatementEntry->stats($id);
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE')
@@ -269,16 +231,21 @@ class StatementEntriesController extends AppController {
$stats = $stats['Disbursement'];
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE' &&
$stats['balance'] > 0) {
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE') {
// Set up dynamic menu items
$this->sidemenu_links[] =
array('name' => 'Operations', 'header' => true);
$this->sidemenu_links[] =
array('name' => 'Waive Balance',
'url' => array('action' => 'waive',
array('name' => 'Reverse',
'url' => array('action' => 'reverse',
$id));
if ($stats['balance'] > 0)
$this->sidemenu_links[] =
array('name' => 'Waive Balance',
'url' => array('action' => 'waive',
$id));
}
// Prepare to render.