Added timestamp when the lock last had a keychange.
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@1045 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -37,8 +37,10 @@ class Lock extends AppModel {
|
||||
$oldkey = $this->field('key');
|
||||
$this->pr(5, compact('oldkey'));
|
||||
|
||||
if ($this->field('key') != $data['Lock']['key'])
|
||||
if ($this->field('key') != $data['Lock']['key']) {
|
||||
$data['Lock']['last_key'] = $this->field('key');
|
||||
$data['Lock']['key_ts'] = date('Y-m-d G:i:s');
|
||||
}
|
||||
|
||||
/* // Find the number of outstanding locks in use */
|
||||
/* $locks = $this->find('first', */
|
||||
@@ -52,6 +54,12 @@ class Lock extends AppModel {
|
||||
/* if ($locks[0]['inuse'] > $data['Lock']['qty']) */
|
||||
/* return $this->prReturn(false); */
|
||||
}
|
||||
else {
|
||||
// Brand new lock
|
||||
}
|
||||
|
||||
if (!$data['Lock']['qty'])
|
||||
$data['Lock']['qty'] = 1;
|
||||
|
||||
// Everything looks good... save it!
|
||||
return $this->prReturn($this->save($data, false));
|
||||
|
||||
@@ -16,8 +16,9 @@ $rows[] = array('Name', $lock['name']);
|
||||
if ($lock['qty'] > 1)
|
||||
$rows[] = array('Quantity', $lock['qty']);
|
||||
$rows[] = array('Key', $lock['key']);
|
||||
if (!empty($lock['last_key']))
|
||||
$rows[] = array('Last Key', $lock['last_key']);
|
||||
if (!empty($lock['last_key'])) {
|
||||
$rows[] = array('Last Key', $lock['last_key'] . " (Changed on " . FormatHelper::datetime($lock['key_ts']) . ")");
|
||||
}
|
||||
$rows[] = array('Comment', $lock['comment']);
|
||||
|
||||
echo $this->element('table',
|
||||
|
||||
Reference in New Issue
Block a user