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
b266e693
Commit
b266e693
authored
Jun 05, 2016
by
Carsten Rose
Browse files
Set modified & created on Form save.
During save of a record, if column 'modifed' and/or ' created' exist, set them.
parent
12fbff0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/Save.php
View file @
b266e693
...
...
@@ -77,6 +77,8 @@ class Save {
* @throws UserFormException
*/
public
function
elements
(
$recordId
)
{
$columnCreated
=
false
;
$columnModified
=
false
;
$newValues
=
array
();
...
...
@@ -93,6 +95,14 @@ class Save {
continue
;
}
if
(
$column
===
COLUMN_CREATED
)
{
$columnCreated
=
true
;
}
if
(
$column
===
COLUMN_MODIFIED
)
{
$columnModified
=
true
;
}
// Is there a value? Do not forget SIP values. Those do not have necessarily a FormElement.
if
(
!
isset
(
$formValues
[
$column
]))
{
continue
;
...
...
@@ -104,7 +114,14 @@ class Save {
$newValues
[
$column
]
=
$formValues
[
$column
];
}
if
(
$columnModified
&&
!
isset
(
$newValues
[
COLUMN_MODIFIED
]))
{
$newValues
[
COLUMN_MODIFIED
]
=
date
(
'YmdHis'
);
}
if
(
$recordId
==
0
)
{
if
(
$columnCreated
&&
!
isset
(
$newValues
[
COLUMN_CREATED
]))
{
$newValues
[
COLUMN_CREATED
]
=
date
(
'YmdHis'
);
}
$rc
=
$this
->
insertRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
);
}
else
{
$this
->
updateRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
,
$recordId
);
...
...
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