From 6609a83a17e108bb458ad82134744cc650dbcb2a Mon Sep 17 00:00:00 2001 From: Clemens Gogoljn Date: Fri, 22 Dec 2023 20:18:57 +0100 Subject: [PATCH 1/4] Fix : Add missing lanugage setting in the event and event type record. --- Classes/Domain/TCA/EventTypeTca.php | 10 ++++++---- .../TCA/tx_participants_domain_model_event.php | 5 +++-- .../TCA/tx_participants_domain_model_eventtype.php | 4 ++-- Resources/Private/Language/de.locallang_db.xlf | 4 ++++ Resources/Private/Language/locallang_db.xlf | 3 +++ ext_emconf.php | 5 +++-- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Classes/Domain/TCA/EventTypeTca.php b/Classes/Domain/TCA/EventTypeTca.php index c9cdbe2..5c58bbd 100644 --- a/Classes/Domain/TCA/EventTypeTca.php +++ b/Classes/Domain/TCA/EventTypeTca.php @@ -21,10 +21,12 @@ class EventTypeTca public function computeTitleDescription(&$parameters) { $record = BackendUtility::getRecord($parameters['table'], $parameters['row']['uid']); - $description = strip_tags($record['description']); - if (strlen($description) > 24) { - $description = substr($description, 0, 24) . '…'; + if ($record != null) { + $description = isset($record['description']) ? strip_tags($record['description']) : ''; + if (strlen($description) > 24) { + $description = substr($description, 0, 24) . '…'; + } + $parameters['title'] = $record['title'] . (trim($description) == '' ? '' : ' (' . $description . ')'); } - $parameters['title'] = $record['title'] . (trim($description) == '' ? '' : ' (' . $description . ')'); } } \ No newline at end of file diff --git a/Configuration/TCA/tx_participants_domain_model_event.php b/Configuration/TCA/tx_participants_domain_model_event.php index 8c94679..963ce84 100644 --- a/Configuration/TCA/tx_participants_domain_model_event.php +++ b/Configuration/TCA/tx_participants_domain_model_event.php @@ -39,13 +39,14 @@ 'interface' => [ 'showRecordFieldList' => 'l10n_parent, l10n_diffsource, hidden, canceled, event_type, date, full_day, time, ' . 'duration, usergroups, show_public_usergroups, public_usergroups, description, public, public_description, ' - . 'show_public_description ' + . 'show_public_description, sys_language_uid' ], 'types' => [ '1' => [ 'showitem' => ' l10n_parent, l10n_diffsource, hidden, canceled, event_type, public, date, full_day, time, duration,' . '--div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_event.tabGroupSettings, usergroups, show_public_usergroups, public_usergroups, ' - . '--div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_event.tabDescription, description, show_public_description, public_description ' + . '--div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_event.tabDescription, description, show_public_description, public_description, ' + . '--div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_event.tabMiscellaneous, sys_language_uid' ] ], 'columns' => [ diff --git a/Configuration/TCA/tx_participants_domain_model_eventtype.php b/Configuration/TCA/tx_participants_domain_model_eventtype.php index c102f77..4efa723 100644 --- a/Configuration/TCA/tx_participants_domain_model_eventtype.php +++ b/Configuration/TCA/tx_participants_domain_model_eventtype.php @@ -25,11 +25,11 @@ 'iconfile' => 'EXT:participants/Resources/Public/Icons/tx_participants_domain_model_event_type.gif' ], 'interface' => [ - 'showRecordFieldList' => ' l10n_parent, l10n_diffsource, hidden, title, description, public' + 'showRecordFieldList' => ' l10n_parent, l10n_diffsource, hidden, title, description, public, sys_language_uid' ], 'types' => [ '1' => [ - 'showitem' => ' l10n_parent, l10n_diffsource, hidden, title, public, description, usergroups, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime' + 'showitem' => ' l10n_parent, l10n_diffsource, hidden, title, public, description, usergroups, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime, sys_language_uid' ] ], 'columns' => [ diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 1845b36..b455631 100755 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -199,6 +199,10 @@ Description Beschreibung + + Miscellaneous + Sonstiges + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index e1bfec2..d24658a 100755 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -158,6 +158,9 @@ Description + + Miscellaneous + diff --git a/ext_emconf.php b/ext_emconf.php index dc608ca..01c703e 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 1, - 'version' => '3.7.0', + 'version' => '3.7.1', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-11.5.99', @@ -29,7 +29,8 @@ /** * Change log: * - + +3.7.1 :: Fix : Add missing lanugage setting in the event and event type record. 3.7.0 :: Chg : Switch to the new reason for prevention service api. 3.6.6 :: Add : Personal duty roster -> disabled buttons are grey. 3.6.5 :: Fix : Optimize the commitment description text output. From 0eabd64f942becddbacfb9121a37d804369caa2d Mon Sep 17 00:00:00 2001 From: Clemens Gogoljn Date: Fri, 22 Dec 2023 20:32:41 +0100 Subject: [PATCH 2/4] Fix : Event description is not displayed in the list view if the event is hidden (disabled). --- Classes/Domain/TCA/EventTca.php | 3 +++ ext_emconf.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/TCA/EventTca.php b/Classes/Domain/TCA/EventTca.php index 2f8a214..b7f3eb8 100644 --- a/Classes/Domain/TCA/EventTca.php +++ b/Classes/Domain/TCA/EventTca.php @@ -3,6 +3,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -25,6 +26,7 @@ public function computeTitle(&$parameters) $typeTitle = ''; $description = ''; $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_participants_domain_model_event')->createQueryBuilder(); + $qb->getRestrictions()->removeByType(HiddenRestriction::class); $statement = $qb->select('tx_participants_domain_model_eventtype.title') ->addSelect('tx_participants_domain_model_eventtype.description') ->addSelect('tx_participants_domain_model_event.uid') @@ -34,6 +36,7 @@ public function computeTitle(&$parameters) ->where($qb->expr() ->eq('tx_participants_domain_model_event.uid', $qb->createNamedParameter(intval($parameters['row']['uid'])))) ->execute(); + while ($row = $statement->fetchAssociative()) { $description = strip_tags($row['description']); if (strlen($description) > 10) { diff --git a/ext_emconf.php b/ext_emconf.php index 01c703e..25c0d72 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 1, - 'version' => '3.7.1', + 'version' => '3.7.2', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-11.5.99', @@ -30,6 +30,7 @@ * Change log: * +3.7.2 :: Fix : Event description is not displayed in the list view if the event is hidden (disabled). 3.7.1 :: Fix : Add missing lanugage setting in the event and event type record. 3.7.0 :: Chg : Switch to the new reason for prevention service api. 3.6.6 :: Add : Personal duty roster -> disabled buttons are grey. From f7fef863acccbc7635f964e59ac154b9ef500e82 Mon Sep 17 00:00:00 2001 From: Clemens Gogoljn Date: Sun, 31 Dec 2023 10:20:49 +0100 Subject: [PATCH 3/4] Many small fixes --- .../TaskForceOverviewController.php | 3 +- .../TimeOutManagementController.php | 45 ++++++++++--------- Classes/Domain/Model/Event.php | 7 ++- .../Domain/Repository/TimeOutRepository.php | 2 + Classes/Service/FrontendUserService.php | 35 +++------------ Resources/Private/Partials/UserCard.html | 4 +- ext_emconf.php | 7 ++- ext_tables.sql | 2 +- 8 files changed, 46 insertions(+), 59 deletions(-) diff --git a/Classes/Controller/TaskForceOverviewController.php b/Classes/Controller/TaskForceOverviewController.php index 3e4922b..f88a0f0 100755 --- a/Classes/Controller/TaskForceOverviewController.php +++ b/Classes/Controller/TaskForceOverviewController.php @@ -104,7 +104,6 @@ public function showAction(): void } $usersWithTimeout = array_unique($usersWithTimeout); - $timeOuts = array(); foreach ($tmp as $reason => $to) { $tmpUsersTimeOuts = array(); @@ -123,7 +122,7 @@ public function showAction(): void } $canViewCurrentlyOfDuty = false; - if ($this->settings[TaskForceOverviewController::CAN_VIEW_CURRENTLY_OFF_DUTY] != null) { + if ($this->frontendUserService->isLogged() && $this->settings[TaskForceOverviewController::CAN_VIEW_CURRENTLY_OFF_DUTY] != null) { /** @var FrontendUserGroup $frontendUserGroup */ foreach ($this->frontendUserService->getCurrentUser()->getUsergroup() as $frontendUserGroup) { if (in_array($this->settings[TaskForceOverviewController::CAN_VIEW_CURRENTLY_OFF_DUTY], $this->frontendUserService->getSubGroups($frontendUserGroup))) { diff --git a/Classes/Controller/TimeOutManagementController.php b/Classes/Controller/TimeOutManagementController.php index a4bfc75..64f7973 100755 --- a/Classes/Controller/TimeOutManagementController.php +++ b/Classes/Controller/TimeOutManagementController.php @@ -87,7 +87,7 @@ public function listAction(): void $this->view->assign('addTimeOut', $addTimeOut); $this->view->assign('reasons', $reasons); } else { - $validationResults->addError('notLoggedInd'); + $validationResults->addError('notLoggedIn'); } $this->view->assign(TimeOutManagementController::VALIDATIOPN_RESULTS, $validationResults); } @@ -100,7 +100,7 @@ public function listAction(): void */ public function deleteAction(TimeOut $timeout = null): void { - if ($this->frontendUserService->isLogged() && $timeout->getUser()->getUid() === $this->frontendUserService->getCurrentUserUid()) { + if ($this->frontendUserService->isLogged() && $timeout->getUser() != null && $timeout->getUser()->getUid() === $this->frontendUserService->getCurrentUserUid()) { $this->timeOutRepository->remove($timeout); } $this->redirect('list'); @@ -109,9 +109,8 @@ public function deleteAction(TimeOut $timeout = null): void /** * create a time out * - * @param - * AddTimeOut addTimeOut - * @return Object + * @param AddTimeOut addTimeOut + * @return object */ public function createAction(AddTimeOut $addTimeOut = null): object { @@ -164,30 +163,34 @@ private function validate(AddTimeOut $addTimeOut = null): ValidationResults /** @var ValidationResults $validationResults **/ $validationResults = $this->getValidationResults(); - if ($addTimeOut == null) { - $validationResults->addError('mysteryError'); + if (!$this->frontendUserService->isLogged()) { + $validationResults->addError('notLoggedIn'); + } else { - if (empty(trim($addTimeOut->getFrom()))) { - $validationResults->addError('invalidFrom'); + if ($addTimeOut == null) { + $validationResults->addError('mysteryError'); } else { - $from = \DateTime::createFromFormat('!' . TimeOutManagementController::GERMAN_DATE_FORMAT, $addTimeOut->getFrom()); - if ($from === false) { + if (empty(trim($addTimeOut->getFrom()))) { $validationResults->addError('invalidFrom'); + } else { + $from = \DateTime::createFromFormat('!' . TimeOutManagementController::GERMAN_DATE_FORMAT, $addTimeOut->getFrom()); + if ($from === false) { + $validationResults->addError('invalidFrom'); + } } - } - if (empty(trim($addTimeOut->getUntil()))) { - $validationResults->addError('invalidUntil'); - } else { - $until = \DateTime::createFromFormat('!' . TimeOutManagementController::GERMAN_DATE_FORMAT, $addTimeOut->getUntil()); - if ($until === false) { + if (empty(trim($addTimeOut->getUntil()))) { $validationResults->addError('invalidUntil'); + } else { + $until = \DateTime::createFromFormat('!' . TimeOutManagementController::GERMAN_DATE_FORMAT, $addTimeOut->getUntil()); + if ($until === false) { + $validationResults->addError('invalidUntil'); + } + } + if (!$validationResults->hasErrors() && $from->getTimestamp() > $until->getTimestamp()) { + $validationResults->addError('untilBeforeFrom'); } - } - if (!$validationResults->hasErrors() && $from->getTimestamp() > $until->getTimestamp()) { - $validationResults->addError('untilBeforeFrom'); } } - return $validationResults; } diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index d04c6f6..8dfc87f 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -81,7 +81,7 @@ class Event extends AbstractEntity * * @var string */ - protected $time = '00:00'; + protected $time = '00:00:00'; /** * @@ -350,7 +350,7 @@ public function setDate(\DateTime $date): void */ public function getTime(): \DateTime { - return \DateTime::createFromFormat('H:i:s', $this->time); + return $this->time == null ? \DateTime::createFromFormat('H:i:s', '00:00:00') : \DateTime::createFromFormat('H:i:s', $this->time); } /** @@ -639,4 +639,7 @@ public function setCanceled(bool $canceled): void { $this->canceled = $canceled; } + + + } \ No newline at end of file diff --git a/Classes/Domain/Repository/TimeOutRepository.php b/Classes/Domain/Repository/TimeOutRepository.php index a14f7a7..a2de833 100644 --- a/Classes/Domain/Repository/TimeOutRepository.php +++ b/Classes/Domain/Repository/TimeOutRepository.php @@ -30,6 +30,8 @@ public function getTimeOuts() $q->lessThanOrEqual('from', $today), $q->greaterThanOrEqual('until', $today) ])); + // $queryParser = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class); + // debug($queryParser->convertQueryToDoctrineQueryBuilder($q)->getSQL()); return $q->execute(); } } diff --git a/Classes/Service/FrontendUserService.php b/Classes/Service/FrontendUserService.php index 0e87259..059b713 100755 --- a/Classes/Service/FrontendUserService.php +++ b/Classes/Service/FrontendUserService.php @@ -37,7 +37,7 @@ public function __construct(FrontendUserRepository $frontendUserRepository) /** * - * @param Object $obj + * @param object $obj * @return int */ public static function getUid(Object $object): int @@ -47,9 +47,9 @@ public static function getUid(Object $object): int /** * - * @return FrontendUser Returns the current frontend user + * @return FrontendUser|bool Returns the current frontend user */ - public function getCurrentUser(): FrontendUser + public function getCurrentUser(): FrontendUser|bool { if (! $this->isLogged()) { return false; @@ -78,7 +78,8 @@ public function getCurrentUserUid(): int public function isLogged(): bool { $context = GeneralUtility::makeInstance(Context::class); - return $context->getPropertyFromAspect('frontend.user', 'isLoggedIn'); + $isPreview = ($context->hasAspect('frontend.preview') && $context->getPropertyFromAspect('frontend.preview', 'isPreview')); + return !$isPreview && $context->getPropertyFromAspect('frontend.user', 'isLoggedIn'); } /** @@ -105,30 +106,6 @@ public function contains($userGroup, $feugid, &$loopProtect = array()): bool } } - /** - * - * @param FrontendUserGroup $userGroup - * @param integer $fegid - * @param array $loopProtect - * @return boolean - */ - public function getAllGroups($userGroup, $return = array(), &$loopProtect = array()): bool - { - $return = array(); - if ($userGroup->getUid() == $feugid) { - return true; - } else { - if (! in_array($userGroup->getUid(), $loopProtect)) { - $loopProtect[] = $userGroup->getUid(); - foreach ($userGroup->getSubgroup() as $sg) { - if ($this->contains($sg, $feugid, $loopProtect)) { - return true; - } - } - } - return false; - } - } /** * @@ -213,7 +190,7 @@ private function _getTopGroups(int $ug, array &$return = []): array ->where($qb->expr() ->inSet('subgroup', $ug)) ->execute(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAllAssociative()) { $uid = intVal($row['uid']); if (! in_array($uid, $return)) { $return = array_unique(array_merge($return, $this->_getTopGroups($uid, $return))); diff --git a/Resources/Private/Partials/UserCard.html b/Resources/Private/Partials/UserCard.html index 9d19d3f..7142d14 100644 --- a/Resources/Private/Partials/UserCard.html +++ b/Resources/Private/Partials/UserCard.html @@ -4,7 +4,7 @@ - + {user.firstName} {user.lastName} @@ -16,7 +16,7 @@ - + {user.firstName} {user.lastName} diff --git a/ext_emconf.php b/ext_emconf.php index 25c0d72..d4e08d5 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 1, - 'version' => '3.7.2', + 'version' => '3.7.6', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-11.5.99', @@ -29,7 +29,10 @@ /** * Change log: * - +3.7.6 :: Fix : Link from TaskForceOverview to the user list. +3.7.5 :: Fix : Frontend user service: Better handling of simulated users. +3.7.4 :: Fix : Timeout management: You can only delete a period only without exceptions if the user is logged in. +3.7.3 :: Fix : Duty roster excepts events with a null time. 3.7.2 :: Fix : Event description is not displayed in the list view if the event is hidden (disabled). 3.7.1 :: Fix : Add missing lanugage setting in the event and event type record. 3.7.0 :: Chg : Switch to the new reason for prevention service api. diff --git a/ext_tables.sql b/ext_tables.sql index 247d39a..1e6bbc1 100755 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -119,7 +119,7 @@ CREATE TABLE tx_participants_domain_model_event ( public SMALLINT (5) UNSIGNED DEFAULT '2' NOT NULL, full_day SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, date date DEFAULT '2000-01-01' NOT NULL, - time time DEFAULT '19:00:00', + time time DEFAULT '19:00:00' NOT NULL, duration SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (uid), KEY parent (pid) From 3ad1a8b4463fb67fa2710a26c1b0e2b7413c39b6 Mon Sep 17 00:00:00 2001 From: Clemens Gogoljn Date: Tue, 2 Jan 2024 23:41:56 +0100 Subject: [PATCH 4/4] Small fixes --- Classes/Service/FrontendUserService.php | 2 +- Configuration/TCA/Overrides/fe_users.php | 2 +- Resources/Private/Templates/PersonalDutyRoster/Show.html | 2 +- ext_emconf.php | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Classes/Service/FrontendUserService.php b/Classes/Service/FrontendUserService.php index 059b713..a01a794 100755 --- a/Classes/Service/FrontendUserService.php +++ b/Classes/Service/FrontendUserService.php @@ -49,7 +49,7 @@ public static function getUid(Object $object): int * * @return FrontendUser|bool Returns the current frontend user */ - public function getCurrentUser(): FrontendUser|bool + public function getCurrentUser(): FrontendUser|false { if (! $this->isLogged()) { return false; diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php index 62ef423..662c46d 100755 --- a/Configuration/TCA/Overrides/fe_users.php +++ b/Configuration/TCA/Overrides/fe_users.php @@ -57,7 +57,7 @@ ] ], 'readOnly' => true, - 'default' => 1, + 'default' => 0, ] ], 'info_mail_when_personal_duty_roster_changed' => [ diff --git a/Resources/Private/Templates/PersonalDutyRoster/Show.html b/Resources/Private/Templates/PersonalDutyRoster/Show.html index 4825818..539c7ab 100755 --- a/Resources/Private/Templates/PersonalDutyRoster/Show.html +++ b/Resources/Private/Templates/PersonalDutyRoster/Show.html @@ -33,7 +33,7 @@
objectName="personalDutyRosterFilterSettings">
-
+
diff --git a/ext_emconf.php b/ext_emconf.php index d4e08d5..cb8b6e3 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 1, - 'version' => '3.7.6', + 'version' => '3.7.9', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-11.5.99', @@ -29,6 +29,10 @@ /** * Change log: * + +3.7.9 :: Fix : Fix the default user setting for automatic apply commitments. +3.7.8 :: Fix : Fix the return value type in the frontend user service. +3.7.7 :: Fix : Adapts the personal duty roster folter column counts. 3.7.6 :: Fix : Link from TaskForceOverview to the user list. 3.7.5 :: Fix : Frontend user service: Better handling of simulated users. 3.7.4 :: Fix : Timeout management: You can only delete a period only without exceptions if the user is logged in.