Commit 65d07872 authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[BUGFIX] Use VersionState constants instead of numbers

A few places still use t3ver_state instead of the available
constants in VersionState. To increase
the semantics of the used code, the constants are used
instead.

Resolves: #88395
Releases: master, 9.5
Change-Id: I3c2927c2d4c8814d581f06f84de8f4c85d6226a1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60780

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 828f4262
......@@ -46,6 +46,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
......@@ -2120,7 +2121,7 @@ class DatabaseRecordList
$disableDelete = (bool)\trim($userTsConfig['options.']['disableDelete.'][$table] ?? $userTsConfig['options.']['disableDelete'] ?? '0');
if ($permsEdit && !$disableDelete && ($table === 'pages' && $localCalcPerms & Permission::PAGE_DELETE || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT)) {
// Check if the record version is in "deleted" state, because that will switch the action to "restore"
if ($backendUser->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
if ($backendUser->workspace > 0 && isset($row['t3ver_state']) && VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$actionName = 'restore';
$refCountMsg = '';
} else {
......
......@@ -212,7 +212,7 @@ class DataHandlerHook
->getConnectionForTable($table)
->update(
$table,
['t3ver_state' => 2],
['t3ver_state' => VersionState::DELETE_PLACEHOLDER],
['uid' => $id]
);
......
......@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
......@@ -529,13 +530,13 @@ class GridDataService implements LoggerAwareInterface
$hiddenState = 'unhidden';
}
switch ($stateId) {
case -1:
case VersionState::NEW_PLACEHOLDER_VERSION:
$state = 'new';
break;
case 2:
case VersionState::DELETE_PLACEHOLDER:
$state = 'deleted';
break;
case 4:
case VersionState::MOVE_POINTER:
$state = 'moved';
break;
default:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment