Commit 6de68a36 authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm:

- 'id' and '_id' are now valid columnnames for mandatory subrecord 'id' column.
- subrecord > new record: fixed problem with missing default parameter.
- createFormLink(): addedd 'array' to signature.
parent 7d348ce8
...@@ -994,8 +994,12 @@ abstract class AbstractBuildForm { ...@@ -994,8 +994,12 @@ abstract class AbstractBuildForm {
return ''; return '';
} }
if (!isset($formElement['sql1'][0]['id'])) { $nameColumnId = 'id';
throw new UserException('Missing column \'id\' in \'sql1\' Query', ERROR_DB_MISSING_COLUMN_ID); if (!isset($formElement['sql1'][0][$nameColumnId]))
$nameColumnId = '_id';
if (!isset($formElement['sql1'][0][$nameColumnId])) {
throw new UserException('Missing column \'id\' (or "@_id") in \'sql1\' Query', ERROR_DB_MISSING_COLUMN_ID);
} }
// construct column attributes // construct column attributes
...@@ -1004,7 +1008,7 @@ abstract class AbstractBuildForm { ...@@ -1004,7 +1008,7 @@ abstract class AbstractBuildForm {
// $html .= '<b>' . $formElement['label'] . '</b>'; // $html .= '<b>' . $formElement['label'] . '</b>';
// $html .= '<table border="1">'; // $html .= '<table border="1">';
$linkNew = $this->createFormLink($formElement, 0, array(), $this->symbol[SYMBOL_NEW], 'New'); $linkNew = $this->createFormLink($formElement, 0, $primaryRecord, $this->symbol[SYMBOL_NEW], 'New');
$html .= '<p>' . $linkNew . '</p>'; $html .= '<p>' . $linkNew . '</p>';
$html .= '<table class="table">'; $html .= '<table class="table">';
...@@ -1013,7 +1017,7 @@ abstract class AbstractBuildForm { ...@@ -1013,7 +1017,7 @@ abstract class AbstractBuildForm {
foreach ($formElement['sql1'] as $row) { foreach ($formElement['sql1'] as $row) {
$html .= '<tr>'; $html .= '<tr>';
$html .= '<td>' . $this->createFormLink($formElement, $row['id'], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit') . '</td>'; $html .= '<td>' . $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit') . '</td>';
foreach ($row as $columnName => $value) { foreach ($row as $columnName => $value) {
$html .= '<td>' . $this->renderCell($control, $columnName, $value) . '</td>'; $html .= '<td>' . $this->renderCell($control, $columnName, $value) . '</td>';
...@@ -1106,7 +1110,7 @@ abstract class AbstractBuildForm { ...@@ -1106,7 +1110,7 @@ abstract class AbstractBuildForm {
* @return string * @return string
* @throws UserException * @throws UserException
*/ */
private function createFormLink($formElement, $targetRecordId, $record, $symbol, $linkTitle) { private function createFormLink(array $formElement, $targetRecordId, array $record, $symbol, $linkTitle) {
$queryStringArray = [ $queryStringArray = [
'form' => $formElement['form'], 'form' => $formElement['form'],
......
...@@ -161,7 +161,7 @@ VALUES ...@@ -161,7 +161,7 @@ VALUES
(1, '', 'FormElements', 'show', 'subrecord', 'native', 500, 0, 0, '', '', '', (1, '', 'FormElements', 'show', 'subrecord', 'native', 500, 0, 0, '', '', '',
'{{!SELECT * FROM FormElement WHERE formId={{id:R0}}}}', '{{!SELECT * FROM FormElement WHERE formId={{id:R0}}}}',
'', 'form=formElement', 5); '', 'form=formElement\ndetail=id:formId', 5);
# #
# FormEditor: FormElement # FormEditor: FormElement
......
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