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

#3853 / New > Save: Reload des Forms mit neuer SIP und neu erstellter recordId.

Recode: new function buildNSetReloadUrl()
parent 1c95ff76
......@@ -334,27 +334,12 @@ class QuickFormQuery {
$sipArray = $this->store->getStore(STORE_SIP);
if ($sipArray[SIP_RECORD_ID] == 0) {
// For 'new' do a full reload of the form with a new SIP.
if ($this->formSpec[F_FORWARD_MODE] !== F_FORWARD_MODE_PAGE) {
$this->formSpec[F_FORWARD_MODE] = F_FORWARD_MODE_PAGE;
// Rebuild original URL
$storeT3 = $this->store->getStore(STORE_TYPO3);
$storeT3['id'] = $storeT3[TYPO3_PAGE_ID];
$storeT3 = OnArray::getArrayItems($storeT3, ['id', TYPO3_PAGE_TYPE, TYPO3_PAGE_LANGUAGE], true, true);
$arr = KeyValueStringParser::parse($this->store->getVar(SIP_URLPARAM, STORE_SIP), '=', '&');
$arr[SIP_RECORD_ID] = $rc;
$arr = array_merge($storeT3, $arr);
$queryString = KeyValueStringParser::unparse($arr, '=', '&');
$this->formSpec[F_FORWARD_PAGE] = store::getSipInstance()->queryStringToSip($queryString, RETURN_URL);
$this->formSpec = $this->buildNSetReloadUrl($this->formSpec, $rc);
}
$getJson = false;
}
// Action: Sendmail
$formAction->elements($rc, $this->feSpecAction, FE_TYPE_SENDMAIL);
......@@ -377,6 +362,36 @@ class QuickFormQuery {
return $data;
}
/**
* Set F_FORWARD_MODE to F_FORWARD_MODE_PAGE and builds a redirection URL to the current page with the already
* used parameters. Do this by building a new SIP with the new recordId.
*
* @param array $formSpec
* @param $recordId
* @return array
* @throws CodeException
* @throws UserFormException
*/
private function buildNSetReloadUrl(array $formSpec, $recordId) {
$formSpec[F_FORWARD_MODE] = F_FORWARD_MODE_PAGE;
// Rebuild original URL
$storeT3 = $this->store->getStore(STORE_TYPO3);
$storeT3['id'] = $storeT3[TYPO3_PAGE_ID];
$storeT3 = OnArray::getArrayItems($storeT3, ['id', TYPO3_PAGE_TYPE, TYPO3_PAGE_LANGUAGE], true, true);
$arr = KeyValueStringParser::parse($this->store->getVar(SIP_URLPARAM, STORE_SIP), '=', '&');
$arr[SIP_RECORD_ID] = $recordId;
$arr = array_merge($storeT3, $arr);
$queryString = KeyValueStringParser::unparse($arr, '=', '&');
$formSpec[F_FORWARD_PAGE] = store::getSipInstance()->queryStringToSip($queryString, RETURN_URL);
return $formSpec;
}
/**
* Load form. Evaluates form. Load FormElements.
*
......
Markdown is supported
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