Bug #95294
open
cruser_id and crdate modified when versioning
Added by Francois Suter about 3 years ago.
Updated about 3 years ago.
Description
When a change is made in a workspace, a copy of the record is made (the new version until it is published). On that copy the cruser_id
field is set to the user who triggered this new version. The crdate
field is also changed to the time when the version was created. When the version is published, these become the new values for the live record.
We thus lose the historical creation information about this record. It may be of limited value, but I still think that it is wrong to overwrite it.
The path into the code is the following:
- the
\TYPO3\CMS\Workspaces\Hook\DataHandlerHook::processCmdmap()
hook triggers the creation of a new version by invoking \TYPO3\CMS\Core\DataHandling\DataHandler::versionizeRecord()
- in turn this calls
\TYPO3\CMS\Core\DataHandling\DataHandler::copyRecord_raw()
- which itself calls
\TYPO3\CMS\Core\DataHandling\DataHandler::insertNewCopyVersion()
which is where "crdate", "cruser_id" and "tstamp" are forcefully set
So the solution is not an easy one, because it means interfering deep down in the DataHandler class, at a point where there's no entry point (hook, event) yet.
As a workaround for now, I have used the processCmdmap_afterFinish
to restore the creation user and date information in case of a versioning operation. Not very clean, but functional.
I guess that rather than trying to modify \TYPO3\CMS\Core\DataHandling\DataHandler::insertNewCopyVersion()
it might be easier to add some postprocessing to \TYPO3\CMS\Workspaces\Hook\DataHandlerHook::processCmdmap()
.
Also available in: Atom
PDF