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
324a1ad3
Commit
324a1ad3
authored
Oct 13, 2019
by
Carsten Rose
Browse files
Fix that saving a record with no FE, always update the modified column of the primary record.
parent
15439f12
Pipeline
#2475
passed with stages
in 2 minutes and 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Save.php
View file @
324a1ad3
...
@@ -9,16 +9,16 @@
...
@@ -9,16 +9,16 @@
namespace
IMATHUZH\Qfq\Core
;
namespace
IMATHUZH\Qfq\Core
;
use
IMATHUZH\Qfq\Core\Database\Database
;
use
IMATHUZH\Qfq\Core\Database\Database
;
use
IMATHUZH\Qfq\Core\Form\FormAction
;
use
IMATHUZH\Qfq\Core\Helper\HelperFile
;
use
IMATHUZH\Qfq\Core\Helper\HelperFile
;
use
IMATHUZH\Qfq\Core\Helper\HelperFormElement
;
use
IMATHUZH\Qfq\Core\Helper\HelperFormElement
;
use
IMATHUZH\Qfq\Core\Helper\Logger
;
use
IMATHUZH\Qfq\Core\Helper\Logger
;
use
IMATHUZH\Qfq\Core\Helper\OnArray
;
use
IMATHUZH\Qfq\Core\Helper\OnArray
;
use
IMATHUZH\Qfq\Core\Helper\Sanitize
;
use
IMATHUZH\Qfq\Core\Helper\Sanitize
;
use
IMATHUZH\Qfq\Core\Helper\Support
;
use
IMATHUZH\Qfq\Core\Helper\Support
;
use
IMATHUZH\Qfq\Core\Store\FillStoreForm
;
use
IMATHUZH\Qfq\Core\Store\Sip
;
use
IMATHUZH\Qfq\Core\Store\Sip
;
use
IMATHUZH\Qfq\Core\Store\Store
;
use
IMATHUZH\Qfq\Core\Store\Store
;
use
IMATHUZH\Qfq\Core\Store\FillStoreForm
;
use
IMATHUZH\Qfq\Core\Form\FormAction
;
/**
/**
* Class Save
* Class Save
...
@@ -123,12 +123,17 @@ class Save {
...
@@ -123,12 +123,17 @@ class Save {
}
}
$fillStoreForm
=
new
FillStoreForm
();
$fillStoreForm
=
new
FillStoreForm
();
$storeVarBase
=
$this
->
store
->
getStore
(
STORE_VAR
);
foreach
(
$parentRecords
as
$row
)
{
foreach
(
$parentRecords
as
$row
)
{
$row
[
F_MULTI_COL_ID
]
=
$row
[
$idName
];
// In case '_id' is used, both '_id' and 'id' should be accessible.
// Always start with a clean STORE_VAR
$this
->
store
->
setStore
(
$storeVarBase
,
STORE_VAR
,
true
);
$this
->
store
->
setStore
(
$row
,
STORE_PARENT_RECORD
,
true
);
$this
->
store
->
setStore
(
$row
,
STORE_PARENT_RECORD
,
true
);
$this
->
store
->
setVar
(
F_MULTI_COL_ID
,
$row
[
$idName
],
STORE_PARENT_RECORD
);
// In case '_id' is used, both '_id' and 'id' should be accessible.
$record
=
$this
->
db
->
sql
(
'SELECT * FROM `'
.
$this
->
formSpec
[
F_TABLE_NAME
]
.
'` WHERE id='
.
$row
[
F_MULTI_COL_ID
],
ROW_EXPECT_1
);
$record
=
$this
->
db
->
sql
(
'SELECT * FROM `'
.
$this
->
formSpec
[
F_TABLE_NAME
]
.
'` WHERE id='
.
$row
[
$idName
],
ROW_EXPECT_1
);
$this
->
store
->
setStore
(
$record
,
STORE_RECORD
,
true
);
$this
->
store
->
setStore
(
$record
,
STORE_RECORD
,
true
);
// Fake current recordId
// Fake current recordId
...
@@ -277,7 +282,7 @@ class Save {
...
@@ -277,7 +282,7 @@ class Save {
}
}
if
(
$columnModified
&&
!
isset
(
$newValues
[
COLUMN_MODIFIED
]))
{
if
(
$columnModified
&&
!
empty
(
$newValues
)
&&
!
isset
(
$newValues
[
COLUMN_MODIFIED
]))
{
$newValues
[
COLUMN_MODIFIED
]
=
date
(
'YmdHis'
);
$newValues
[
COLUMN_MODIFIED
]
=
date
(
'YmdHis'
);
}
}
...
@@ -288,7 +293,9 @@ class Save {
...
@@ -288,7 +293,9 @@ class Save {
$rc
=
$this
->
insertRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
);
$rc
=
$this
->
insertRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
);
}
else
{
}
else
{
$this
->
updateRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
,
$recordId
,
$this
->
formSpec
[
F_PRIMARY_KEY
]);
if
(
!
empty
(
$newValues
))
{
$this
->
updateRecord
(
$this
->
formSpec
[
F_TABLE_NAME
],
$newValues
,
$recordId
,
$this
->
formSpec
[
F_PRIMARY_KEY
]);
}
$rc
=
$recordId
;
$rc
=
$recordId
;
}
}
...
...
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