Got rid of LATE as a unit status, as it did not represent an physical condition. The logic was moved to Lease, where it is a much better fit. The sitemap still presents LATE units, as it is a useful view, but the underlying logic is driven from Lease, not Unit. This checkin also includes a small feature change to how late charges are assessed, as well as a menu item to kick off the charge assessments (both accidentally wedged in to this changeset).

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@547 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-13 20:55:19 +00:00
parent 091920d80a
commit 791b2d8ab1
9 changed files with 87 additions and 98 deletions

View File

@@ -25,7 +25,6 @@ class Unit extends AppModel {
var $hasMany = array(
'Lease',
'MapsUnit',
);
//var $default_log_level = array('log' => 30, 'show' => 15);
@@ -88,16 +87,6 @@ class Unit extends AppModel {
return $this->prReturn(true);
}
function delinquent($enum) {
INTERNAL_ERROR("NOT YET FULLY IMPLEMENTED (Need check for LATE)");
return $this->statusCheck($enum, 'OCCUPIED', true, null, false);
}
function conditionDelinquent() {
return ('(Unit.status > ' . $this->statusValue('OCCUPIED') .
" OR " . $this->delinquentTest() . ")");
}
function occupied($enum) {
return $this->statusCheck($enum, 'OCCUPIED', false, null, false);
}
@@ -149,13 +138,6 @@ class Unit extends AppModel {
($val < $this->occupiedEnumValue())) {
unset($enums[$enum]);
}
// REVISIT <AP>: 20090812
// LATE is the only temporal condition, and somehow
// feels like it should be treated differently than
// the rest. How can a unit be marked as LATE when
// it is not inherent, but a function of time?
if ($enum === 'LATE')
unset($enums[$enum]);
}
return $this->prReturn($enums);
@@ -199,27 +181,6 @@ class Unit extends AppModel {
}
/**************************************************************************
**************************************************************************
**************************************************************************
* function: statusField
* - Returns the status field SQL query
*/
function delinquentTest() {
return ("(`status` = 'OCCUPIED' AND " .
/* "(DATE_ADD(CurrentLease.paid_through_date, INTERVAL 10 DAY)" . */
/* " < CurrentLease.charge_through_date)," . */
" (DATE_ADD(CurrentLease.paid_through_date, INTERVAL 15 DAY)" .
" < NOW()))");
}
function statusFields() {
return array(
//"IF(`status` = 'OCCUPIED' AND " . $this->delinquentTest() . "," .
"IF(" . $this->delinquentTest() . "," .
" 'LATE', `status`) AS 'status'");
}
/**************************************************************************
**************************************************************************
**************************************************************************
@@ -227,11 +188,6 @@ class Unit extends AppModel {
* - Update any cached or calculated fields
*/
function update($id) {
$unit = $this->find('first',
array('contain' => array('CurrentLease'),
'conditions' => array('Unit.id' => $id),
));
}