Fixed bug causing crash if locks in use exceeds the number of locks that are supposed to exist

git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@1043 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
Abijah
2014-03-03 07:22:06 +00:00
parent 11a9ca903b
commit 87d6d93493

View File

@@ -55,7 +55,7 @@ class LocksController extends AppController {
function gridDataFields(&$params, &$model) {
$fields = parent::gridDataFields($params, $model);
$fields[] = 'COUNT(LocksUnit.id) AS inuse';
$fields[] = 'Lock.qty - COUNT(LocksUnit.id) AS avail';
$fields[] = 'IF(Lock.qty > COUNT(LocksUnit.id), Lock.qty - COUNT(LocksUnit.id), 0) AS avail';
return $fields;
}