git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@387 97e9348a-65ac-dc4b-aefc-98561f571b83
59 lines
1.8 KiB
PHP
59 lines
1.8 KiB
PHP
<?php
|
|
class TenderType extends AppModel {
|
|
|
|
var $hasMany = array(
|
|
'Tender',
|
|
);
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: accountID
|
|
* - Returns the intended account ID for receipt of the given tender
|
|
*/
|
|
function accountID($id) {
|
|
$this->cacheQueries = true;
|
|
$item = $this->find('first', array
|
|
('contain' => false,
|
|
'conditions' => array('TenderType.id' => $id),
|
|
));
|
|
$this->cacheQueries = false;
|
|
//pr(compact('id', 'item'));
|
|
return $item['TenderType']['account_id'];
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: paymentTypes
|
|
* - Returns an array of types that can be used for payments
|
|
*/
|
|
|
|
function paymentTypes($extra = null) {
|
|
$this->cacheQueries = true;
|
|
$accounts = $this->find('all', array
|
|
('contain' => false,
|
|
'order' => array('name'),
|
|
) + (isset($extra) ? $extra : array())
|
|
);
|
|
$this->cacheQueries = false;
|
|
|
|
return $accounts;
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: defaultPaymentTypes
|
|
* - Returns an array of types that can be used for payments
|
|
*/
|
|
|
|
function defaultPaymentType() {
|
|
return $this->nameToID('Check');
|
|
}
|
|
|
|
}
|
|
?>
|