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
0f2659c6
Commit
0f2659c6
authored
Jul 21, 2020
by
Marc Egger
Browse files
Refs #10120 insertForm(): update filestats at the end instead of with form insert
parent
97501ec0
Pipeline
#3640
failed with stages
in 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Form/FormAsFile.php
View file @
0f2659c6
...
...
@@ -8,7 +8,6 @@ use IMATHUZH\Qfq\Core\Helper\HelperFile;
use
IMATHUZH\Qfq\Core\Helper\OnString
;
use
IMATHUZH\Qfq\Core\Helper\SqlQuery
;
// TODO: insertForm(): update filestats at the end instead of with form insert
// TODO: Testen:
// QFQ komplett neu installiert => form dir existiert mit allen form files aktuell.
// QFQ neu installation mit existierenden forms => alte forms sind noch da.
...
...
@@ -155,14 +154,13 @@ class FormAsFile
self
::
deleteFormDBWithId
(
$formId
,
$database
);
}
// Insert new Form to DB (after filtering allowed columns and adding column
s
'name'
and 'fileStats'
)
// Insert new Form to DB (after filtering allowed columns and adding column 'name')
$formSchema
=
$database
->
getTableDefinition
(
TABLE_NAME_FORM
);
$formColumns
=
array_column
(
$formSchema
,
'Field'
);
$insertValues
=
array_filter
(
$formFromFile
,
function
(
$columnName
)
use
(
$formColumns
)
{
return
$columnName
!==
F_ID
&&
in_array
(
$columnName
,
$formColumns
);
},
ARRAY_FILTER_USE_KEY
);
// array(column => value)
$insertValues
[
F_NAME
]
=
$formName
;
$insertValues
[
F_FILE_STATS
]
=
$fileStatsNew
;
list
(
$sqlFormInsert
,
$parameterArrayFormInsert
)
=
SqlQuery
::
insertRecord
(
TABLE_NAME_FORM
,
$insertValues
);
$formId
=
$database
->
sql
(
$sqlFormInsert
,
ROW_REGULAR
,
$parameterArrayFormInsert
);
...
...
@@ -189,6 +187,11 @@ class FormAsFile
$database
->
sql
(
$sql
,
ROW_REGULAR
,
$parameterArray
);
}
}
// Update column fileStats if everything went well
list
(
$sql
,
$parameterArray
)
=
SqlQuery
::
updateRecord
(
TABLE_NAME_FORM
,
[
F_FILE_STATS
=>
$fileStatsNew
],
$formId
);
$database
->
sql
(
$sql
,
ROW_REGULAR
,
$parameterArray
);
return
true
;
}
...
...
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