Commit 00bd14b6 authored by bbaer's avatar bbaer
Browse files

Merge remote-tracking branch 'origin/feature_4144' into feature_4144

parents 361a7430 95e8b2d5
...@@ -318,7 +318,7 @@ Server Response ...@@ -318,7 +318,7 @@ Server Response
: The response contains a [Minimal Response]. : The response contains a [Minimal Response].
### Record(s) delete ### Record delete
Request the deletion of the record identified by the SIP. The SIP might contain a SIP_TABLE and/or a SIP_FORM. Request the deletion of the record identified by the SIP. The SIP might contain a SIP_TABLE and/or a SIP_FORM.
If both are specified, SIP_FORM will be taken. With SIP_FORM, the tableName is derived from the form. If both are specified, SIP_FORM will be taken. With SIP_FORM, the tableName is derived from the form.
...@@ -353,6 +353,43 @@ URL Parameters ...@@ -353,6 +353,43 @@ URL Parameters
Server Response Server Response
: The response contains at least a [Minimal Response]. In addition, a [Typeahead dict], : The response contains at least a [Minimal Response]. In addition, a [Typeahead dict],
### Record lock
Request, extend or release a lock for a record, identified by the SIP. The SIP contain a SIP_FORM and a SIP_R (record id).
To detect record change at time of 'record lock' or 'record save', a MD5 hash is provided from the server
and needs to pass back to dirty.php as well.
Request
: api/dirty.php
Request Method
: GET
URL Parameters
: `s=<SIP>` (form, r)
: `action=lock`, `action=extend`, `action=release>`
: `recordHashMd5=<value of hidden form element 'recordHashMd5'>`
Server Response
: The response contains an [Lock Response].
### Lock Response
Asynchronous request (read AJAX) initiated by the Client receive a
JSON Response from the server (extended [Minimal Response]) containing:
{
"status": "success"|"error"|"conflict"|"conflict_allow_force",
"message": "<message>"
}
`status` indicates how the request has been fullfiled by the server.
On`"success"`, the Client display nothing to the user.
On one of`"error"|"conflict"|"conflict_allow_force"` the Client must display `"<message>"` to the user.
On `"conflict"` the Client opens the alert as modal dialog (user can't change anything on the form) with a 'reload current
form' button.
On `"conflict_allow_force"` the Client opens the alert non-modal (default).
## Glossary ## Glossary
SIP SIP
......
...@@ -115,7 +115,7 @@ class QuickFormQuery { ...@@ -115,7 +115,7 @@ class QuickFormQuery {
* Store might throw an exception, in case the URL-passed SIP is invalid. * Store might throw an exception, in case the URL-passed SIP is invalid.
* *
* @param array $t3data * @param array $t3data
* @param bool $phpUnit * @param bool $phpUnit
* @throws CodeException * @throws CodeException
* @throws UserFormException * @throws UserFormException
*/ */
...@@ -274,13 +274,23 @@ class QuickFormQuery { ...@@ -274,13 +274,23 @@ class QuickFormQuery {
$answer = $dirty->checkDirtyAndRelease($formMode, $this->formSpec[F_RECORD_LOCK_TIMEOUT_SECONDS], $answer = $dirty->checkDirtyAndRelease($formMode, $this->formSpec[F_RECORD_LOCK_TIMEOUT_SECONDS],
$this->formSpec[F_DIRTY_MODE], $this->formSpec[F_TABLE_NAME], $recordId, true); $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) { if ($answer[API_STATUS] != API_ANSWER_STATUS_SUCCESS) {
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR; $answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
return $answer; 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) { if ($formMode === FORM_DELETE) {
$build = new Delete(); $build = new Delete();
...@@ -399,7 +409,7 @@ class QuickFormQuery { ...@@ -399,7 +409,7 @@ class QuickFormQuery {
/** /**
* Iterate over all Clipboard source records and fire for each all FE.type=paste records. * Iterate over all Clipboard source records and fire for each all FE.type=paste records.
* *
* @param int $formId * @param int $formId
* @param FormAction $formAction * @param FormAction $formAction
* @throws CodeException * @throws CodeException
* @throws DbException * @throws DbException
...@@ -446,7 +456,7 @@ class QuickFormQuery { ...@@ -446,7 +456,7 @@ class QuickFormQuery {
* used parameters. Do this by building a new SIP with the new recordId. * used parameters. Do this by building a new SIP with the new recordId.
* *
* @param array $formSpec * @param array $formSpec
* @param int $recordId * @param int $recordId
* @return array * @return array
* @throws CodeException * @throws CodeException
* @throws UserFormException * @throws UserFormException
...@@ -480,7 +490,7 @@ class QuickFormQuery { ...@@ -480,7 +490,7 @@ class QuickFormQuery {
* Loaded 'native' FormElements are in $this->feSpecNative * Loaded 'native' FormElements are in $this->feSpecNative
* *
* @param string $mode FORM_LOAD|FORM_SAVE|FORM_UPDATE * @param string $mode FORM_LOAD|FORM_SAVE|FORM_UPDATE
* @param int $recordId * @param int $recordId
* @param string $foundInStore * @param string $foundInStore
* @return bool|string if found the formName, else 'false'. * @return bool|string if found the formName, else 'false'.
* @throws CodeException * @throws CodeException
...@@ -571,8 +581,8 @@ class QuickFormQuery { ...@@ -571,8 +581,8 @@ class QuickFormQuery {
* This code is dirty: the nearly same function exists in class 'Database' - the difference is only 'explodeTemplateGroupElements()'. * 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 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 $param Parameter which matches the prepared statement in $sql
* @param array $formSpec Main FormSpec to copy generic parameter to FormElements * @param array $formSpec Main FormSpec to copy generic parameter to FormElements
* @return array|int * @return array|int
* @throws \qfq\CodeException * @throws \qfq\CodeException
* @throws \qfq\DbException * @throws \qfq\DbException
...@@ -701,7 +711,7 @@ class QuickFormQuery { ...@@ -701,7 +711,7 @@ class QuickFormQuery {
* Depending on $mode various formSpec fields might be adjusted. * Depending on $mode various formSpec fields might be adjusted.
* E.g.: the form title is not important during a delete. * E.g.: the form title is not important during a delete.
* *
* @param string $mode * @param string $mode
* @param array $form * @param array $form
* @return array * @return array
*/ */
...@@ -936,7 +946,7 @@ class QuickFormQuery { ...@@ -936,7 +946,7 @@ class QuickFormQuery {
unset($data[API_ELEMENT_UPDATE]); unset($data[API_ELEMENT_UPDATE]);
} }
if(count($data)>0){ if (count($data) > 0) {
$collect[API_FORM_UPDATE][] = $data; $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