Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
b7c61b61
Commit
b7c61b61
authored
Oct 12, 2019
by
Carsten Rose
Browse files
multiSql selects no records: a) customizable message, b) throw error on save().
parent
32f0413a
Pipeline
#2466
passed with stages
in 2 minutes and 50 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/Manual.rst
View file @
b7c61b61
...
...
@@ -4354,14 +4354,25 @@ Multi Form
----------
`Multi Forms` are like a regular form with the difference that the shown FormElements are repeated for *each* selected record
(defined by `multiformSql`).
(defined by `multiSql`).
+------------------+----------------------------------+------------------------------------------------+
| Name | | |
+==================+==================================+================================================+
| multiSql | {{!SELECT id, name FROM Person}} | Query to select MulitForm records |
+------------------+----------------------------------+------------------------------------------------+
| multiMgsNoRecord | Default: No data | Message shown if `multiSql` selects no records |
+------------------+----------------------------------+------------------------------------------------+
The Form is shown as a HTML table.
* `multi
Form
Sql`: Selects the records where the defined FormElements will work on each.
* `multiSql`: Selects the records where the defined FormElements will work on each.
* A uniq column 'id' or '_id' (not shown) is mandatory and has to reflect an existing record id in table `primary table`.
* Additional columns, defined in `multi
Form
Sql`, will be shown on the form in the same line, before the FormElements.
* Additional columns, defined in `multiSql`, will be shown on the form in the same line, before the FormElements.
`
Simple
...
...
@@ -4374,7 +4385,7 @@ General:
Form:
* Per row, the STORE_RECORD is filled with the whole record of the primary table, referenced
by `multi
Form
Sql.id`.
by `multiSql.id`.
FormElement:
...
...
@@ -4385,8 +4396,9 @@ FormElement:
Advanced
========
* The FormElement.name do not have to be a column of the primary table.
* The insert/update/delete SQL statement (of each non-primary table column) has to be individually defined.
* The `FormElement.name` do not have to be a column of the primary table.
* If `FormElement.name` is not a column of the primary table, the insert/update/delete SQL statement has to be
extra defined.
.. _multiple-languages:
...
...
extension/Classes/Core/AbstractBuildForm.php
View file @
b7c61b61
...
...
@@ -221,8 +221,7 @@ abstract class AbstractBuildForm {
// No rows: nothing to do.
if
(
empty
(
$parentRecords
))
{
//TODO Meldung konfigurierbar machen.
return
'No data'
;
return
$this
->
formSpec
[
F_MULTI_MSG_NO_RECORD
];
}
// Check for 'id' or '_id' as column name
...
...
extension/Classes/Core/Constants.php
View file @
b7c61b61
...
...
@@ -1040,6 +1040,8 @@ const F_ORDER_COLUMN = 'orderColumn';
const
F_ORDER_COLUMN_NAME
=
'ord'
;
const
F_SHOW_ID_IN_FORM_TITLE
=
SYSTEM_SHOW_ID_IN_FORM_TITLE
;
const
F_MULTI_MSG_NO_RECORD
=
'multiMsgNoRecord'
;
const
F_MULTI_MSG_NO_RECORD_TEXT
=
'No data'
;
const
F_REST_SQL_LIST
=
'restSqlList'
;
const
F_REST_SQL_DATA
=
'restSqlData'
;
...
...
extension/Classes/Core/QuickFormQuery.php
View file @
b7c61b61
...
...
@@ -1438,6 +1438,7 @@ class QuickFormQuery {
Support
::
setIfNotSet
(
$formSpec
,
F_ENTER_AS_SUBMIT
,
$this
->
store
->
getVar
(
SYSTEM_ENTER_AS_SUBMIT
,
STORE_SYSTEM
));
Support
::
setIfNotSet
(
$formSpec
,
F_SESSION_TIMEOUT_SECONDS
,
$this
->
store
->
getVar
(
SYSTEM_SESSION_TIMEOUT_SECONDS
,
STORE_SYSTEM
));
Support
::
setIfNotSet
(
$formSpec
,
F_FE_REQUIRED_POSITION
,
F_FE_REQUIRED_POSITION_LABEL_RIGHT
);
Support
::
setIfNotSet
(
$formSpec
,
F_MULTI_MSG_NO_RECORD
,
F_MULTI_MSG_NO_RECORD_TEXT
);
// In case there is no F_MODE defined on the form, check if there is one in STORE_SIP.
if
(
$formSpec
[
F_MODE
]
==
''
)
{
...
...
extension/Classes/Core/Save.php
View file @
b7c61b61
...
...
@@ -75,11 +75,11 @@ class Save {
public
function
process
()
{
$rc
=
0
;
if
(
$this
->
formSpec
[
F_MULTI_SQL
]
!==
''
)
{
$rc
=
$this
->
saveMultiForm
();
}
else
{
if
(
$this
->
formSpec
[
F_MULTI_SQL
]
==
''
)
{
$recordId
=
$this
->
store
->
getVar
(
SIP_RECORD_ID
,
STORE_SIP
.
STORE_ZERO
);
$rc
=
$this
->
elements
(
$recordId
);
}
else
{
$rc
=
$this
->
saveMultiForm
();
}
return
$rc
;
...
...
@@ -96,10 +96,12 @@ class Save {
$parentRecords
=
$this
->
evaluate
->
parse
(
$this
->
formSpec
[
F_MULTI_SQL
],
ROW_REGULAR
);
// No rows:
nothing to do
.
// No rows:
This must be an error, cause MultiForms must have at least one record
.
if
(
empty
(
$parentRecords
))
{
//TODO Meldung konfigurierbar machen.
return
'No data'
;
throw
new
\
UserFormException
(
json_encode
([
ERROR_MESSAGE_TO_USER
=>
$this
->
formSpec
[
F_MULTI_MSG_NO_RECORD
],
ERROR_MESSAGE_TO_DEVELOPER
=>
'Query selects no records: '
.
$this
->
formSpec
[
F_MULTI_SQL
]]),
ERROR_MISSING_EXPECT_RECORDS
);
}
// Check for 'id' or '_id' as column name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment