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
324d4549
Commit
324d4549
authored
Oct 13, 2019
by
Carsten Rose
Browse files
Implements #5695 - fire FillStoreVar for multiForm elments during save
parent
c9d81811
Pipeline
#2471
passed with stages
in 2 minutes and 40 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
extension/Classes/Core/Form/FormAction.php
View file @
324d4549
...
...
@@ -68,6 +68,33 @@ class FormAction {
}
/**
* @param string $fillStoreVar
* @throws \CodeException
* @throws \DbException
* @throws \UserFormException
* @throws \UserReportException
*/
private
function
feFillStoreVar
(
$fillStoreVar
)
{
if
(
$fillStoreVar
!=
''
)
{
$this
->
store
->
setVar
(
SYSTEM_FORM_ELEMENT_COLUMN
,
FE_FILL_STORE_VAR
,
STORE_SYSTEM
);
// debug
$rows
=
$this
->
evaluate
->
parse
(
$fillStoreVar
,
ROW_EXPECT_0_1
);
if
(
is_array
(
$rows
))
{
$this
->
store
->
appendToStore
(
$rows
,
STORE_VAR
);
}
else
{
if
(
!
empty
(
$rows
))
{
throw
new
\
UserFormException
(
json_encode
(
[
ERROR_MESSAGE_TO_USER
=>
"Invalid statement for 'fillStoreVar'."
,
ERROR_MESSAGE_TO_DEVELOPER
=>
$fillStoreVar
]),
ERROR_INVALID_OR_MISSING_PARAMETER
);
}
}
}
}
/**
* @param integer $recordId
* @param array $feSpecAction
...
...
@@ -106,20 +133,8 @@ class FormAction {
continue
;
}
if
(
isset
(
$fe
[
FE_FILL_STORE_VAR
]))
{
$this
->
store
->
setVar
(
SYSTEM_FORM_ELEMENT_COLUMN
,
FE_FILL_STORE_VAR
,
STORE_SYSTEM
);
// debug
$rows
=
$this
->
evaluate
->
parse
(
$fe
[
FE_FILL_STORE_VAR
],
ROW_EXPECT_0_1
);
if
(
is_array
(
$rows
))
{
$this
->
store
->
appendToStore
(
$rows
,
STORE_VAR
);
}
else
{
if
(
!
empty
(
$rows
))
{
throw
new
\
UserFormException
(
json_encode
(
[
ERROR_MESSAGE_TO_USER
=>
"Invalid statement for 'fillStoreVar'."
,
ERROR_MESSAGE_TO_DEVELOPER
=>
$fe
[
FE_FILL_STORE_VAR
]]),
ERROR_INVALID_OR_MISSING_PARAMETER
);
}
}
$this
->
feFillStoreVar
(
$fe
[
FE_FILL_STORE_VAR
]
??
''
);
$fe
[
FE_FILL_STORE_VAR
]
=
''
;
// do not process the same later on.
}
// Process templateGroup action elements
if
(
isset
(
$fe
[
FE_ID_CONTAINER
])
&&
$fe
[
FE_ID_CONTAINER
]
>
0
)
{
...
...
@@ -345,6 +360,8 @@ class FormAction {
$rcStatus
=
ACTION_ELEMENT_NO_CHANGE
;
$this
->
feFillStoreVar
(
$fe
[
FE_FILL_STORE_VAR
]
??
''
);
// slaveId might be used in sqlBefore: get it first.
if
(
isset
(
$fe
[
FE_SLAVE_ID
]))
{
// Get the slaveId
...
...
extension/Classes/Core/Save.php
View file @
324d4549
...
...
@@ -125,8 +125,12 @@ class Save {
$fillStoreForm
=
new
FillStoreForm
();
foreach
(
$parentRecords
as
$row
)
{
$row
[
F_MULTI_COL_ID
]
=
$row
[
$idName
];
// In case '_id' is used, both '_id' and 'id' should be accessible.
$this
->
store
->
setStore
(
$row
,
STORE_PARENT_RECORD
,
true
);
$record
=
$this
->
db
->
sql
(
'SELECT * FROM `'
.
$this
->
formSpec
[
F_TABLE_NAME
]
.
'` WHERE id='
.
$row
[
F_MULTI_COL_ID
],
ROW_EXPECT_1
);
$this
->
store
->
setStore
(
$record
,
STORE_RECORD
,
true
);
// Fake current recordId
$this
->
store
->
setVar
(
SIP_RECORD_ID
,
$row
[
$idName
],
STORE_SIP
);
$fillStoreForm
->
process
(
FORM_SAVE
);
...
...
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