Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
3ba5f4fe
Commit
3ba5f4fe
authored
Jul 14, 2020
by
Marc Egger
Browse files
Refs #10120 add return type to function
parent
79def3bf
Pipeline
#3610
failed with stages
in 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Form/FormAsFile.php
View file @
3ba5f4fe
...
...
@@ -291,20 +291,20 @@ class FormAsFile
/**
* Return form name if given record is an existing Form or FormElement.
* Return
false
otherwise.
* Return
null
otherwise.
*
* @param int $recordId
* @param string $recordTable
* @param Database $database
* @return string formName|
false
* @return string formName|
null
* @throws \CodeException
* @throws \DbException
* @throws \UserFormException
*/
public
static
function
isFormOrFormElement
(
int
$recordId
,
string
$recordTable
,
Database
$database
)
public
static
function
formNameFromFormRelatedRecord
(
int
$recordId
,
string
$recordTable
,
Database
$database
)
:
?string
{
if
(
$recordId
===
0
)
{
return
false
;
return
null
;
}
switch
(
$recordTable
)
{
case
TABLE_NAME_FORM
:
...
...
@@ -325,7 +325,7 @@ class FormAsFile
[
$recordId
],
"Form element with id '
$recordId
' not found. "
.
self
::
errorHintFormImport
());
return
$formFromDb
[
F_NAME
];
default
:
return
false
;
return
null
;
}
}
...
...
extension/Classes/Core/QuickFormQuery.php
View file @
3ba5f4fe
...
...
@@ -424,8 +424,8 @@ class QuickFormQuery {
// Make sure form file is writable (before DB changes are made)
// Note: This can't be done earlier because $formModeNew might be changed in the lines above.
$recordFormName
=
FormAsFile
::
isFormOrFormElement
(
$recordId
,
$this
->
formSpec
[
F_TABLE_NAME
],
$this
->
dbArray
[
$this
->
dbIndexQfq
]);
if
(
$recordFormName
!==
false
&&
in_array
(
$formModeNew
,
[
FORM_SAVE
,
FORM_DRAG_AND_DROP
,
FORM_DELETE
]))
{
$recordFormName
=
FormAsFile
::
formNameFromFormRelatedRecord
(
$recordId
,
$this
->
formSpec
[
F_TABLE_NAME
],
$this
->
dbArray
[
$this
->
dbIndexQfq
]);
if
(
$recordFormName
!==
null
&&
in_array
(
$formModeNew
,
[
FORM_SAVE
,
FORM_DRAG_AND_DROP
,
FORM_DELETE
]))
{
FormAsFile
::
enforceFormFileWritable
(
$recordFormName
);
}
...
...
@@ -1030,8 +1030,8 @@ class QuickFormQuery {
[
$formName
],
'Form "'
.
$formName
.
'" not found or multiple forms with the same name.'
);
// Import Form from file if loaded record is Form/FormElement (If form file was changed, throw exception)
$recordFormName
=
FormAsFile
::
isFormOrFormElement
(
$recordId
,
$form
[
F_TABLE_NAME
],
$this
->
dbArray
[
$this
->
dbIndexQfq
]);
if
(
$recordFormName
!==
false
)
{
$recordFormName
=
FormAsFile
::
formNameFromFormRelatedRecord
(
$recordId
,
$form
[
F_TABLE_NAME
],
$this
->
dbArray
[
$this
->
dbIndexQfq
]);
if
(
$recordFormName
!==
null
)
{
if
(
FormAsFile
::
importForm
(
$recordFormName
,
$this
->
dbArray
[
$this
->
dbIndexQfq
]))
{
throw
new
\
UserFormException
(
json_encode
([
ERROR_MESSAGE_TO_USER
=>
'Form file was changed.'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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