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

#4144 / Close/New: bei acquireLock=false anschliessend keine Nachfrage ob gespeichert werden soll

Check if Record is already exclusive locked. If yes, show Form in readonly mode.
parent 2c6db127
......@@ -115,7 +115,7 @@ class QuickFormQuery {
* Store might throw an exception, in case the URL-passed SIP is invalid.
*
* @param array $t3data
* @param bool $phpUnit
* @param bool $phpUnit
* @throws CodeException
* @throws UserFormException
*/
......@@ -274,13 +274,23 @@ class QuickFormQuery {
$answer = $dirty->checkDirtyAndRelease($formMode, $this->formSpec[F_RECORD_LOCK_TIMEOUT_SECONDS],
$this->formSpec[F_DIRTY_MODE], $this->formSpec[F_TABLE_NAME], $recordId, true);
// in case of a conflict, return immediately
// In case of a conflict, return immediately
if ($answer[API_STATUS] != API_ANSWER_STATUS_SUCCESS) {
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
return $answer;
}
}
// FORM_LOAD: if there is an foreign exclusive record lock - show form in F_MODE_READONLY mode.
if ($formMode === FORM_LOAD) {
$dirty = new Dirty();
$recordDirty = array();
$rcLockFound = $dirty->getCheckDirty($this->formSpec[F_TABLE_NAME], $recordId, $recordDirty, $msg);
if (($rcLockFound == LOCK_FOUND_CONFLICT || $rcLockFound == LOCK_FOUND_OWNER) && $recordDirty[F_DIRTY_MODE] == DIRTY_MODE_EXCLUSIVE) {
$this->formSpec[F_MODE] = F_MODE_READONLY;
}
}
if ($formMode === FORM_DELETE) {
$build = new Delete();
......@@ -399,7 +409,7 @@ class QuickFormQuery {
/**
* Iterate over all Clipboard source records and fire for each all FE.type=paste records.
*
* @param int $formId
* @param int $formId
* @param FormAction $formAction
* @throws CodeException
* @throws DbException
......@@ -446,7 +456,7 @@ class QuickFormQuery {
* used parameters. Do this by building a new SIP with the new recordId.
*
* @param array $formSpec
* @param int $recordId
* @param int $recordId
* @return array
* @throws CodeException
* @throws UserFormException
......@@ -480,7 +490,7 @@ class QuickFormQuery {
* Loaded 'native' FormElements are in $this->feSpecNative
*
* @param string $mode FORM_LOAD|FORM_SAVE|FORM_UPDATE
* @param int $recordId
* @param int $recordId
* @param string $foundInStore
* @return bool|string if found the formName, else 'false'.
* @throws CodeException
......@@ -571,8 +581,8 @@ class QuickFormQuery {
* This code is dirty: the nearly same function exists in class 'Database' - the difference is only 'explodeTemplateGroupElements()'.
*
* @param string $sql SQL_FORM_ELEMENT_SPECIFIC_CONTAINER | SQL_FORM_ELEMENT_ALL_CONTAINER
* @param array $param Parameter which matches the prepared statement in $sql
* @param array $formSpec Main FormSpec to copy generic parameter to FormElements
* @param array $param Parameter which matches the prepared statement in $sql
* @param array $formSpec Main FormSpec to copy generic parameter to FormElements
* @return array|int
* @throws \qfq\CodeException
* @throws \qfq\DbException
......@@ -701,7 +711,7 @@ class QuickFormQuery {
* Depending on $mode various formSpec fields might be adjusted.
* E.g.: the form title is not important during a delete.
*
* @param string $mode
* @param string $mode
* @param array $form
* @return array
*/
......@@ -936,7 +946,7 @@ class QuickFormQuery {
unset($data[API_ELEMENT_UPDATE]);
}
if(count($data)>0){
if (count($data) > 0) {
$collect[API_FORM_UPDATE][] = $data;
}
}
......
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