Moved date formatting fully into the AppModel, automatically determining the necessary fields from the schema.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@233 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
class Transaction extends AppModel {
|
||||
|
||||
var $name = 'Transaction';
|
||||
/* var $validate = array( */
|
||||
/* 'stamp' => array('date') */
|
||||
/* ); */
|
||||
|
||||
var $validate = array(
|
||||
'stamp' => array('date')
|
||||
);
|
||||
|
||||
var $belongsTo = array(
|
||||
);
|
||||
@@ -13,20 +14,5 @@ class Transaction extends AppModel {
|
||||
'LedgerEntry',
|
||||
);
|
||||
|
||||
|
||||
function beforeSave() {
|
||||
|
||||
if(isset($this->data['Transaction']['stamp']) &&
|
||||
$this->data['Transaction']['stamp'] !== 'CURRENT_TIMESTAMP') {
|
||||
$this->data['Transaction']['stamp'] =
|
||||
$this->dateFormatBeforeSave($this->data['Transaction']['stamp']);
|
||||
}
|
||||
else {
|
||||
$this->data['Transaction']['stamp'] = null;
|
||||
}
|
||||
|
||||
return parent::beforeSave();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user