Compare commits

..

10 Commits

Author SHA1 Message Date
abijah
1e6c69c70e Really intended to check the sandbox script into the pre_0.1 branch. I'll do that next, then merge here.
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@812 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-28 20:52:15 +00:00
abijah
75eecd9771 Added script to build a sandbox from the current data. The location of the script is unsafe, but since it can only muck up the sandbox database, it doesn't matter.
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@811 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-28 20:50:52 +00:00
abijah
50eb7c0f5d Merge out from the pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@810 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-28 20:48:52 +00:00
abijah
fbc2de9427 Merge out from the pre_0.1 branch (previous so called 'merge in' was also really a merge out)
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@796 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-27 17:28:12 +00:00
abijah
0e8b541e34 Merge in from the pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@794 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-27 17:23:22 +00:00
abijah
d32b002a98 Changed the theme to make it clear when we're in the sandbox.
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@748 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-23 18:53:21 +00:00
abijah
3c7f02e76c Merge in from pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@747 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-23 18:50:59 +00:00
abijah
3e78240974 Modified to use the sandbox database
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@746 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-23 18:49:20 +00:00
abijah
3b98b74517 Merge in from the pre_0.1 branch
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@744 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-23 14:43:16 +00:00
abijah
9e550c7833 Branch to contain the most stable 0.1 work, along with changes to ensure a sandbox database is used.
git-svn-id: file:///svn-source/pmgr/branches/sandbox_0.1@742 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-23 14:25:05 +00:00
49 changed files with 588 additions and 5643 deletions

View File

@@ -1,3 +1,6 @@
@echo off @echo off
mysql --user=pmgr --password=pmgruser < %~dp0\db\property_manager.sql sed "s/property_manager/pmgr_sand/g" %~dp0\db\property_manager.sql > H:\pmgr_sand.sql
echo Done! mysql --user=pmgr --password=pmgruser < H:\pmgr_sand.sql
del H:\pmgr_sand.sql
echo Rebuild Complete!

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ Operations to be functional
X - Receive and record Money Orders X - Receive and record Money Orders
X - Receive and record Cash X - Receive and record Cash
X - Receive and record ACH Deposits X - Receive and record ACH Deposits
X - Reverse rent charges (early moveout on prepaid occupancy) ? - Reverse rent charges (early moveout on prepaid occupancy)
X - Handle NSF checks X - Handle NSF checks
X - Assess NSF Fees X - Assess NSF Fees
X - Determine Lease Paid-Through status X - Determine Lease Paid-Through status

View File

@@ -39,7 +39,7 @@ class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid'); var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid');
var $components = array('DebugKit.Toolbar'); var $components = array('DebugKit.Toolbar');
var $sidemenu = array('areas' => array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false, 'SANDBOX' => false)); var $sidemenu = array('areas' => array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false));
var $std_area = 10; var $std_area = 10;
var $admin_area = 20; var $admin_area = 20;
var $dev_area = 30; var $dev_area = 30;
@@ -71,8 +71,6 @@ class AppController extends Controller {
$name = Inflector::humanize($this->params['controller']); $name = Inflector::humanize($this->params['controller']);
elseif ($area == 'ACTION') elseif ($area == 'ACTION')
$name = Inflector::humanize(Inflector::singularize($this->params['controller'])); $name = Inflector::humanize(Inflector::singularize($this->params['controller']));
elseif ($area == 'SANDBOX')
$name = 'Sandbox';
if (empty($this->sidemenu['areas'][$area])) if (empty($this->sidemenu['areas'][$area]))
$this->sidemenu['areas'][$area] $this->sidemenu['areas'][$area]
@@ -199,6 +197,7 @@ class AppController extends Controller {
array('controller' => 'transactions', 'action' => 'deposit'), null, array('controller' => 'transactions', 'action' => 'deposit'), null,
'SITE'); 'SITE');
$this->addSideMenuLink('Accounts', $this->addSideMenuLink('Accounts',
array('controller' => 'accounts', 'action' => 'index'), null, array('controller' => 'accounts', 'action' => 'index'), null,
'SITE', $this->admin_area); 'SITE', $this->admin_area);
@@ -220,6 +219,13 @@ class AppController extends Controller {
$this->addSideMenuLink('Stmt Entries', $this->addSideMenuLink('Stmt Entries',
array('controller' => 'statement_entries', 'action' => 'index'), null, array('controller' => 'statement_entries', 'action' => 'index'), null,
'SITE', $this->admin_area); 'SITE', $this->admin_area);
$this->addSideMenuLink('Assess Charges',
array('controller' => 'leases', 'action' => 'assess_all'), null,
'SITE', $this->admin_area);
$this->addSideMenuLink('RESET DATA',
array('controller' => 'accounts', 'action' => 'reset_data'), null,
'SITE', $this->admin_area);
$this->addSideMenuLink('Un-Nuke', $this->addSideMenuLink('Un-Nuke',
'#', array('htmlAttributes' => '#', array('htmlAttributes' =>
@@ -228,56 +234,27 @@ class AppController extends Controller {
$this->addSideMenuLink('New Ledgers', $this->addSideMenuLink('New Ledgers',
array('controller' => 'accounts', 'action' => 'newledger'), null, array('controller' => 'accounts', 'action' => 'newledger'), null,
'SITE', $this->dev_area); 'SITE', $this->dev_area);
//array('name' => 'RESET DATA', array('controller' => 'accounts', 'action' => 'reset_data'));
$this->addSideMenuLink('New Receipt', $this->addSideMenuLink('New Receipt',
array('controller' => 'customers', 'action' => 'receipt'), null, array('controller' => 'customers', 'action' => 'receipt'), null,
'SITE', $this->op_area); 'SITE', $this->op_area);
$this->addSideMenuLink('New Invoice', $this->addSideMenuLink('New Invoice',
array('controller' => 'leases', 'action' => 'invoice'), null, array('controller' => 'leases', 'action' => 'invoice'), null,
'SITE', $this->op_area); 'SITE', $this->op_area);
$this->addSideMenuLink('Move-In', $this->addSideMenuLink('Move-In',
array('controller' => 'customers', 'action' => 'move_in'), null, array('controller' => 'customers', 'action' => 'move_in'), null,
'SITE', $this->op_area); 'SITE', $this->op_area);
$this->addSideMenuLink('Move-Out', $this->addSideMenuLink('Move-Out',
array('controller' => 'leases', 'action' => 'move_out'), null, array('controller' => 'leases', 'action' => 'move_out'), null,
'SITE', $this->op_area); 'SITE', $this->op_area);
$this->addSideMenuLink('New Deposit', $this->addSideMenuLink('New Deposit',
array('controller' => 'tenders', 'action' => 'deposit'), null, array('controller' => 'tenders', 'action' => 'deposit'), null,
'SITE', $this->op_area); 'SITE', $this->op_area);
if (!empty($this->params['admin']))
$this->addSideMenuLink('Assess Charges',
array('controller' => 'leases', 'action' => 'assess_all'), null,
'SITE', $this->op_area);
$url_components = array('plugin', 'controller', 'action', 'named');
if (devbox()) {
/* $sources = ConnectionManager::sourceList(); */
/* $db = ConnectionManager::getDataSource($sources[0])->config['database']; */
/* $this->sideMenuAreaName($db, 'SANDBOX', $this->std_area); */
$this->sideMenuAreaName('DevBox', 'SANDBOX', $this->std_area);
$this->addSideMenuLink('Rebuild DevBox',
array('controller' => 'util', 'action' => 'rebuild_devbox'), null,
'SANDBOX');
}
elseif (sandbox()) {
$this->addSideMenuLink('Rebuild Sandbox',
array('controller' => 'util', 'action' => 'rebuild_sandbox'), null,
'SANDBOX');
$this->addSideMenuLink('Leave Sandbox',
array('sand_route' => false)
+ array_intersect_key($this->params, array_flip($url_components))
+ $this->params['pass'],
null, 'SANDBOX');
}
else {
$this->addSideMenuLink('Enter Sandbox',
array('sand_route' => true)
+ array_intersect_key($this->params, array_flip($url_components))
+ $this->params['pass'],
null, 'SANDBOX');
}
// REVISIT <AP>: 20090824 // REVISIT <AP>: 20090824
// Depending on preference, we may put this into the gridView // Depending on preference, we may put this into the gridView
@@ -304,32 +281,26 @@ class AppController extends Controller {
*/ */
function beforeFilter() { function beforeFilter() {
$this->params['user'] = $this->Permission->User->currentUser(); $this->params['dev'] = $this->Option->enabled('dev');
$this->params['admin'] = $this->Option->enabled('admin'); $this->params['admin'] = $this->Option->enabled('admin');
$this->params['dev'] = devbox();
if ($this->params['dev'] && !$this->Option->enabled('dev'))
$this->redirect("/");
if (!$this->params['dev']) if (!$this->params['dev'])
Configure::write('debug', '0'); Configure::write('debug', '0');
$this->addDefaultSideMenuLinks(); $this->addDefaultSideMenuLinks();
//$this->sideMenuEnable('SITE', $this->op_area, false); $this->sideMenuEnable('SITE', $this->op_area, false);
foreach ($this->sidemenu['areas'] AS $area_name => $area) { foreach ($this->sidemenu['areas'] AS $area_name => $area) {
if (empty($this->params['dev'])) if (empty($this->params['dev']))
$this->sideMenuEnable($area_name, $this->dev_area, false); $this->sideMenuEnable($area_name, $this->dev_area, false);
if (empty($this->params['admin'])) if (empty($this->params['admin']))
$this->sideMenuEnable($area_name, $this->admin_area, false); $this->sideMenuEnable($area_name, $this->admin_area, false);
}
$this->authorize("controller.{$this->params['controller']}");
$this->authorize("controller.{$this->params['controller']}"); $this->authorize("controller.{$this->params['controller']}");
$this->authorize("action.{$this->params['controller']}.{$this->params['action']}"); $this->authorize("action.{$this->params['controller']}.{$this->params['action']}");
$this->authorize("action.{$this->params['controller']}.{$this->params['action']}");
$this->log('----------------------------------------------------------------------', 'request'); }
$this->log('----------------------------------------------------------------------', 'request');
$this->log($this->params, 'request');
} }
@@ -366,21 +337,21 @@ class AppController extends Controller {
foreach ($subarea['priorities'] AS $pname => &$priority) { foreach ($subarea['priorities'] AS $pname => &$priority) {
if (empty($priority)) if (empty($priority))
unset($subarea['priorities'][$pname]); unset($subarea['priorities'][$pname]);
} }
unset($priority); unset($priority);
if (empty($subarea['priorities'])) if (empty($subarea['priorities']))
unset($area['subareas'][$sname]); unset($area['subareas'][$sname]);
} }
unset($subarea); unset($subarea);
if (empty($area['subareas'])) if (empty($area['subareas']))
unset($this->sidemenu['areas'][$aname]); unset($this->sidemenu['areas'][$aname]);
} }
unset($area); unset($area);
// Activate a default section (unless already specified) // Activate a default section (unless already specified)
foreach (array_reverse(array_diff_key($this->sidemenu['areas'], array('SANDBOX'=>1))) AS $area_name => $area) { foreach (array_reverse($this->sidemenu['areas']) AS $area_name => $area) {
if (empty($area)) if (empty($area))
continue; continue;
@@ -429,6 +400,35 @@ class AppController extends Controller {
} }
/**************************************************************************
**************************************************************************
**************************************************************************
* function: reset_data
* - Development function. TO BE DELETED
*/
function reset_data() {
$this->layout = null;
$this->autoLayout = false;
$this->autoRender = false;
Configure::write('debug', '0');
$script = preg_replace("%/webroot/index\.php$%",
"/../build.cmd",
$_SERVER['SCRIPT_FILENAME']);
echo "<P>" . date('r') . "\n";
$db = & $this->Account->getDataSource();
$script .= ' "' . $db->config['database'] . '"';
$script .= ' "' . $db->config['login'] . '"';
$script .= ' "' . $db->config['password'] . '"';
$handle = popen($script . ' 2>&1', 'r');
echo "<P>\n";
while (($read = fread($handle, 2096))) {
echo str_replace("\n", "<BR>\n", htmlspecialchars($read));
}
pclose($handle);
}
/************************************************************************** /**************************************************************************
************************************************************************** **************************************************************************
************************************************************************** **************************************************************************
@@ -600,8 +600,8 @@ class AppController extends Controller {
// Grouping (which would not be typical) // Grouping (which would not be typical)
$query['group'] = $this->gridDataCountGroup($params, $model); $query['group'] = $this->gridDataCountGroup($params, $model);
if ($params['debug']) // DEBUG PURPOSES ONLY!
$params['count_query'] = $query; $params['count_query'] = $query;
// Get the number of records prior to pagination // Get the number of records prior to pagination
return $this->gridDataCountExecute($params, $model, $query); return $this->gridDataCountExecute($params, $model, $query);
@@ -857,8 +857,8 @@ class AppController extends Controller {
isset($params['sidx']) ? $params['sidx'] : null, isset($params['sidx']) ? $params['sidx'] : null,
isset($params['sord']) ? $params['sord'] : null); isset($params['sord']) ? $params['sord'] : null);
if ($params['debug']) // DEBUG PURPOSES ONLY!
$params['query'] = $query; $params['query'] = $query;
return $this->gridDataRecordsExecute($params, $model, $query); return $this->gridDataRecordsExecute($params, $model, $query);
} }
@@ -981,7 +981,6 @@ class AppController extends Controller {
$this->gridDataPostProcessLinks($params, $model, $records, array()); $this->gridDataPostProcessLinks($params, $model, $records, array());
// DEBUG PURPOSES ONLY! // DEBUG PURPOSES ONLY!
//if ($params['debug'])
//$params['records'] = $records; //$params['records'] = $records;
} }
@@ -1059,7 +1058,6 @@ class AppController extends Controller {
continue; continue;
// DEBUG PURPOSES ONLY! // DEBUG PURPOSES ONLY!
//if ($params['debug'])
//$params['linkrecord'][] = compact('table', 'field', 'id', 'controller', 'record'); //$params['linkrecord'][] = compact('table', 'field', 'id', 'controller', 'record');
$record[$table][$field] = $record[$table][$field] =
'<A HREF="' . '<A HREF="' .
@@ -1092,7 +1090,7 @@ class AppController extends Controller {
function gridDataOutputHeader(&$params, &$model) { function gridDataOutputHeader(&$params, &$model) {
if (!$params['debug']) if (!$params['debug'])
header("Content-type: text/xml;charset=utf-8"); header("Content-type: text/xml;charset=utf-8");
} }
function gridDataOutputXMLHeader(&$params, &$model) { function gridDataOutputXMLHeader(&$params, &$model) {
echo "<?xml version='1.0' encoding='utf-8'?>\n"; echo "<?xml version='1.0' encoding='utf-8'?>\n";

View File

@@ -38,13 +38,5 @@ App::import('Core', 'Helper');
*/ */
class AppHelper extends Helper { class AppHelper extends Helper {
function url($url = null, $full = false) {
foreach(array('sand_route', 'dev_route') AS $mod) {
if (isset($this->params[$mod]) && is_array($url) && !isset($url[$mod]))
$url[$mod] = $this->params[$mod];
}
return parent::url($url, $full);
}
} }
?> ?>

View File

@@ -509,7 +509,7 @@ class AppModel extends Model {
function INTERNAL_ERROR($msg, $depth = 0, $force_stop = false) { function INTERNAL_ERROR($msg, $depth = 0, $force_stop = false) {
INTERNAL_ERROR($msg, $force_stop, $depth+1); INTERNAL_ERROR($msg, $force_stop, $depth+1);
echo $this->requestAction(array('controller' => 'util', echo $this->requestAction(array('controller' => 'accounts',
'action' => 'render_empty'), 'action' => 'render_empty'),
array('return', 'bare' => false) array('return', 'bare' => false)
); );

View File

@@ -1,5 +0,0 @@
@echo off
mysqldump --user=pmgr --password=pmgruser --opt property_manager > H:\pmgr_dev.sql
mysql --user=pmgr --password=pmgruser --database=pmgr_dev < H:\pmgr_dev.sql
del H:\pmgr_dev.sql
echo Build Complete!

View File

@@ -1,5 +0,0 @@
@echo off
mysqldump --user=pmgr --password=pmgruser --opt property_manager > H:\pmgr_sand.sql
mysql --user=pmgr --password=pmgruser --database=pmgr_sand < H:\pmgr_sand.sql
del H:\pmgr_sand.sql
echo Build Complete!

View File

@@ -32,36 +32,15 @@
* *
*/ */
function _box($type) { function sandbox() {
static $box = array('type' => null, 'test' => array()); return preg_match("%^/[^/]*sand/%", $_SERVER['REQUEST_URI']);
if (!isset($box['type']) && !isset($box['test'][$type])) {
$r = Router::requestRoute();
/* if (!preg_match("/gridData/", $_SERVER['REQUEST_URI'])) { */
/* print("<PRE>Route:\n");print_r($r);print("\n</PRE>\n"); */
/* } */
$box['test'][$type] = !empty($r[3]["${type}_route"]);
if ($box['test'][$type])
$box['type'] = $type;
}
return $box['type'] == $type;
} }
function sandbox() { return _box('sand'); }
function devbox() { return _box('dev'); }
function server_request_var($var) { function server_request_var($var) {
if (preg_match("/^HTTP_ACCEPT|REMOTE_PORT/", $var)) return (preg_match("/^HTTP/", $var));
return false;
return (preg_match("/^HTTP|REQUEST|REMOTE/", $var));
} }
function INTERNAL_ERROR($message, $exit = true, $drop = 0) { function INTERNAL_ERROR($message, $exit = true, $drop = 0) {
$O = new Object();
for ($i=0; $i<3; ++$i) {
$O->log(str_repeat("\\", 80));
$O->log(str_repeat("/", 80));
}
$O->log("INTERNAL ERROR: $message");
echo '<DIV class="internal-error" style="color:#000; background:#c22; padding:0.5em 1.5em 0.5em 1.5em;">' . "\n"; echo '<DIV class="internal-error" style="color:#000; background:#c22; padding:0.5em 1.5em 0.5em 1.5em;">' . "\n";
echo '<H1 style="color:#000; margin-bottom:0.2em; font-size:2em;">INTERNAL ERROR:</H1>' . "\n"; echo '<H1 style="color:#000; margin-bottom:0.2em; font-size:2em;">INTERNAL ERROR:</H1>' . "\n";
echo '<H2 style="color:#000; margin-top:0; margin-left:1.5em; font-size:1.5em">' . $message . '</H2>' . "\n"; echo '<H2 style="color:#000; margin-top:0; margin-left:1.5em; font-size:1.5em">' . $message . '</H2>' . "\n";
@@ -69,10 +48,8 @@ function INTERNAL_ERROR($message, $exit = true, $drop = 0) {
echo '<BR>It is a problem within the application itself and should be reported to the administrator.</H4>' . "\n"; echo '<BR>It is a problem within the application itself and should be reported to the administrator.</H4>' . "\n";
// Print out the entire stack trace // Print out the entire stack trace
$O->log(str_repeat("-", 30));
$O->log("Stack:");
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nStack Trace:\n"; echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nStack Trace:\n";
echo '<OL style="margin-top:0.5em; margin-left:0.0em";>' . "\n"; echo '<OL style="margin-left:1.5em";>' . "\n";
$trace = array_slice(debug_backtrace(false), $drop); $trace = array_slice(debug_backtrace(false), $drop);
for ($i = 0; $i < count($trace); ++$i) { for ($i = 0; $i < count($trace); ++$i) {
$bline = $trace[$i]['line']; $bline = $trace[$i]['line'];
@@ -88,36 +65,23 @@ function INTERNAL_ERROR($message, $exit = true, $drop = 0) {
$bclas = null; $bclas = null;
} }
$O->log(" $bfile:$bline (" . ($bclas ? "$bclas::$bfunc" : "entry point") . ")");
echo("<LI>$bfile:$bline (" . ($bclas ? "$bclas::$bfunc" : "entry point") . ")</LI>\n"); echo("<LI>$bfile:$bline (" . ($bclas ? "$bclas::$bfunc" : "entry point") . ")</LI>\n");
} }
echo "</OL>\n"; echo "</OL>\n";
$O->log(str_repeat("-", 30));
$O->log("HTTP Request:");
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nHTTP Request:\n"; echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nHTTP Request:\n";
echo '<UL style="margin-top:0.5em; margin-left:0.0em";>' . "\n"; echo '<P><PRE style="color:#000; background:#c22; padding:0.5em 0 0 0;">' . "\n";
foreach($_REQUEST AS $k => $v) { print_r($_REQUEST);
$O->log(sprintf(" %-20s => %s", $k, $v)); echo "</PRE>\n";
echo("<LI>$k =&gt; $v</LI>\n");
}
echo "</UL>\n";
$O->log(str_repeat("-", 30));
$O->log("Server:");
$SRV = array_intersect_key($_SERVER, array_flip(array_filter(array_keys($_SERVER), 'server_request_var')));
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nServer:\n"; echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\nServer:\n";
echo '<UL style="margin-top:0.5em; margin-left:0.0em";>' . "\n"; echo '<P><PRE style="color:#000; background:#c22; padding:0.5em 0 0 0;">' . "\n";
foreach($SRV AS $k => $v) { print_r(array_intersect_key($_SERVER, array_flip(array_filter(array_keys($_SERVER), 'server_request_var'))));
if ($k == 'REQUEST_TIME') echo "</PRE>\n";
$v = date('c', $v);
$O->log(sprintf(" %-20s => %s", $k, $v));
echo("<LI>$k =&gt; $v</LI>\n");
}
echo "</UL>\n";
echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\n"; echo '<HR style="margin-top:1.0em; margin-bottom:0.5em;">' . "\n";
echo date('c') . "<BR>\n"; echo 'Started: ' . date('c', $_SERVER['REQUEST_TIME']) . "<BR>\n";
echo 'Current: ' . date('c') . "<BR>\n";
echo '</DIV>'; echo '</DIV>';
if ($exit) if ($exit)

View File

@@ -7,13 +7,11 @@ class DATABASE_CONFIG {
'host' => 'localhost', 'host' => 'localhost',
'login' => 'pmgr', 'login' => 'pmgr',
'password' => 'pmgruser', 'password' => 'pmgruser',
'database' => 'property_manager', 'database' => 'pmgr_sand',
'prefix' => 'pmgr_', 'prefix' => 'pmgr_',
); );
function __construct() { function __construct() {
if (devbox())
$this->default['database'] = 'pmgr_dev';
if (sandbox()) if (sandbox())
$this->default['database'] = 'pmgr_sand'; $this->default['database'] = 'pmgr_sand';
} }

View File

@@ -36,40 +36,4 @@ $default_path = array('controller' => 'maps', 'action' => 'view', '1');
*/ */
Router::connect('/', $default_path); Router::connect('/', $default_path);
/*
* Route for sandbox functionality
*/
Router::connect('/sand',
array('sand_route' => true) + $default_path);
Router::connect('/sand/:controller/:action/*',
array('sand_route' => true, 'action' => null));
/* Unfortunately, for some reason we need an extra route to solve
* a bug with form generation. When $this->data is set by the
* controller, and a URL is generated by the FormHelper, this
* route is required to ensure the form action is correct. An
* example of a broken page is for /customers/edit/XX. It appears
* the page location uses the route above, it's only URL generation
* that seems to be broken.
*/
Router::connect('/sand/:controller/:action/:id/*',
array('sand_route' => true,'action' => null, 'id'=>null));
/*
* Route for developement functionality
*/
Router::connect('/dev',
array('dev_route' => true) + $default_path);
Router::connect('/dev/:controller/:action/*',
array('dev_route' => true, 'action' => null));
/* Unfortunately, for some reason we need an extra route to solve
* a bug with form generation. When $this->data is set by the
* controller, and a URL is generated by the FormHelper, this
* route is required to ensure the form action is correct. An
* example of a broken page is for /customers/edit/XX. It appears
* the page location uses the route above, it's only URL generation
* that seems to be broken.
*/
Router::connect('/dev/:controller/:action/:id/*',
array('dev_route' => true,'action' => null, 'id'=>null));
?> ?>

View File

@@ -2,12 +2,6 @@
class CustomersController extends AppController { class CustomersController extends AppController {
// DEBUG FUNCTION ONLY!
// Call without id to update ALL customers
function force_update($id = null) {
$this->Customer->update($id);
$this->redirect(array('action'=>'index'));
}
/************************************************************************** /**************************************************************************
************************************************************************** **************************************************************************
@@ -29,9 +23,9 @@ class CustomersController extends AppController {
array('controller' => 'customers', 'action' => 'all'), null, array('controller' => 'customers', 'action' => 'all'), null,
'CONTROLLER'); 'CONTROLLER');
/* $this->addSideMenuLink('New Customer', */ $this->addSideMenuLink('New Customer',
/* array('controller' => 'customers', 'action' => 'add'), null, */ array('controller' => 'customers', 'action' => 'add'), null,
/* 'CONTROLLER', $this->new_area); */ 'CONTROLLER', $this->new_area);
} }

View File

@@ -394,10 +394,6 @@ class LeasesController extends AppController {
$this->set(compact('default_late')); $this->set(compact('default_late'));
if ($type === 'move-in') { if ($type === 'move-in') {
// Make sure we have a valid lease that we're moving in
if (empty($lease))
$this->redirect(array('action' => 'index'));
$movein = array(); $movein = array();
$movein['time'] = strtotime($lease['Lease']['movein_date']); $movein['time'] = strtotime($lease['Lease']['movein_date']);
$movein['effective_time'] = strtotime($lease['Lease']['movein_date']); $movein['effective_time'] = strtotime($lease['Lease']['movein_date']);

View File

@@ -47,17 +47,7 @@ class StatementEntriesController extends AppController {
if (!empty($params['post']['custom']['statement_entry_id'])) { if (!empty($params['post']['custom']['statement_entry_id'])) {
$link['ChargeEntry'] = array(); $link['ChargeEntry'] = array();
// This query actually represents a union... $link['DisbursementEntry'] = array();
// Unpaid Charge/Surplus: ChargeID - NULL; DisbursementID - NULL
// Paid Charge/Refund: ChargeID - NULL; DisbursementID - !NULL
// Disbursement/Reversal: ChargeID - !NULL; DisbursementID - NULL
// <EMPTY SET>: ChargeID - !NULL; DisbursementID - !NULL
//
// The query is really slow unless we add the `id` condition to the join.
// A cleaner query would be nice, but we must work within the Cake framework.
$link['DisbursementEntry'] = array('conditions' =>
'`DisbursementEntry`.`id` = '
. $params['post']['custom']['statement_entry_id']);
} }
return array('link' => $link); return array('link' => $link);

View File

@@ -48,9 +48,9 @@ class TransactionsController extends AppController {
function invoice() { $this->gridView('Invoices'); } function invoice() { $this->gridView('Invoices'); }
function receipt() { $this->gridView('Receipts'); } function receipt() { $this->gridView('Receipts'); }
function deposit() { function deposit() {
/* $this->addSideMenuLink('New Deposit', */ $this->addSideMenuLink('New Deposit',
/* array('controller' => 'tenders', 'action' => 'deposit'), null, */ array('controller' => 'tenders', 'action' => 'deposit'), null,
/* 'CONTROLLER', $this->new_area); */ 'CONTROLLER', $this->new_area);
$this->gridView('Deposits'); $this->gridView('Deposits');
} }
@@ -112,7 +112,7 @@ class TransactionsController extends AppController {
* - handles the creation of a charge invoice * - handles the creation of a charge invoice
*/ */
function postInvoice($redirect = true) { function postInvoice() {
if (!$this->RequestHandler->isPost()) { if (!$this->RequestHandler->isPost()) {
echo('<H2>THIS IS NOT A POST FOR SOME REASON</H2>'); echo('<H2>THIS IS NOT A POST FOR SOME REASON</H2>');
return; return;
@@ -127,17 +127,6 @@ class TransactionsController extends AppController {
die("<H1>INVOICE FAILED</H1>"); die("<H1>INVOICE FAILED</H1>");
} }
if ($redirect) {
if (!empty($this->data['Customer']['id']))
$this->redirect(array('controller' => 'customers',
'action' => 'receipt',
$this->data['Customer']['id']));
else
$this->redirect(array('controller' => 'leases',
'action' => 'view',
$this->data['Lease']['id']));
}
$this->layout = null; $this->layout = null;
$this->autoLayout = false; $this->autoLayout = false;
$this->autoRender = false; $this->autoRender = false;
@@ -151,7 +140,7 @@ class TransactionsController extends AppController {
* - handles the creation of a receipt * - handles the creation of a receipt
*/ */
function postReceipt($redirect = true) { function postReceipt() {
if (!$this->RequestHandler->isPost()) { if (!$this->RequestHandler->isPost()) {
echo('<H2>THIS IS NOT A POST FOR SOME REASON</H2>'); echo('<H2>THIS IS NOT A POST FOR SOME REASON</H2>');
return; return;
@@ -175,11 +164,6 @@ class TransactionsController extends AppController {
die("<H1>RECEIPT FAILED</H1>"); die("<H1>RECEIPT FAILED</H1>");
} }
if ($redirect)
$this->redirect(array('controller' => 'customers',
'action' => 'view',
$this->data['Customer']['id']));
$this->layout = null; $this->layout = null;
$this->autoLayout = false; $this->autoLayout = false;
$this->autoRender = false; $this->autoRender = false;
@@ -393,11 +377,9 @@ class TransactionsController extends AppController {
* irreversibly destroys the data. It is not for normal use. * irreversibly destroys the data. It is not for normal use.
*/ */
function destroy($id) { function destroy($id = null) {
$this->Transaction->id = $id;
$customer_id = $this->Transaction->field('customer_id');
$this->Transaction->destroy($id); $this->Transaction->destroy($id);
$this->redirect(array('controller' => 'customers', 'action' => 'view', $customer_id)); //$this->redirect(array('action' => 'index'));
} }
@@ -441,7 +423,7 @@ class TransactionsController extends AppController {
"This may leave the database in an unstable state." . "This may leave the database in an unstable state." .
" Do NOT do this unless you know what you're doing." . " Do NOT do this unless you know what you're doing." .
" Proceed anyway?"), " Proceed anyway?"),
'ACTION', $this->admin_area); 'ACTION', $this->dev_area);
// OK, prepare to render. // OK, prepare to render.
$title = 'Transaction #' . $transaction['Transaction']['id']; $title = 'Transaction #' . $transaction['Transaction']['id'];

View File

@@ -1,76 +0,0 @@
<?php
class UtilController extends AppController {
var $uses = array();
/**************************************************************************
**************************************************************************
**************************************************************************
* function: reset_data
* - Development function. TO BE DELETED
*/
function reset_data() {
$this->layout = null;
$this->autoLayout = false;
$this->autoRender = false;
Configure::write('debug', '0');
$script = $_SERVER['DOCUMENT_ROOT'] . '/pmgr/build.cmd';
echo "<P>" . date('r') . "\n";
//echo "<P>Script: $script" . "\n";
$handle = popen($script . ' 2>&1', 'r');
//echo "<P>Handle: $handle; " . gettype($handle) . "\n";
echo "<P><PRE>\n";
while (($read = fread($handle, 2096))) {
echo $read;
}
echo "</PRE>\n";
pclose($handle);
}
/**************************************************************************
**************************************************************************
**************************************************************************
* function: rebuild_box
*/
function rebuild_box($type) {
$this->layout = null;
$this->autoLayout = false;
$this->autoRender = false;
Configure::write('debug', '0');
$script = preg_replace('%/webroot/index.php$%',
'/build_'.$type.'box.cmd',
$_SERVER['SCRIPT_FILENAME']);
// REVISIT <AP>: 20090828
// Just use system call
$handle = popen($script . ' 2>&1', 'r');
while (($read = fread($handle, 2096))) {
// Do nothing
}
pclose($handle);
$url = $_SERVER['HTTP_REFERER'];
if (empty($url))
$url = "/";
$this->redirect($url);
}
function rebuild_sandbox() { $this->rebuild_box('sand'); }
function rebuild_devbox() { $this->rebuild_box('dev'); }
/**************************************************************************
**************************************************************************
**************************************************************************
* function: logmsg
* - action to allow posting log message data
*/
function logmsg() {
}
}

View File

@@ -192,13 +192,6 @@ class Customer extends AppModel {
} }
$id = $this->id; $id = $this->id;
// Appears that $this->save() "helpfully" choses to add in
// any missing data fields, populated with default values.
// So, after saving is complete, the fields 'lease_count',
// 'past_lease_count', and 'current_lease_count' have all
// been reset to zero. Gee, thanks Cake...
$this->update($id);
// Remove all associated Customer Contacts, as it ensures // Remove all associated Customer Contacts, as it ensures
// any entries deleted by the user actually get deleted // any entries deleted by the user actually get deleted
// in the system. We'll recreate the needed ones anyway. // in the system. We'll recreate the needed ones anyway.
@@ -254,10 +247,10 @@ class Customer extends AppModel {
return; return;
} }
// updateLeaseCount is typically handled directly when needed. // REVISIT <AP>: 20090812
// However, this function is used to _ensure_ customer info is // updateLeaseCount is handled directly when needed.
// current, so we're obligated to call it anyway. // Should we simplify by just doing it anyway?
$this->updateLeaseCount($id); //$this->updateLeaseCount($id);
$current_leases = $current_leases =
$this->find('all', $this->find('all',

View File

@@ -148,11 +148,9 @@ class Lease extends AppModel {
array('class' => 'StatementEntry', array('class' => 'StatementEntry',
'fields' => array(), 'fields' => array(),
'conditions' => array 'conditions' => array
('SEx.lease_id = StatementEntry.lease_id', ('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)',
'SEx.type' => 'CHARGE', 'SEx.lease_id = StatementEntry.lease_id',
'SEx.account_id' => $rent_account_id,
'SEx.reverse_transaction_id IS NULL', 'SEx.reverse_transaction_id IS NULL',
'SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)',
), ),
), ),
), ),

View File

@@ -11,7 +11,7 @@ class Option extends AppModel {
static $option_set = array(); static $option_set = array();
function getAll($name, $force = false) { function getAll($name) {
/* $this->prClassLevel(30); */ /* $this->prClassLevel(30); */
/* //$this->OptionValue->prClassLevel(30); */ /* //$this->OptionValue->prClassLevel(30); */
/* $this->Group->Membership->prClassLevel(30); */ /* $this->Group->Membership->prClassLevel(30); */

View File

@@ -8,21 +8,19 @@ class User extends AppModel {
static $current_user_id; static $current_user_id;
function currentUser() {
if (!empty($_SERVER['REMOTE_USER']))
return $_SERVER['REMOTE_USER'];
return null;
}
function currentUserId() { function currentUserId() {
if (!empty(self::$current_user_id)) if (!empty(self::$current_user_id))
return self::$current_user_id; return self::$current_user_id;
if (!empty($_SERVER['REMOTE_USER']))
$login = $_SERVER['REMOTE_USER'];
else
$login = null;
$user = $this->find $user = $this->find
('first', ('first',
array('recursive' => -1, array('recursive' => -1,
'conditions' => array('login' => $this->currentUser()))); 'conditions' => compact('login')));
if (!empty($user['User']['id'])) if (!empty($user['User']['id']))
self::$current_user_id = $user['User']['id']; self::$current_user_id = $user['User']['id'];

View File

@@ -178,8 +178,20 @@ echo $this->element('statement_entries', array
<script type="text/javascript"><!-- <script type="text/javascript"><!--
$(document).ready(function(){ $(document).ready(function(){
datepicker('TxFromDate'); $("#TxFromDate")
datepicker('TxThroughDate'); .attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
$("#TxThroughDate")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
}); });
--></script> --></script>

View File

@@ -28,16 +28,10 @@ Configure::write('debug', '0');
// other available options: // other available options:
//clearForm: true, // clear all form fields after successful submit //clearForm: true, // clear all form fields after successful submit
//resetForm: true, // reset the form after successful submit //resetForm: true, // reset the form after successful submit
url: "<?php echo $html->url(array('controller' => 'transactions',
'action' => 'postReceipt', 0)); ?>"
}; };
// bind form using 'ajaxForm' // bind form using 'ajaxForm'
if ($('#receipt-form').ajaxForm != null) $('#receipt-form').ajaxForm(options);
$('#receipt-form').ajaxForm(options);
else
$('#repeat, label[for=repeat]').remove();
}); });
// pre-submit callback // pre-submit callback
@@ -48,32 +42,24 @@ function verifyRequest(formData, jqForm, options) {
if (formData[i]['name'] == "data[Customer][id]" && if (formData[i]['name'] == "data[Customer][id]" &&
!(formData[i]['value'] > 0)) { !(formData[i]['value'] > 0)) {
//$("#debug").append('<P>Missing Customer ID'); //$("#debug").append('<P>Missing Customer ID');
alert("Please select a customer first."); alert("Must select a customer first");
return false; return false;
} }
if (formData[i]['name'] == "data[Transaction][stamp]" && if (formData[i]['name'] == "data[Transaction][stamp]" &&
formData[i]['value'] == '') { formData[i]['value'] == '') {
//$("#debug").append('<P>Bad Stamp'); //$("#debug").append('<P>Bad Stamp');
if (formData[i]['value'] != '') alert("Must enter a valid date stamp");
alert(formData[i]['value'] + " is not valid date stamp. Please correct it.");
else
alert("Please enter a valid date stamp first.");
return false; return false;
} }
// Terrible way to accomplish this... // Terrible way to accomplish this...
for (var j = 0; j < 20; ++j) { for (var j = 0; j < 20; ++j) {
if (formData[i]['name'] == "data[Entry]["+j+"][amount]") { if (formData[i]['name'] == "data[Entry]["+j+"][amount]" &&
var val = formData[i]['value'].replace(/\$/,''); !(formData[i]['value'] > 0)) {
//$("#debug").append('<P>Bad Amount'); //$("#debug").append('<P>Bad Amount');
if (!(val > 0)) { alert("Must enter a valid amount");
if (formData[i]['value'] == '') return false;
alert("Please enter an amount first.");
else
alert('"'+formData[i]['value']+'"' + " is not valid amount. Please correct it.");
return false;
}
} }
} }
@@ -407,7 +393,12 @@ Configure::write('debug', '0');
<script type="text/javascript"><!-- <script type="text/javascript"><!--
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
$("#customer-id").val(0); $("#customer-id").val(0);
$("#receipt-customer-name").html("INTERNAL ERROR"); $("#receipt-customer-name").html("INTERNAL ERROR");

View File

@@ -4,8 +4,8 @@
$cols = array(); $cols = array();
$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum'); $cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum');
$cols['Name'] = array('index' => 'Contact.display_name', 'formatter' => 'longname'); $cols['Name'] = array('index' => 'Contact.display_name', 'formatter' => 'longname');
$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name'); $cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'longname');
$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name'); $cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'longname');
$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname'); $cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname');
$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment'); $cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment');

View File

@@ -148,14 +148,8 @@ foreach ($jqGridColumns AS $header => &$col) {
// No special formatting for name // No special formatting for name
unset($col['formatter']); unset($col['formatter']);
} }
elseif (preg_match("/^(long|short)?enum$/", elseif ($col['formatter'] === 'enum') {
$col['formatter'], $matches)) {
$default['width'] = 60; $default['width'] = 60;
if (!empty($matches[1]) && $matches[1] === 'long')
$default['width'] *= 1.5;
if (!empty($matches[1]) && $matches[1] === 'short')
$default['width'] *= 0.7;
//$default['align'] = 'right'; //$default['align'] = 'right';
// No special formatting for enum // No special formatting for enum
@@ -172,8 +166,7 @@ foreach ($jqGridColumns AS $header => &$col) {
// Just a rough approximation to ensure columns // Just a rough approximation to ensure columns
// are wide enough to fully display their header. // are wide enough to fully display their header.
$min_width = strlen($header) * 7; $min_width = strlen($header) * 10;
$min_width = 0; // REVISIT <AP>: 20090829; if/while jqGrid is fixed width
if ((!isset($default['width']) || $default['width'] < $min_width) && !$default['force']) if ((!isset($default['width']) || $default['width'] < $min_width) && !$default['force'])
$default['width'] = $min_width; $default['width'] = $min_width;
} }
@@ -246,7 +239,6 @@ $jqGrid_setup = array_merge
'colNames' => array_keys($jqGridColumns), 'colNames' => array_keys($jqGridColumns),
'colModel' => array('--special' => $jqGridColumns), 'colModel' => array('--special' => $jqGridColumns),
'height' => $height, 'height' => $height,
'width' => 700,
'rowNum' => $limit, 'rowNum' => $limit,
'rowList' => $limitOptions, 'rowList' => $limitOptions,
'sortname' => $sortname, 'sortname' => $sortname,
@@ -266,46 +258,50 @@ $jqGrid_setup = array_merge
// to kick this thing off. // to kick this thing off.
?> ?>
<?php if ($first_grid): ?>
<script type="text/javascript"><!--
var currencyFormatter = function(cellval, opts, rowObject) {
if (!cellval)
return "";
return fmtCurrency(cellval);
}
var percentageFormatter = function(cellval, opts, rowObject) {
var precision;
if (typeof(opts.colModel) != 'undefined' &&
typeof(opts.colModel.formatoptions) != 'undefined' &&
typeof(opts.colModel.formatoptions.precision) != 'undefined')
precision = opts.colModel.formatoptions.precision;
else
precision = 0;
amount = cellval.toString().replace(/\%/g,'');
amount = (amount*100).toFixed(precision);
return amount+'%';
}
var idFormatter = function(cellval, opts, rowObject) {
if (!cellval)
return cellval;
return '#'+cellval;
}
--></script>
<?php endif; ?>
<DIV ID="<?php echo $grid_div_id; ?>" CLASS="<?php echo $grid_div_class; ?>"> <DIV ID="<?php echo $grid_div_id; ?>" CLASS="<?php echo $grid_div_class; ?>">
<table id="<?php echo $grid_id; ?>" class="scroll"></table> <table id="<?php echo $grid_id; ?>" class="scroll"></table>
<div id="<?php echo $grid_id; ?>-pager" class="scroll" style="text-align:right"></div> <div id="<?php echo $grid_id; ?>-pager" class="scroll" style="text-align:right"></div>
<script type="text/javascript"><!-- <script type="text/javascript"><!--
jQuery(document).ready(function(){ jQuery(document).ready(function(){
currencyFormatter = function(cellval, opts, rowObject) {
if (!cellval)
return "";
return fmtCurrency(cellval);
}
percentageFormatter = function(cellval, opts, rowObject) {
var precision;
if (typeof(opts.colModel) != 'undefined' &&
typeof(opts.colModel.formatoptions) != 'undefined' &&
typeof(opts.colModel.formatoptions.precision) != 'undefined')
precision = opts.colModel.formatoptions.precision;
else
precision = 0;
amount = cellval.toString().replace(/\%/g,'');
amount = (amount*100).toFixed(precision);
return amount+'%';
}
idFormatter = function(cellval, opts, rowObject) {
if (!cellval)
return cellval;
return '#'+cellval;
}
jQuery('#<?php echo $grid_id; ?>').jqGrid( jQuery('#<?php echo $grid_id; ?>').jqGrid(
<?php echo FormatHelper::phpVarToJavascript($jqGrid_setup) . "\n"; ?> <?php echo FormatHelper::phpVarToJavascript($jqGrid_setup); ?>
).navGrid('#<?php echo $grid_id; ?>-pager', { view:false,edit:false,add:false,del:false,search:true,refresh:true}); ).navGrid('#<?php echo $grid_id; ?>-pager',
{ view:false,
edit:false,
add:false,
del:false,
search:true,
refresh:true});
}); });
--></script> --></script>
<?php <?php
if (count($search_fields) > 0) { if (count($search_fields) > 0) {
echo('<div>Search By:<BR>' . "\n"); echo('<div>Search By:<BR>' . "\n");

View File

@@ -3,23 +3,22 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id'); $cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname', 'align' => 'center'); $cols['Unit'] = array('index' => 'Unit.name', 'width' => '50', 'align' => 'center');
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname'); $cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
$cols['Rent'] = array('index' => 'Lease.rent', 'formatter' => 'currency'); $cols['Rent'] = array('index' => 'Lease.rent', 'formatter' => 'currency', 'hiddenz' => true);
$cols['Deposit'] = array('index' => 'Lease.deposit', 'formatter' => 'currency'); $cols['Deposit'] = array('index' => 'Lease.deposit', 'formatter' => 'currency', 'hiddenz' => true);
$cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'date'); $cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'date');
$cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date'); $cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date');
$cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date'); $cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date');
$cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date'); $cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date');
$cols['Charge-Thru'] = array('index' => 'Lease.charge_through_date', 'formatter' => 'date');
$cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date'); $cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date');
$cols['Status'] = array('index' => 'status', 'formatter' => 'longenum'); $cols['Status'] = array('index' => 'status', 'formatter' => 'enum', 'width' => 100);
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
$cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment'); $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment');
if (!empty($this->params['action'])) { if (!empty($this->params['action'])) {
if ($this->params['action'] === 'closed') if ($this->params['action'] === 'closed')
$grid->invalidFields(array('Charge-Thru', 'Paid-Thru', 'Status')); $grid->invalidFields(array('Paid-Thru', 'Status'));
elseif ($this->params['action'] === 'active') elseif ($this->params['action'] === 'active')
$grid->invalidFields(array('Closed')); $grid->invalidFields(array('Closed'));
elseif ($this->params['action'] === 'delinquent') elseif ($this->params['action'] === 'delinquent')
@@ -33,4 +32,4 @@ $grid
->defaultFields(array('Lease')) ->defaultFields(array('Lease'))
->searchFields(array('Customer', 'Unit')) ->searchFields(array('Customer', 'Unit'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Signed', 'Charge-Thru', 'Status', 'Comment'))); array_diff(array_keys($cols), array('Signed', 'Status', 'Comment')));

View File

@@ -70,16 +70,14 @@ echo('</DIV>' . "\n"); // End #sidemenu-container
$javascript->codeBlock( $javascript->codeBlock(
<<<JSCB <<<JSCB
jQuery(document).ready(function(){ jQuery(document).ready(function(){
if (jQuery("#sidemenu").accordion != null) { jQuery("#sidemenu").accordion
jQuery("#sidemenu").accordion ({ fillSpace : true,
({ fillSpace : true, event : "click hoverintent",
event : "click hoverintent", animated : "bounceslide",
animated : "bounceslide"
JSCB JSCB
. (isset($active_section) ? ",\n\t active : $active_section\n" : '') . . (isset($active_section) ? "\tactive : $active_section,\n" : '') .
<<<JSCB <<<JSCB
}); });
}
}); });
JSCB JSCB
, array('inline' => false)); , array('inline' => false));

View File

@@ -15,7 +15,7 @@ $cols['Unit'] = array('index' => 'Unit.name', 'formatter' =>
$cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150); $cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' => 'longenum'); $cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' => 'enum', 'width'=>120);
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name'); $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
$cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency'); $cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency'); $cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency');

View File

@@ -17,4 +17,4 @@ $grid
->defaultFields(array('Date', 'Name', 'Amount')) ->defaultFields(array('Date', 'Name', 'Amount'))
->searchFields(array('Name', 'Type')) ->searchFields(array('Name', 'Type'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Comment', 'Sub-Total'))); array_diff(array_keys($cols), array('Sub-Total')));

View File

@@ -9,7 +9,7 @@ $cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname'
$cols['Area'] = array('index' => 'sqft', 'formatter' => 'number'); $cols['Area'] = array('index' => 'sqft', 'formatter' => 'number');
$cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency'); $cols['Rent'] = array('index' => 'Unit.rent', 'formatter' => 'currency');
$cols['Deposit'] = array('index' => 'Unit.deposit', 'formatter' => 'currency'); $cols['Deposit'] = array('index' => 'Unit.deposit', 'formatter' => 'currency');
$cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'enum'); $cols['Status'] = array('index' => 'Unit.status', 'formatter' => 'name'); // We have enough real estate
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment'); $cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');

View File

@@ -268,21 +268,14 @@ class FormatHelper extends AppHelper {
// Helper function to convert PHP vars to javascript // Helper function to convert PHP vars to javascript
function phpVarToJavascript($var, $name = '', $depth='', $special = false, $pretty = false) { function phpVarToJavascript($var, $name = '', $depth='', $special = false) {
// Establish a prefix to use before printing $var // Establish a prefix to use before printing $var
if ($pretty) { $prefix = $depth;
$prefix = $depth;
$pretty_sp = " ";
$pretty_nl = "\n";
}
else {
$prefix = $pretty_sp = $pretty_nl = '';
}
// If given a name, set it up JS style // If given a name, set it up JS style
if ($name) if ($name)
$prefix .= $name . ":" . $pretty_sp; $prefix .= $name . ": ";
if (!isset($var)) if (!isset($var))
return $prefix . 'null'; return $prefix . 'null';
@@ -335,22 +328,22 @@ class FormatHelper extends AppHelper {
// PHP array indices can be a mix of integer and string based. // PHP array indices can be a mix of integer and string based.
// Just guess here, unless flagged as a special case. // Just guess here, unless flagged as a special case.
if (isset($var[0]) || $special) if (isset($var[0]) || $special)
return ($prefix . "[" . $pretty_nl return ($prefix . "[\n"
. implode("," . $pretty_nl, . implode(",\n",
array_map(array('FormatHelper', 'phpVarToJavascript'), array_map(array('FormatHelper', 'phpVarToJavascript'),
array_values($var), array_values($var),
array(), array(),
array_fill(0, count($var), $depth.' ') array_fill(0, count($var), $depth.' ')
)) ))
. ($pretty ? "\n$depth" : '') . "]"); . "\n$depth]");
return ($prefix . "{" . $pretty_nl return ($prefix . "{\n"
. implode("," . $pretty_nl, . implode(",\n",
array_map(array('FormatHelper', 'phpVarToJavascript'), array_map(array('FormatHelper', 'phpVarToJavascript'),
array_values($var), array_keys($var), array_values($var), array_keys($var),
array_fill(0, count($var), $depth.' ') array_fill(0, count($var), $depth.' ')
)) ))
. ($pretty ? "\n$depth" : '') . "}"); . "\n$depth}");
} }
} }

View File

@@ -6,7 +6,6 @@ class GridHelper extends AppHelper {
var $included, $invalid; var $included, $invalid;
var $columns; var $columns;
var $controller; var $controller;
static $first_grid = true;
function __construct() { function __construct() {
$this->reset(); $this->reset();
@@ -219,12 +218,8 @@ class GridHelper extends AppHelper {
if (isset($config)) if (isset($config))
$this->jqGrid_options = array_merge($this->jqGrid_options, $config); $this->jqGrid_options = array_merge($this->jqGrid_options, $config);
// Set flag whether or not this is the first grid
$this->jqGrid_options['first_grid'] = self::$first_grid;
//pr(compact('config') + array('jqGrid_options' => $this->jqGrid_options)); //pr(compact('config') + array('jqGrid_options' => $this->jqGrid_options));
echo $view->element('jqGrid', $this->jqGrid_options); echo $view->element('jqGrid', $this->jqGrid_options);
self::$first_grid = false;
// Since we only have one instance of this class // Since we only have one instance of this class
// as a helper, we must assume it could be used // as a helper, we must assume it could be used

View File

@@ -34,11 +34,7 @@
<head> <head>
<?php echo $html->charset(); ?> <?php echo $html->charset(); ?>
<title> <title>
<?php if (devbox()) echo "*DEVBOX* "; ?>
<?php if (sandbox()) echo "*SANDBOX* "; ?>
Property Manager: <?php echo $title_for_layout; ?> Property Manager: <?php echo $title_for_layout; ?>
<?php if (sandbox()) echo " *SANDBOX*"; ?>
<?php if (devbox()) echo " *DEVBOX*"; ?>
</title> </title>
<?php <?php
// Reset the __scripts variable, which has already been dumped to // Reset the __scripts variable, which has already been dumped to
@@ -52,7 +48,7 @@
// mechanism _additional_ to what Cake has provided :-/ // mechanism _additional_ to what Cake has provided :-/
$this->__scripts = array(); $this->__scripts = array();
if (!empty($_SERVER['HTTPS'])) if (!empty($_SERVER['HTTPS']))
$protocol = 'https://'; $protocol = 'https://';
else else
$protocol = 'http://'; $protocol = 'http://';
@@ -62,42 +58,23 @@
echo $html->css('layout') . "\n"; echo $html->css('layout') . "\n";
echo $html->css('print', null, array('media' => 'print')) . "\n"; echo $html->css('print', null, array('media' => 'print')) . "\n";
echo $html->css('sidemenu') . "\n"; echo $html->css('sidemenu') . "\n";
echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js') . "\n";
echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js') . "\n";
$theme = 'smoothness'; $theme = 'smoothness';
$theme = 'base'; $theme = 'base';
$theme = 'dotluv'; $theme = 'dotluv';
$theme = 'dark-hive'; $theme = 'dark-hive';
$theme = 'start'; $theme = 'start';
if (devbox())
$theme = 'dotluv';
if (sandbox()) if (sandbox())
$theme = 'darkness'; $theme = 'darkness';
echo $html->css('themes/'.$theme.'/ui.all') . "\n"; echo $html->css('themes/'.$theme.'/ui.all') . "\n";
echo $javascript->link('jquery-1.3.2.min') . "\n";
echo $javascript->link('jquery-ui-1.7.2.custom.min') . "\n";
//echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js') . "\n";
//echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js') . "\n";
//echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js') . "\n";
//echo $javascript->link($protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js') . "\n";
echo $javascript->link('jquery.form') . "\n"; echo $javascript->link('jquery.form') . "\n";
echo $javascript->link('jquery.hoverIntent') . "\n"; echo $javascript->link('pmgr.jquery') . "\n";
echo $javascript->link('pmgr') . "\n"; echo $javascript->link('pmgr') . "\n";
echo $scripts_for_layout . "\n"; echo $scripts_for_layout . "\n";
?> ?>
<?php if ($this->params['action'] !== 'INTERNAL_ERROR'): ?>
<script type="text/javascript"><!--
if (typeof(jQuery) == 'undefined') {
window.location.href =
"<?php echo $html->url(array('controller' => 'util',
'action' => 'INTERNAL_ERROR',
'jQuery NOT LOADED!')); ?>";
}
--></script>
<?php endif; ?>
</head> </head>
<body> <body>

View File

@@ -10,7 +10,6 @@ $customer = $lease['Customer'];
if (isset($lease['Lease'])) if (isset($lease['Lease']))
$lease = $lease['Lease']; $lease = $lease['Lease'];
//pr(compact('unit', 'customer', 'lease', 'movein'));
/********************************************************************** /**********************************************************************
********************************************************************** **********************************************************************
@@ -26,29 +25,21 @@ Configure::write('debug', '0');
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var lease_charge_through;
// prepare the form when the DOM is ready // prepare the form when the DOM is ready
$(document).ready(function() { $(document).ready(function() {
var options = { var options = {
target: '#output-debug', // target element(s) to be updated with server response target: '#output-debug', // target element(s) to be updated with server response
beforeSubmit: verifyRequest, // pre-submit callback beforeSubmit: verifyRequest, // pre-submit callback
success: showResponse, // post-submit callback success: showResponse, // post-submit callback
// other available options: // other available options:
//clearForm: true, // clear all form fields after successful submit //clearForm: true, // clear all form fields after successful submit
//resetForm: true, // reset the form after successful submit //resetForm: true, // reset the form after successful submit
};
url: "<?php echo $html->url(array('controller' => 'transactions', // bind form using 'ajaxForm'
'action' => 'postInvoice', 0)); ?>"
};
// bind form using 'ajaxForm'
if ($('#invoice-form').ajaxForm != null)
$('#invoice-form').ajaxForm(options); $('#invoice-form').ajaxForm(options);
else });
$('#repeat, label[for=repeat]').remove();
});
// pre-submit callback // pre-submit callback
function verifyRequest(formData, jqForm, options) { function verifyRequest(formData, jqForm, options) {
@@ -65,25 +56,17 @@ function verifyRequest(formData, jqForm, options) {
if (formData[i]['name'] == "data[Transaction][stamp]" && if (formData[i]['name'] == "data[Transaction][stamp]" &&
formData[i]['value'] == '') { formData[i]['value'] == '') {
//$("#debug").append('<P>Bad Stamp'); //$("#debug").append('<P>Bad Stamp');
if (formData[i]['value'] != '') alert("Must enter a valid date stamp");
alert(formData[i]['value'] + " is not valid date stamp. Please correct it.");
else
alert("Please enter a valid date stamp first.");
return false; return false;
} }
// Terrible way to accomplish this... // Terrible way to accomplish this...
for (var j = 0; j < 20; ++j) { for (var j = 0; j < 20; ++j) {
if (formData[i]['name'] == "data[Entry]["+j+"][amount]") { if (formData[i]['name'] == "data[Entry]["+j+"][amount]" &&
var val = formData[i]['value'].replace(/\$/,''); !(formData[i]['value'] > 0)) {
//$("#debug").append('<P>Bad Amount'); //$("#debug").append('<P>Bad Amount');
if (!(val > 0)) { alert("Must enter a valid amount");
if (formData[i]['value'] == '') return false;
alert("Please enter an amount for Charge #"+j+", or remove the Charge completely.");
else
alert('"'+formData[i]['value']+'"' + " is not a valid amount for Charge #"+j+". Please correct it.");
return false;
}
} }
} }
} }
@@ -153,7 +136,6 @@ function onRowSelect(grid_id, lease_id) {
$("#invoice-deposit").html($(grid_id).getCell(lease_id, 'Lease-deposit') $("#invoice-deposit").html($(grid_id).getCell(lease_id, 'Lease-deposit')
? $(grid_id).getCell(lease_id, 'Lease-deposit') ? $(grid_id).getCell(lease_id, 'Lease-deposit')
: '-'); : '-');
lease_charge_through = $(grid_id).getCell(lease_id, 'Lease-charge_through_date')
// Hide the "no lease" message and show the current lease // Hide the "no lease" message and show the current lease
$(".lease-selection-invalid").hide(); $(".lease-selection-invalid").hide();
@@ -179,78 +161,6 @@ function onGridState(grid_id, state) {
} }
} }
function setNextRent(id) {
var chg_thru;
$('.ChargeForm').each( function(i) {
if ($('.ChargeFormThroughDate', this).attr('id') == 'Entry'+id+'ThroughDate')
return;
if ($('.ChargeFormAccount option:selected', this).val() == <?php echo $rentAccount ?>
&& $('.ChargeFormThroughDate', this).val()) {
var dt = new Date($('.ChargeFormThroughDate', this).val());
//$('#debug').append('Rent in ' + i + '; date ' + dt + '<BR>');
if (chg_thru == null || dt > chg_thru)
chg_thru = dt;
}
});
if (!chg_thru)
chg_thru = new Date(lease_charge_through);
if (chg_thru < dateEOM(chg_thru)) {
// Add a charge to finish out the month
datepickerSet('Entry'+id+'EffectiveDate', dateTomorrow(chg_thru));
datepickerSet('Entry'+id+'ThroughDate', dateEOM(chg_thru));
} else {
// Add a whole month's charge for next month
datepickerSet('Entry'+id+'EffectiveDate', dateNextBOM(chg_thru));
datepickerSet('Entry'+id+'ThroughDate', dateNextEOM(chg_thru));
}
// Now add in the amount owed based on the calculated
// effective and through dates.
prorate(id);
}
function prorate(id) {
var edt = datepickerGet('Entry'+id+'EffectiveDate');
var tdt = datepickerGet('Entry'+id+'ThroughDate');
var rent = $('#invoice-rent').html().replace(/\$/,'');
// Reset the comment. It might wipe out a user comment,
// but it's probably low risk/concern
$('#Entry'+id+'Comment').val('');
if (edt == null || tdt == null) {
alert('Can only prorate with both effective and through dates');
rent = 0;
}
else if (edt > tdt) {
alert('Effective date is later than the Through date');
rent = 0;
}
else if (tdt.getMonth() == edt.getMonth() + 1 &&
edt.getDate() == tdt.getDate() + 1) {
// appears to be anniversary billing, one full cycle
}
else if (edt.getTime() == dateBOM(edt).getTime() &&
tdt.getTime() == dateEOM(edt).getTime()) {
// appears to be one full month
}
else {
var one_day=1000*60*60*24;
var days = Math.ceil((tdt.getTime()-edt.getTime()+1)/(one_day));
var dim =
((edt.getMonth() == tdt.getMonth())
? dateEOM(edt).getDate() // prorated within the month.
: 30); // prorated across months.
rent *= days / dim;
$('#Entry'+id+'Comment').val('Rent proration: '+days+'/'+dim+' days');
}
$('#Entry'+id+'Amount').val(fmtCurrency(rent));
}
function addChargeSource(flash) { function addChargeSource(flash) {
var id = $("#charge-entry-id").val(); var id = $("#charge-entry-id").val();
addDiv('charge-entry-id', 'charge', 'charges', flash, addDiv('charge-entry-id', 'charge', 'charges', flash,
@@ -262,32 +172,26 @@ function addChargeSource(flash) {
echo FormatHelper::phpVarToJavascript echo FormatHelper::phpVarToJavascript
($this->element('form_table', ($this->element('form_table',
array('id' => 'Entry%{id}Form', array('id' => 'Entry%{id}Form',
'class' => "ChargeForm item invoice ledger-entry entry", 'class' => "item invoice ledger-entry entry",
//'with_name_after' => ':', //'with_name_after' => ':',
'field_prefix' => 'Entry.%{id}', 'field_prefix' => 'Entry.%{id}',
'fields' => array 'fields' => array
("account_id" => array('name' => 'Account', ("account_id" => array('name' => 'Account',
'opts' => 'opts' =>
array('class' => 'ChargeFormAccount', array('options' => $chargeAccounts,
'options' => $chargeAccounts,
'value' => $defaultAccount, 'value' => $defaultAccount,
), ),
'between' => '<A HREF="#" ONCLICK="setNextRent(\'%{id}\'); return false;">Rent</A>',
), ),
"effective_date" => array('opts' => "effective_date" => array('opts' =>
array('class' => 'ChargeFormEffectiveDate', array('type' => 'text'),
'type' => 'text'),
'between' => '<A HREF="#" ONCLICK="datepickerBOM(\'TransactionStamp\',\'Entry%{id}EffectiveDate\'); return false;">BOM</A>', 'between' => '<A HREF="#" ONCLICK="datepickerBOM(\'TransactionStamp\',\'Entry%{id}EffectiveDate\'); return false;">BOM</A>',
), ),
"through_date" => array('opts' => "through_date" => array('opts' =>
array('class' => 'ChargeFormThroughDate', array('type' => 'text'),
'type' => 'text'),
'between' => '<A HREF="#" ONCLICK="datepickerEOM(\'Entry%{id}EffectiveDate\',\'Entry%{id}ThroughDate\'); return false;">EOM</A>', 'between' => '<A HREF="#" ONCLICK="datepickerEOM(\'Entry%{id}EffectiveDate\',\'Entry%{id}ThroughDate\'); return false;">EOM</A>',
), ),
"amount" => array('opts' => array('class' => 'ChargeFormAmount invoice amount'), "amount" => array('opts' => array('class' => 'invoice amount')),
'between' => '<A HREF="#" ONCLICK="prorate(\'%{id}\'); return false;">Prorate</A>', "comment" => array('opts' => array('size' => 50)),
),
"comment" => array('opts' => array('class' => 'ChargeFormComment', 'size' => 50)),
), ),
))) . "+\n"; ))) . "+\n";
?> ?>
@@ -295,8 +199,19 @@ function addChargeSource(flash) {
'</FIELDSET>' '</FIELDSET>'
); );
datepicker("Entry"+id+"EffectiveDate"); $("#Entry"+id+"EffectiveDate")
datepicker("Entry"+id+"ThroughDate"); .attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
$("#Entry"+id+"ThroughDate")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
return id; return id;
} }
@@ -323,8 +238,7 @@ if (empty($movein))
array('gridstate' => array('gridstate' =>
'onGridState("#"+$(this).attr("id"), gridstate)'), 'onGridState("#"+$(this).attr("id"), gridstate)'),
), ),
'include' => array('Charge-Thru'), 'exclude' => array('Closed'),
'exclude' => array('Closed', 'Paid-Thru'),
'action' => 'active', 'action' => 'active',
'nolinks' => true, 'nolinks' => true,
'limit' => 10, 'limit' => 10,
@@ -362,12 +276,6 @@ echo $form->input("Lease.id",
'type' => 'hidden', 'type' => 'hidden',
'value' => 0)); 'value' => 0));
if (!empty($movein))
echo $form->input("Customer.id",
array('id' => 'customer-id',
'type' => 'hidden',
'value' => $customer['id']));
/* echo '<fieldset CLASS="invoice">' . "\n"; */ /* echo '<fieldset CLASS="invoice">' . "\n"; */
/* echo ' <legend>Invoice</legend>' . "\n"; */ /* echo ' <legend>Invoice</legend>' . "\n"; */
@@ -421,34 +329,14 @@ Configure::write('debug', '0');
$('tr td:nth-child('+col+'), tr th:nth-child('+col+')', this).remove(); $('tr td:nth-child('+col+'), tr th:nth-child('+col+')', this).remove();
}; };
function addHidden(id, fld, name) {
$('#Entry'+id+fld).after
('<input type="hidden"' +
' name="data[Entry]['+id+']['+name+']"' +
' value="' + $('#Entry'+id+fld).val() + '">');
}
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
<?php if (isset($lease['id'])): ?>
$("#lease-id").val(<?php echo $lease['id']; ?>);
$("#invoice-lease").html("<?php echo '#'.$lease['number']; ?>");
$("#invoice-unit").html("<?php echo $unit['name']; ?>");
$("#invoice-customer").html("<?php echo $customer['name']; ?>");
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['rent']); ?>");
$("#invoice-late").html("<?php echo FormatHelper::currency($defaultLate); ?>");
$("#invoice-deposit").html("<?php echo FormatHelper::currency($lease['deposit']); ?>");
lease_charge_through = <?php
if ($lease['charge_through_date'])
echo 'new Date("'.date('m/d/Y', strtotime($lease['charge_through_date'])).'")';
elseif ($lease['paid_through_date'])
echo 'new Date("'.date('m/d/Y', strtotime($lease['paid_through_date'])).'")';
else
echo 'dateYesterday("'.date('m/d/Y', strtotime($lease['movein_date'])).'")';
?>;
<?php else: ?>
$("#lease-id").val(0); $("#lease-id").val(0);
$("#invoice-lease").html("INTERNAL ERROR"); $("#invoice-lease").html("INTERNAL ERROR");
$("#invoice-unit").html("INTERNAL ERROR"); $("#invoice-unit").html("INTERNAL ERROR");
@@ -456,8 +344,6 @@ Configure::write('debug', '0');
$("#invoice-rent").html("INTERNAL ERROR"); $("#invoice-rent").html("INTERNAL ERROR");
$("#invoice-late").html("INTERNAL ERROR"); $("#invoice-late").html("INTERNAL ERROR");
$("#invoice-deposit").html("INTERNAL ERROR"); $("#invoice-deposit").html("INTERNAL ERROR");
<?php endif; ?>
<?php if (empty($movein)): ?> <?php if (empty($movein)): ?>
@@ -469,12 +355,12 @@ Configure::write('debug', '0');
var id; var id;
resetForm(true); resetForm(true);
$("#TransactionStamp").attr('disabled', true); $("#TransactionStamp").datepicker('disable');
$("#TransactionStamp").val("<?php echo date('m/d/Y', $movein['time']); ?>"); $("#TransactionStamp").val("<?php echo date('m/d/Y', $movein['time']); ?>");
$('#TransactionStamp').after $('#TransactionStamp').after
('<input type="hidden"' + ('<input type="hidden"' +
' name="data[Transaction][stamp]"' + ' name="data[Transaction][stamp]"' +
' value="' + $("#TransactionStamp").val() + '">'); ' value="<?php echo date('m/d/Y', $movein['time']); ?>">');
$("#TransactionComment").val('Move-In Charges'); $("#TransactionComment").val('Move-In Charges');
<?php if ($movein['deposit'] != 0): ?> <?php if ($movein['deposit'] != 0): ?>
@@ -482,28 +368,61 @@ Configure::write('debug', '0');
$('#Entry'+id+'Form').removeCol(2); $('#Entry'+id+'Form').removeCol(2);
$('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true); $('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true);
$('#Entry'+id+'EffectiveDate').val("<?php echo date('m/d/Y', $movein['effective_time']); ?>"); $('#Entry'+id+'EffectiveDate').val("<?php echo date('m/d/Y', $movein['effective_time']); ?>");
addHidden(id, 'EffectiveDate', 'effective_date'); $('#Entry'+id+'EffectiveDate').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][effective_date]"' +
' value="<?php echo date('m/d/Y', $movein['effective_time']); ?>">');
$('#Entry'+id+'AccountId').val(<?php echo $securityDepositAccount; ?>); $('#Entry'+id+'AccountId').val(<?php echo $securityDepositAccount; ?>);
addHidden(id, 'AccountId', 'account_id'); $('#Entry'+id+'AccountId').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][account_id]"' +
' value="<?php echo $securityDepositAccount; ?>">');
$('#Entry'+id+'Amount').val("<?php echo FormatHelper::currency($movein['deposit']); ?>"); $('#Entry'+id+'Amount').val("<?php echo FormatHelper::currency($movein['deposit']); ?>");
addHidden(id, 'Amount', 'amount'); $('#Entry'+id+'Amount').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][amount]"' +
' value="<?php echo FormatHelper::currency($movein['deposit']); ?>">');
//$('#Entry'+id+'Comment').val('Move-In Security Deposit');
$('#Entry'+id+'Comment').removeAttr('disabled'); $('#Entry'+id+'Comment').removeAttr('disabled');
<?php endif; ?> <?php endif; ?>
id = addChargeSource(false); id = addChargeSource(false);
$('#Entry'+id+'Form').removeCol(2); $('#Entry'+id+'Form').removeCol(2);
$('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true); $('#Entry'+id+'Form input, #Entry'+id+'Form select').attr('disabled', true);
setNextRent(id); $('#Entry'+id+'EffectiveDate').val("<?php echo date('m/d/Y', $movein['effective_time']); ?>");
addHidden(id, 'EffectiveDate', 'effective_date'); $('#Entry'+id+'EffectiveDate').after
addHidden(id, 'ThroughDate', 'through_date'); ('<input type="hidden"' +
addHidden(id, 'AccountId', 'account_id'); ' name="data[Entry]['+id+'][effective_date]"' +
addHidden(id, 'Amount', 'amount'); ' value="<?php echo date('m/d/Y', $movein['effective_time']); ?>">');
$('#Entry'+id+'ThroughDate').val("<?php echo date('m/d/Y', $movein['through_time']); ?>");
$('#Entry'+id+'ThroughDate').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][through_date]"' +
' value="<?php echo date('m/d/Y', $movein['through_time']); ?>">');
$('#Entry'+id+'AccountId').val(<?php echo $rentAccount; ?>);
$('#Entry'+id+'AccountId').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][account_id]"' +
' value="<?php echo $rentAccount; ?>">');
$('#Entry'+id+'Amount').val("<?php echo FormatHelper::currency($movein['prorated_rent']); ?>");
$('#Entry'+id+'Amount').after
('<input type="hidden"' +
' name="data[Entry]['+id+'][amount]"' +
' value="<?php echo FormatHelper::currency($movein['prorated_rent']); ?>">');
$('#Entry'+id+'Comment').val("<?php echo($movein['prorated'] ? 'Move-In Rent (Prorated)' : ''); ?>");
$('#Entry'+id+'Comment').removeAttr('disabled'); $('#Entry'+id+'Comment').removeAttr('disabled');
<?php endif; ?> <?php endif; ?>
<?php if (isset($lease['id'])): ?> <?php if (isset($lease['id'])): ?>
$("#lease-id").val(<?php echo $lease['id']; ?>);
$("#invoice-lease").html("<?php echo '#'.$lease['number']; ?>");
$("#invoice-unit").html("<?php echo $unit['name']; ?>");
$("#invoice-customer").html("<?php echo $customer['name']; ?>");
$("#invoice-rent").html("<?php echo FormatHelper::currency($lease['rent']); ?>");
$("#invoice-late").html("<?php echo FormatHelper::currency($defaultLate); ?>");
$("#invoice-deposit").html("<?php echo FormatHelper::currency($lease['deposit']); ?>");
onGridState(null, 'hidden'); onGridState(null, 'hidden');
<?php else: ?> <?php else: ?>
onGridState(null, 'visible'); onGridState(null, 'visible');

View File

@@ -34,39 +34,6 @@ function resetForm() {
datepickerNow('LeaseMoveDate', false); datepickerNow('LeaseMoveDate', false);
} }
// pre-submit callback
function verifyRequest() {
//$("#debug").html('');
<?php if ($move_type === 'out'): ?>
if (!($("#lease-id").val() > 0)) {
//$("#debug").append('<P>Missing Lease ID');
alert("Please select the lease");
return false;
}
<?php else: ?>
if (!($("#customer-id").val() > 0)) {
//$("#debug").append('<P>Missing Customer ID');
alert("Please select the customer");
return false;
}
if (!($("#unit-id").val() > 0)) {
//$("#debug").append('<P>Missing Unit ID');
alert("Please select the unit");
return false;
}
<?php endif; ?>
//$("#debug").append('OK');
//return false;
return true;
}
function onRowSelect(grid_id, item_type, item_id) { function onRowSelect(grid_id, item_type, item_id) {
cell_name = item_type.charAt(0).toUpperCase() + item_type.substr(1); cell_name = item_type.charAt(0).toUpperCase() + item_type.substr(1);
if (item_type == 'lease') if (item_type == 'lease')
@@ -242,7 +209,6 @@ else {
} }
echo $form->create(null, array('id' => 'move-inout-form', echo $form->create(null, array('id' => 'move-inout-form',
'onsubmit' => 'return verifyRequest();',
'url' => array('controller' => 'leases', 'url' => array('controller' => 'leases',
'action' => $move_action))); 'action' => $move_action)));
@@ -316,7 +282,13 @@ echo $form->end('Perform Move ' . ucfirst($move_type));
<script type="text/javascript"><!-- <script type="text/javascript"><!--
$(document).ready(function(){ $(document).ready(function(){
datepicker('LeaseMoveDate'); $("#LeaseMoveDate")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
<?php if ($move_type === 'out') { ?> <?php if ($move_type === 'out') { ?>

View File

@@ -6,19 +6,6 @@
{// for indentation purposes {// for indentation purposes
// Go through each unit, adding a clickable region for the unit // Go through each unit, adding a clickable region for the unit
foreach ($info['units'] AS $unit){ foreach ($info['units'] AS $unit){
$title = ('Unit #' .
$unit['name'] .
(empty($unit['data']['CurrentLease']['id'])
? ''
: ('; ' .
/* 'Lease #' . */
/* $unit['data']['CurrentLease']['id'] . */
/* '; ' . */
$unit['data']['Customer']['name'] .
'; Paid Through ' .
$unit['data']['CurrentLease']['paid_through_date'])
));
echo(' <area shape="rect"' . echo(' <area shape="rect"' .
' coords="' . ' coords="' .
$unit['left'] . ',' . $unit['left'] . ',' .
@@ -29,8 +16,20 @@
$html->url(array('controller' => 'units', $html->url(array('controller' => 'units',
'action' => 'view', 'action' => 'view',
$unit['id'])) . $unit['id'])) .
'" alt="' . $title . '" alt="Unit #' .
'" title="' . $title . $unit['name'] .
'" title="Unit #' .
$unit['name'] .
(empty($unit['data']['CurrentLease']['id'])
? ''
: ('; ' .
/* 'Lease #' . */
/* $unit['data']['CurrentLease']['id'] . */
/* '; ' . */
$unit['data']['Customer']['name'] .
'; Paid Through ' .
$unit['data']['CurrentLease']['paid_through_date'])
) .
'">' . "\n"); '">' . "\n");
} }
}// for indentation purposes }// for indentation purposes

View File

@@ -60,7 +60,13 @@ function resetForm() {
} }
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
}); });
--></script> --></script>

View File

@@ -60,7 +60,13 @@ function resetForm() {
} }
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
}); });
--></script> --></script>

View File

@@ -33,13 +33,11 @@ for ($i=1; $i<=4; ++$i)
if (!empty($ttype["data{$i}_name"])) if (!empty($ttype["data{$i}_name"]))
$rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]); $rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]);
$rows[] = array('Deposit', if (!empty($tender['deposit_transaction_id']))
empty($tender['deposit_transaction_id']) $rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
? "-" array('controller' => 'transactions',
: $html->link('#'.$tender['deposit_transaction_id'], 'action' => 'deposit_slip',
array('controller' => 'transactions', $tender['deposit_transaction_id'])));
'action' => 'deposit_slip',
$tender['deposit_transaction_id'])));
if (!empty($tender['nsf_transaction_id'])) if (!empty($tender['nsf_transaction_id']))
$rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'], $rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'],

View File

@@ -75,7 +75,13 @@ function resetForm() {
} }
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
}); });
--></script> --></script>

View File

@@ -92,7 +92,13 @@ function resetForm() {
} }
$(document).ready(function(){ $(document).ready(function(){
datepicker('TransactionStamp'); $("#TransactionStamp")
.attr('autocomplete', 'off')
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
resetForm(); resetForm();
}); });
--></script> --></script>

View File

@@ -22,6 +22,11 @@
*/ */
* {
margin:0;
padding:0;
}
/* Layout */ /* Layout */
#container { #container {
text-align: left; text-align: left;

View File

@@ -11,7 +11,6 @@
* Overall page layout * Overall page layout
*/ */
body { padding: 0; margin: 0 }
table#layout { width: 100% } table#layout { width: 100% }
td#sidecolumn , td#sidecolumn ,
td#pagecolumn { vertical-align: top; } td#pagecolumn { vertical-align: top; }
@@ -286,7 +285,6 @@ span.grid-error {
.ui-jqgrid span.ui-jqgrid-title h2 { .ui-jqgrid span.ui-jqgrid-title h2 {
font-weight: bold; font-weight: bold;
font-size: 140%; font-size: 140%;
margin: 0;
} }

View File

@@ -16,14 +16,6 @@ div#debug-kit-toolbar
{ display: none; } { display: none; }
/************************************************************
* Form inputs
*/
/* The "page N / M" input box... make it look like normal text */
input[type='button'], input[type='submit'], input[type='reset']
{ display: none; }
/************************************************************ /************************************************************
* Grid display * Grid display
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,136 +0,0 @@
/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
*
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*
* hoverIntent is currently available for use in all personal or commercial
* projects under both MIT and GPL licenses. This means that you can choose
* the license that best suits your project, and use it accordingly.
*
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
*
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
* sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
* interval: 100, // number = milliseconds of polling interval
* over: showNav, // function = onMouseOver callback (required)
* timeout: 0, // number = milliseconds delay before onMouseOut function call
* out: hideNav // function = onMouseOut callback (required)
* });
*
* @param f onMouseOver function || An object with configuration options
* @param g onMouseOut function || Nothing (use configuration options object)
* @author Brian Cherne <brian@cherne.net>
*/
(function($) {
$.fn.hoverIntent = function(f,g) {
// default configuration options
var cfg = {
sensitivity: 7,
interval: 100,
timeout: 0
};
// override configuration options with user supplied object
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
$(ob).unbind("mousemove",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = 1;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = 0;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// REVISIT <AP>: 20090829; Unknown why mouseenter/mouseleave are being used
var etype = e.type;
etype = etype.replace(/mouseenter/, "mouseover");
etype = etype.replace(/mouseleave/, "mouseout");
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
var p = (etype == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
if ( p == this ) { return false; }
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = jQuery.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// else e.type == "onmouseover"
if (etype == "mouseover") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).bind("mousemove",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "onmouseout"
} else {
// unbind expensive mousemove event
$(ob).unbind("mousemove",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// bind the function to the two event listeners
return this.mouseover(handleHover).mouseout(handleHover);
};
})(jQuery);
$.event.special.hoverintent = {
setup: function() {
$(this).hoverIntent({
over: jQuery.event.special.hoverintent.over,
out: jQuery.event.special.hoverintent.out
});
},
teardown: function() {
},
over: function(ev) {
ev.type = 'hoverintent';
jQuery.event.handle.apply(this, arguments);
},
out: function(event) {
}
};

View File

@@ -0,0 +1,57 @@
/* ******************************************************************************
* hoverintent
*
* Works like mouseover, but instead of firing immediately when an object
* is mouseover'ed, it tries to determine when the user actually _intends_
* to have the pointer hover over the object. In other words, it's a lot
* like mouseover with a delay before firing, and if the pointer moves
* before hoverintent can fire, it doesn't fire at all.
*
* Found from jQuery UI Ticket #3614
* http://dev.jqueryui.com/ticket/3614
*/
var cfg = ($.hoverintent = {
sensitivity: 7,
interval: 100
});
$.event.special.hoverintent = {
setup: function() {
$(this).bind("mouseover", jQuery.event.special.hoverintent.handler);
},
teardown: function() {
$(this).unbind("mouseover", jQuery.event.special.hoverintent.handler);
},
handler: function(event) {
event.type = "hoverintent";
var self = this,
args = arguments,
target = $(event.target),
cX, cY, pX, pY;
function track(event) {
cX = event.pageX;
cY = event.pageY;
};
pX = event.pageX;
pY = event.pageY;
function clear() {
target.unbind("mousemove", track).unbind("mouseout", arguments.callee);
clearTimeout(timeout);
}
function handler() {
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
clear();
jQuery.event.handle.apply(self, args);
} else {
pX = cX; pY = cY;
timeout = setTimeout(handler, cfg.interval);
}
}
var timeout = setTimeout(handler, cfg.interval);
target.mousemove(track).mouseout(clear);
return true;
}
};

View File

@@ -9,7 +9,7 @@
* array/hash/object that is given. * array/hash/object that is given.
* Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php * Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
*/ */
function dump_old(arr,level) { function dump(arr,level) {
var dumped_text = ""; var dumped_text = "";
if(!level) level = 0; if(!level) level = 0;
@@ -34,65 +34,53 @@ function dump_old(arr,level) {
return dumped_text; return dumped_text;
} }
function dump(element, limit, depth) {
limit = (limit == null) ? 1 : limit;
depth = (depth == null) ? 0 : depth;
var rep1 = new Array(5); function var_dump(element, limit, depth)
var pad1 = rep1.join(" "); {
var rep = new Array(depth+1); depth = depth?depth:0;
var pad = rep.join(pad1); limit = limit?limit:1;
var props = new Array; returnString = '<ol>';
for(property in element)
for(property in element)
{ {
//Property domConfig isn't accessable //Property domConfig isn't accessable
if (property == 'domConfig') if (property != 'domConfig')
continue; {
returnString += '<li><strong>'+ property + '</strong> <small>(' + (typeof element[property]) +')</small>';
var propstr = '<strong>'+ property + '</strong>'; if (typeof element[property] == 'number' || typeof element[property] == 'boolean')
propstr += ' <small>(' + (typeof element[property]) +')</small>'; returnString += ' : <em>' + element[property] + '</em>';
if (typeof element[property] == 'string' && element[property])
returnString += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
element[property].replace(/</g, '&amp;lt;').replace(/>/g, '&amp;gt;') + '</code></div>';
if (typeof element[property] == 'number' || typeof element[property] == 'boolean') if ((typeof element[property] == 'object') && (depth < limit))
propstr += ' : <em>' + element[property] + '</em>'; returnString += var_dump(element[property], limit, (depth + 1));
if (typeof element[property] == 'string' && element[property])
propstr += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' +
htmlEscape(element[property]) + '</code></div>';
if ((typeof element[property] == 'object') && (depth < limit))
propstr += "\n" + pad + dump(element[property], limit, (depth + 1));
props.push(propstr); returnString += '</li>';
}
} }
returnString += '</ol>';
if (props.length == 0) if(depth == 0)
return ''; {
winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
winpop.document.write('<pre>'+returnString+ '</pre>');
winpop.document.close();
}
if (typeof dump.dumpid == 'undefined') return returnString;
dump.dumpid = 0;
++dump.dumpid;
return (pad
+ '<A HREF="#" ONCLICK="$(\'#dumpid-'+dump.dumpid+'\').toggle(); return false;">(hide members)</A><BR>'
+ '<ol id="dumpid-'+dump.dumpid+'" STYLE="padding-top:0; margin-top:0;">'
+ '<li>'
+ props.join("</li>\n" + pad + pad1 + '<li id="dumpid-'+dump.dumpid+'">')
+ "</li>\n"
+ pad + "</ol>");
} }
function dump_window(element, limit) {
winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
winpop.document.write(dump(element, limit));
winpop.document.close();
}
function htmlEscape (s) { function htmlEncode(s)
{
//return s;
return s.replace(/&(?!\w+([;\s]|$))/g, "&amp;") return s.replace(/&(?!\w+([;\s]|$))/g, "&amp;")
.replace(/</g, "&lt;").replace(/>/g, "&gt;"); .replace(/</g, "&lt;").replace(/>/g, "&gt;");
} }
function htmlEncode(s) { return htmlEscape(s); }
function addDiv(id_name, div_name, into_div_name, flash, html, script) { function addDiv(id_name, div_name, into_div_name, flash, html, script) {
var id = $('#'+id_name).val(); var id = $('#'+id_name).val();
@@ -114,13 +102,14 @@ function addDiv(id_name, div_name, into_div_name, flash, html, script) {
$("#"+into_div_name).append(html); $("#"+into_div_name).append(html);
if (flash) { if (flash) {
$('#'+div_name+'-'+id) $('#'+div_name+'-'+id)
//.addClass('ui-state-focus') .css({'background-color' : 'yellow'})
.slideDown() .slideDown()
//.removeClass('ui-state-focus', 500) //.animate({ backgroundColor: "yellow" }, 300)
; .animate({ backgroundColor: "white" }, 500);
} else { } else {
$('#'+div_name+'-'+id).show(); $('#'+div_name+'-'+id)
.show();
} }
id = id - 0 + 1; id = id - 0 + 1;
@@ -139,7 +128,7 @@ function fmtCurrency(amount) {
// Get rid of any extraneous characters, determine // Get rid of any extraneous characters, determine
// the sign, and round to the nearest cent. // the sign, and round to the nearest cent.
amount = amount.toString().replace(/\$|\,/g,''); amount = amount.toString().replace(/\$|\,/g,'');
var sign = (amount == (amount = Math.abs(amount))); sign = (amount == (amount = Math.abs(amount)));
amount = (amount+0.0000000001).toFixed(2); amount = (amount+0.0000000001).toFixed(2);
// Insert thousands separator // Insert thousands separator
@@ -156,114 +145,44 @@ function fmtCurrency(amount) {
// //
// Datepicker helpers // Datepicker helpers
function datepicker(id) {
$("#"+id).attr('autocomplete', 'off');
if ($("#"+id).datepicker != null) {
$("#"+id)
.datepicker({ constrainInput: true,
numberOfMonths: [1, 1],
showCurrentAtPos: 0,
dateFormat: 'mm/dd/yy' });
}
}
function datepickerGet(id) {
if (id == null)
dt = new Date();
else {
if ($("#"+id).datepicker != null && $("#"+id).datepicker('getDate') != null)
dt = new Date($("#"+id).datepicker('getDate'));
else if ($("#"+id).val())
dt = new Date($("#"+id).val());
else
dt = null;
}
return dt;
}
function datepickerStr(id) {
return dateStr(datepickerGet(id));
}
function datepickerSet(id, dt_or_str, usetime) {
if ($("#"+id).datepicker != null && $("#"+id).datepicker('getDate') != null) {
// datepicker seems to squash the time portion,
// so we have to pass in a copy of dt instead.
$("#"+id).datepicker('setDate', new Date(dt_or_str));
if (usetime)
$("#"+id).val($("#"+id).val() + ' ' + timeStr(dt_or_str));
}
else {
$("#"+id).val(dateStr(dt_or_str), usetime);
}
}
function datepickerNow(id, usetime) { function datepickerNow(id, usetime) {
datepickerSet(id, new Date(), usetime == null ? true : usetime); now = new Date();
// datepicker seems to squash the time portion,
// so we have to pass in a copy of now instead.
$("#"+id).datepicker('setDate', new Date(now));
if (usetime == null)
usetime = true;
$("#"+id).val($("#"+id).val() +
(usetime
? (' '
+ (now.getHours() < 10 ? '0' : '')
+ now.getHours() + ':'
+ (now.getMinutes() < 10 ? '0' : '')
+ now.getMinutes())
: ''));
} }
function dateStr(dt_or_str, usetime) { function datepickerSet(fromid, id, a, b) {
var dt = new Date(dt_or_str); if (fromid == null)
dt = new Date();
else
dt = new Date($("#"+fromid).datepicker('getDate'));
return (((dt.getMonth()+1) < 10 ? '0' : '') if (a != null)
+ (dt.getMonth()+1) + '/'
+ (dt.getDate() < 10 ? '0' : '')
+ dt.getDate() + '/'
+ dt.getFullYear()
+ (usetime ? ' ' + timeStr(dt) : ''));
}
function timeStr(dt_or_str) {
var dt = new Date(dt_or_str);
return ((dt.getHours() < 10 ? '0' : '')
+ dt.getHours() + ':'
+ (dt.getMinutes() < 10 ? '0' : '')
+ dt.getMinutes());
}
function dateAdd(dt_or_str, a, b, m, d) {
var dt = new Date(dt_or_str);
if (m != null) {
dt.setDate(1);
dt.setMonth(dt.getMonth() + m);
//$('#debug').append('set month ('+m+') ' + (dt.getMonth() + m) + '= ' + dt + '<BR>');
}
if (d != null) {
dt.setDate(dt.getDate() + d);
//$('#debug').append('set day ('+d+') ' + (dt.getDate() + d) + '= ' + dt + '<BR>');
}
if (a != null) {
dt.setDate(a); dt.setDate(a);
//$('#debug').append('set date ('+a+') = ' + dt + '<BR>'); if (b != null)
}
if (b != null) {
dt.setDate(b); dt.setDate(b);
//$('#debug').append('set date ('+b+') = ' + dt + '<BR>');
} $("#"+id).datepicker('setDate', dt);
return dt;
} }
function dateYesterday(dt) { return dateAdd(dt,null,null,null,-1); } function datepickerBOM(fromid, id) {
function dateTomorrow(dt) { return dateAdd(dt,null,null,null,1); } datepickerSet(fromid, id, 1);
function dateBOM(dt) { return dateAdd(dt,1); } }
function dateNextBOM(dt) { return dateAdd(dt,1,null,1); }
function dateEOM(dt) { return dateAdd(dt,32,0); }
function dateNextEOM(dt) { return dateAdd(dt,32,0,1); }
function datepickerBOM(fromid, id) function datepickerEOM(fromid, id) {
{ datepickerSet(id, dateBOM(datepickerGet(fromid))); } datepickerSet(fromid, id, 32, 0);
}
function datepickerEOM(fromid, id)
{ datepickerSet(id, dateEOM(datepickerGet(fromid))); }
function datepickerNextBOM(fromid, id)
{ datepickerSet(id, dateNextBOM(datepickerGet(fromid))); }
function datepickerNextEOM(fromid, id)
{ datepickerSet(id, dateNextEOM(datepickerGet(fromid))); }
// REVISIT <AP>: 20090617 // REVISIT <AP>: 20090617

View File

@@ -1,9 +1,3 @@
Reversing a rent charge is not considered as part of the
"charged-through" date on the lease. Consequently, the
reversal itself ensures the charge is fully "paid", and
the "paid-through" date is also out of whack.
Add NSF Fee to the NSF entry page (It's hardcoded right now Add NSF Fee to the NSF entry page (It's hardcoded right now
in Transaction to $35). in Transaction to $35).
@@ -21,6 +15,13 @@ be closed and no more charges are possible. The other option
would just be a checkbox to say "close lease (no more charges)", would just be a checkbox to say "close lease (no more charges)",
or let them clear it and have them close the lease manually. or let them clear it and have them close the lease manually.
Invoice
- Have some sort of rent-proration tool
- Have Rent automatically populate the Effective/Through
as well as rent (pro-rating if necessary). The dates
should take into account the customer charge through
date, as well as any other rents on the invoice.
Allow waiving a complete charge, even if it already has payments Allow waiving a complete charge, even if it already has payments
applied (at the moment, we just can waive the charge balance). applied (at the moment, we just can waive the charge balance).
@@ -51,6 +52,11 @@ Reduce the number of cached items. Figure out how to get Cake to
automatically make CONCAT(TenderType.name, ' #', Tender.id) part automatically make CONCAT(TenderType.name, ' #', Tender.id) part
of each returned query. of each returned query.
Implement, as part of the User model, a function to return the
security level. Have it be a static function, so that we don't
need to instantiate it, and right now, return a level based on
the route.
Add the opposite of the "collected" report, which provides a set of Add the opposite of the "collected" report, which provides a set of
checkboxes for the different incomes, and returns a list of where checkboxes for the different incomes, and returns a list of where
the received monies were disbursed for the selected period. the received monies were disbursed for the selected period.
@@ -187,37 +193,3 @@ Unit Size has no controller. Either remove the link from the
units grid, or implement the controller. units grid, or implement the controller.
When performing a move-in, the receipt page is broken
when trying to enter a concession. javascript complains about
an invalid value, and the page is not submitted.
- Allegedly. I believe Shirley's browser was acting up
on her, and based on the logs, it seems that indeed
what ultimately worked just fine for a concession entry
was really the exact same page that was stuck. While
on the phone it was evident that here browser was
doing a javascript wig-out, and it wasn't related to
a slow internet connection.
Add invoice rent helpers
- monthly proration tool
- select from/to dates, and hit "prorate"
- charge through date
- enter charge through date, and the invoice
will automatically have charges for each month
from the current charge-through date to the
new charge-through date.
- charge N months
- enter number of months, and the invoice
will automatically have charges for each month
from the current charge-through date for N months
- next rent
- same as, or instead of, "charge N months", where
N is 1
Invoice
- Have some sort of rent-proration tool
- Have Rent automatically populate the Effective/Through
as well as rent (pro-rating if necessary). The dates
should take into account the customer charge through
date, as well as any other rents on the invoice.