Commit b0234a57 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature #3981 / Record Locking

Fixed some 'unknown index' issues - deny save in a first version works.
parent a0cd3709
......@@ -1102,3 +1102,4 @@ const DIRTY_MODE_OVERWRITE = 'overwrite';
const DIRTY_MODE_NONE = 'none';
const DIRTY_QFQ_USER_SESSION_COOKIE = 'qfqUserSessionCookie';
const DIRTY_FE_USER= 'feUser';
const DIRTY_REMOTE_ADDRESS = 'remoteAddress';
\ No newline at end of file
......@@ -97,7 +97,7 @@ class Dirty {
// No dirty record found.
$answer = $this->writeDirty($this->client[SIP_SIP], $recordId, $tableName, $formDirtyMode, $feUser);
} else {
$answer = $this->conflict($recordDirty, $formDirtyMode, $feUser);
$answer = $this->conflict($recordDirty, $formDirtyMode);
}
return $answer;
......@@ -114,7 +114,7 @@ class Dirty {
*/
private function getRecordDirty($tableName, $recordId) {
$recordDirty = $this->db->sql("SELECT id, sip, feUser, qfqUserSessionCookie, dirtyMode FROM Dirty AS d WHERE d.tableName LIKE ? AND recordId=? ",
$recordDirty = $this->db->sql("SELECT * FROM Dirty AS d WHERE d.tableName LIKE ? AND recordId=? ",
ROW_EXPECT_0_1, [$tableName, $recordId]);
return $recordDirty;
......@@ -126,10 +126,10 @@ class Dirty {
* @param $currentFormDirtyMode
* @return array
*/
private function conflict(array $recordDirty, $currentFormDirtyMode, $feUser) {
private function conflict(array $recordDirty, $currentFormDirtyMode) {
$status = API_ANSWER_STATUS_CONFLICT;
$at = "at " . $recordDirty[COLUMN_CREATED] . " from " . $recordDirty[CLIENT_REMOTE_ADDRESS];
$at = "at " . $recordDirty[COLUMN_CREATED] . " from " . $recordDirty[DIRTY_REMOTE_ADDRESS];
if ($this->client[CLIENT_COOKIE_QFQ] == $recordDirty[DIRTY_QFQ_USER_SESSION_COOKIE]) {
$msg = "The record has already been tagged for editing by you (maybe in another browser tab) $at!";
......@@ -137,10 +137,10 @@ class Dirty {
} else {
if (empty($feUser)) {
if (empty($recordDirty[DIRTY_FE_USER])) {
$msgUser = "another user";
} else {
$msgUser = "user '$feUser'";
$msgUser = "user '$recordDirty[DIRTY_FE_USER]'";
}
$msg = "The record has already been tagged for editing by $msgUser at $at.";
......@@ -207,7 +207,7 @@ class Dirty {
return;
}
$at = "at " . $recordDirty[COLUMN_CREATED] . " from " . $recordDirty[CLIENT_REMOTE_ADDRESS];
$at = "at " . $recordDirty[COLUMN_CREATED] . " from " . $recordDirty[DIRTY_REMOTE_ADDRESS];
$msgUser = (empty($recordDirty[DIRTY_FE_USER])) ? "another user" : "user '$recordDirty[DIRTY_FE_USER]'";
// Check if the record is timed out
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment