Issue Bug Closed

#95294cruser_id and crdate modified when versioning

Francois Suter 09/21/21, 09:41 updated 12/02/25, 14:33

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.

Reviews 2

History 47

  1. Francois Suter commented <span data-processor="relativetime" data-value="2021-09-22T12:13:45+00:00" > 09/22/21, 12:13 </span>

    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. Francois Suter commented <span data-processor="relativetime" data-value="2021-09-22T15:54:38+00:00" > 09/22/21, 15:54 </span>

    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().

  3. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-04-09T08:25:09+00:00" > 04/09/25, 08:25 </span>

    Applied in changeset commit:9b1c715d1a383c974e1dfe4d70a55385d2ef47b8.