Bug #95294

cruser_id and crdate modified when versioning

Added by Francois Suter 8 months ago. Updated 8 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2021-09-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

#1

Updated by Francois Suter 8 months ago

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.

#2

Updated by Francois Suter 8 months ago

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