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:
abijah
2009-08-14 20:58:50 +00:00
parent c31c3a3cdc
commit e42c83c585
5 changed files with 151 additions and 38 deletions

View File

@@ -10,6 +10,7 @@ class Tender extends AppModel {
),
'NsfTransaction' => array(
'className' => 'Transaction',
'dependent' => true,
),
);
@@ -17,8 +18,8 @@ class Tender extends AppModel {
/**************************************************************************
**************************************************************************
**************************************************************************
* function: beforeSave
* - Performs any work needed before the save occurs
* function: afterSave
* - Performs any work needed after the save occurs
*/
function afterSave($created) {
@@ -49,6 +50,28 @@ class Tender extends AppModel {
}
/**************************************************************************
**************************************************************************
**************************************************************************
* function: beforeDelete
* - Performs any work needed before the delete occurs
*/
function beforeDelete($cascade = true) {
// REVISIT <AP>: 20090814
// Experimental, and incomplete mechanism to protect
// against trying to delete data that shouldn't be deleted.
$deposit_id = $this->field('deposit_transaction_id');
pr(compact('deposit_id'));
// If this tender has already been deposited, it would
// be a rats nest to figure out how to delete this tender.
if (!empty($deposit_id))
return false;
return parent::beforeDelete($cascade);
}
/**************************************************************************
**************************************************************************
**************************************************************************