Added support for deleting (destroying) a transaction. This is strictly development/super-admin type functionality.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@553 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -361,6 +361,21 @@ class TransactionsController extends AppController {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: destroy
|
||||
* - Deletes a transaction and associated entries
|
||||
* - !!WARNING!! This should be used with EXTREME caution, as it
|
||||
* irreversibly destroys the data. It is not for normal use.
|
||||
*/
|
||||
|
||||
function destroy($id = null) {
|
||||
$this->Transaction->destroy($id);
|
||||
//$this->redirect(array('action' => 'index'));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -397,11 +412,19 @@ class TransactionsController extends AppController {
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT') {
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT' || $this->params['dev']) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Slip', 'url' => array('action' => 'deposit_slip', $id));
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT')
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Slip', 'url' => array('action' => 'deposit_slip', $id));
|
||||
if ($this->params['dev'])
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Destroy', 'url' => array('action' => 'destroy', $id),
|
||||
'confirmMessage' => ("This may leave the database in an unstable state." .
|
||||
" Do NOT do this unless you know what you're doing." .
|
||||
" Proceed anyway?"));
|
||||
}
|
||||
|
||||
// OK, prepare to render.
|
||||
@@ -454,15 +477,12 @@ class TransactionsController extends AppController {
|
||||
$type['TenderType'] + $type[0];
|
||||
}
|
||||
|
||||
// For each form of tender in the deposit, get the deposit items
|
||||
/* foreach ($deposit['types'] AS $type_id => &$type) { */
|
||||
/* $type['entries'] = $this->Transaction->DepositTender->find */
|
||||
/* ('all', */
|
||||
/* array('contain' => array('Customer', 'LedgerEntry'), */
|
||||
/* 'conditions' => array(array('DepositTender.deposit_transaction_id' => $id), */
|
||||
/* array('DepositTender.tender_type_id' => $type_id)), */
|
||||
/* )); */
|
||||
/* } */
|
||||
$deposit_total = 0;
|
||||
foreach ($deposit['types'] AS $type)
|
||||
$deposit_total += $type['total'];
|
||||
|
||||
if ($deposit['Transaction']['amount'] != $deposit_total)
|
||||
INTERNAL_ERROR("Deposit items do not add up to deposit slip total");
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
Reference in New Issue
Block a user