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/site@547 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-13 20:55:19 +00:00
parent 97d16bd712
commit 1fee7646b6
8 changed files with 87 additions and 97 deletions

View File

@@ -95,7 +95,8 @@ class MapsController extends AppController {
array('fields' => array()),
'CurrentLease' =>
array('fields' => array()),
array('fields' => array($this->Map->Unit->CurrentLease->
delinquentField('CurrentLease'))),
'UnitSize' =>
array('fields' => array('id', 'depth', 'width',
@@ -103,15 +104,14 @@ class MapsController extends AppController {
'MapsUnit.pt_left',
'MapsUnit.transpose')),
),
'fields' => array_merge(array('id', 'name'),
$this->Map->Unit->statusFields()),
'fields' => array('id', 'name', 'status'),
'conditions' => array('Map.id' => $id),
));
/* pr(compact('map', 'units')); */
/* $this->render('/fake'); */
/* return; */
/*****
* The preference would be to leave all things "screen" related
* to reside in the view. However, two separate views need this
@@ -136,9 +136,6 @@ class MapsController extends AppController {
// Go through each unit in the map, calculating the map location
foreach ($units AS $unit) {
// Add the calculated fields to the Unit
$unit['Unit'] = $unit[0] + $unit['Unit'];
$lft = $unit['MapsUnit']['pt_left'] + $boundary_adjustment;
$top = $unit['MapsUnit']['pt_top'] + $boundary_adjustment;
@@ -167,7 +164,9 @@ class MapsController extends AppController {
'width' => $width,
'depth' => $depth,
'n-s' => $unit['MapsUnit']['transpose'] ? 0 : 1,
'status' => $unit['Unit']['status']
'status' => (($unit['Unit']['status'] === 'OCCUPIED' &&
!empty($unit[0]['delinquent']))
? 'LATE' : $unit['Unit']['status'])
);
}
@@ -185,8 +184,10 @@ class MapsController extends AppController {
*/
function legend($id = null, $requested_width = 400) {
$status = $this->Map->Unit->activeStatusEnums();
//pr($status);
$status = array_keys($this->Map->Unit->activeStatusEnums());
$occupied_key = array_search('OCCUPIED', $status);
array_splice($status, $occupied_key+1, 0, array('LATE'));
$rows = 2;
$cols = (int)((count($status) + $rows - 1) / $rows);
@@ -216,7 +217,7 @@ class MapsController extends AppController {
$item_width *= $screen_adjustment_factor;
$item_depth *= $screen_adjustment_factor;
foreach ($status AS $code => $value) {
foreach ($status AS $code) {
$info['units'][] = array('name' => $code,
'status' => $code,
'width' => $item_width,
@@ -268,7 +269,7 @@ class MapsController extends AppController {
$info['palate']['unit']['OCCUPIED']['bg'] = array('red' => 0, 'green' => 128, 'blue' => 255);
$info['palate']['unit']['LATE']['bg'] = array('red' => 255, 'green' => 192, 'blue' => 192);
$info['palate']['unit']['LOCKED']['bg'] = array('red' => 255, 'green' => 64, 'blue' => 64);
$info['palate']['unit']['LIENED']['bg'] = array('red' => 255, 'green' => 128, 'blue' => 128);
$info['palate']['unit']['LIENED']['bg'] = array('red' => 255, 'green' => 0, 'blue' => 128);
// Determine text color to go with each background
foreach ($info['palate']['unit'] AS &$code) {