git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@409 97e9348a-65ac-dc4b-aefc-98561f571b83
82 lines
2.3 KiB
PHP
82 lines
2.3 KiB
PHP
<?php
|
|
class TenderType extends AppModel {
|
|
|
|
var $belongsTo = array(
|
|
'Account',
|
|
);
|
|
|
|
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;
|
|
return $item['TenderType']['account_id'];
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: paymentTypes
|
|
* - Returns an array of types that can be used for payments
|
|
*/
|
|
|
|
function paymentTypes($query = null) {
|
|
$this->queryInit($query);
|
|
$query['order'][] = 'name';
|
|
|
|
$this->cacheQueries = true;
|
|
$types = $this->find('all', $query);
|
|
$this->cacheQueries = false;
|
|
|
|
return $types;
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: paymentTypes
|
|
* - Returns an array of types that can be deposited
|
|
*/
|
|
|
|
function depositTypes($query = null) {
|
|
$this->queryInit($query);
|
|
$query['order'][] = 'name';
|
|
$query['conditions'][] = array('tillable' => true);
|
|
|
|
$this->cacheQueries = true;
|
|
$types = $this->find('all', $query);
|
|
$this->cacheQueries = false;
|
|
|
|
return $types;
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* function: defaultPaymentType
|
|
* - Returns the ID of the default payment type
|
|
*/
|
|
|
|
function defaultPaymentType() {
|
|
return $this->nameToID('Check');
|
|
}
|
|
|
|
}
|