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:
Abijah
2014-03-03 15:54:35 +00:00
parent 30fdc10648
commit 01a6984a53
2 changed files with 12 additions and 3 deletions

View File

@@ -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));