Commit 7e489693 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#4421 / subrecord: column of the sql1 row should go into the edit link - implemented

parent 01388e16
......@@ -2778,13 +2778,13 @@ will be rendered inside the form as a HTML table.
* *page*: Target page with detail form. If none specified, use the current page.
* *title*: Title displayed over the table in the current form.
* *extraDeleteForm*: Optional. The per row delete Button will reference the form specified here (for deleting) instead of the default (*form*).
* *detail*: Mapping of values from the primary form to the target form (defined via `form=...`).
* *detail*: Mapping of values from a) the primary form, b) the current row, c) any constant or '{{...}}' - to the target form (defined via `form=...`).
* Syntax::
<source table column name 1|&constant 1>:<target column name 1>[,<source table column name 2|&constant 2>:<target column name 2>][...]
* Example: *detail=id:personId,&12:xId,&{{a}}:personId*
* Example: *detail=id:personId,rowId:secId,&12:xId,&{{a}}:personId* (rowId is a column of the current selected row defined by sql1)
* By default, the given value will overwrite values on the target record. In most situations, this is the wished behaviour.
* Exceptions of the default behaviour have to be defined on the target form in the corresponding *FormElement* in the
field *value* by changing the default Store priority definition. E.g. `{{<columnname>:RS0}}` - For existing records,
......
......@@ -2274,8 +2274,7 @@ abstract class AbstractBuildForm {
/**
* Construct a HTML table of the subrecord data.
* Column syntax definition:
* https://wikiit.math.uzh.ch/it/projekt/qfq/qfq-jqwidgets/Documentation#Type:_subrecord
* Column syntax definition:https://docs.typo3.org/typo3cms/drafts/github/T3DocumentationStarter/Public-Info-053/Manual.html#type-subrecord
*
* @param array $formElement
* @param string $htmlFormElementName
......@@ -2339,7 +2338,7 @@ abstract class AbstractBuildForm {
$rowHtml = '';
if ($flagEdit) {
$rowHtml .= Support::wrapTag('<td>', $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit'));
$rowHtml .= Support::wrapTag('<td>', $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit', $row));
} elseif ($flagNew) {
$rowHtml .= Support::wrapTag('<td>', $rowHtml, false);
}
......@@ -2453,7 +2452,7 @@ abstract class AbstractBuildForm {
* @return string
* @throws UserFormException
*/
private function createFormLink(array $formElement, $targetRecordId, array $record, $symbol, $toolTip) {
private function createFormLink(array $formElement, $targetRecordId, array $record, $symbol, $toolTip, $currentRow = array()) {
//TODO: Umstellen auf Benutzung der Link Klasse.
......@@ -2474,7 +2473,18 @@ abstract class AbstractBuildForm {
// Form record values or parameter
if (isset($record[$src])) {
$queryStringArray[$dest] = $record[$src];
continue;
}
// Current row - check '$src' and '_$src' )
foreach (['', '_'] as $pre) {
if (isset($currentRow[$pre . $src])) {
$queryStringArray[$dest] = $currentRow[$pre . $src];
continue 2;
}
}
$queryStringArray[$dest] = ERROR_SUBRECORD_DETAIL_COLUMN_NOT_FOUND;
}
}
......
......@@ -178,7 +178,7 @@ const ERROR_PLAY_SQL_FILE = 1080;
// Subrecord
const ERROR_SUBRECORD_MISSING_COLUMN_ID = 1100;
const ERROR_SUBRECORD_DETAIL_COLUMN_NOT_FOUND = 'Column not found in primary record or current row';
// Store
const ERROR_STORE_VALUE_ALREADY_CODPIED = 1200;
const ERROR_STORE_KEY_EXIST = 1201;
......
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