diff --git a/Classes/Controller/CommitmentSettingsController.php b/Classes/Controller/CommitmentSettingsController.php index 0f3446f..57e725d 100755 --- a/Classes/Controller/CommitmentSettingsController.php +++ b/Classes/Controller/CommitmentSettingsController.php @@ -59,11 +59,10 @@ public function showAction(): void /** * create a time out * - * @param - * CommitmentSettings commitmentSettings - * @return void + * @param CommitmentSettings commitmentSettings + * @return ForwardResponse */ - public function saveAction(CommitmentSettings $commitmentSettings) + public function saveAction(CommitmentSettings $commitmentSettings): ForwardResponse { /** * @@ -71,7 +70,9 @@ public function saveAction(CommitmentSettings $commitmentSettings) */ $u = $this->frontendUserRepository->findByUid($this->frontendUserService->getCurrentUserUid()); if ($u != null) { - $u->setApplyPlanningData($commitmentSettings->getApplyPlanningData()); + if ($commitmentSettings->getApplyPlanningData() !== null) { + $u->setApplyPlanningData($commitmentSettings->getApplyPlanningData()); + } $u->setInfoMailWhenPersonalDutyRosterChanged($commitmentSettings->getInfoMailWhenPersonalDutyRosterChanged()); $u->setPersonalDutyEventReminder($commitmentSettings->getPersonalDutyEventReminder()); $this->frontendUserRepository->update($u); @@ -80,4 +81,4 @@ public function saveAction(CommitmentSettings $commitmentSettings) return GeneralUtility::makeInstance(ForwardResponse::class, 'show'); } -} +} \ No newline at end of file diff --git a/Classes/Controller/PersonalDutyRosterController.php b/Classes/Controller/PersonalDutyRosterController.php index 20439ff..eb058cc 100755 --- a/Classes/Controller/PersonalDutyRosterController.php +++ b/Classes/Controller/PersonalDutyRosterController.php @@ -1,6 +1,7 @@ frontendUserService = $frontendUserService; $this->commitmentRepository = $commitmentRepository; $this->frontendUserRepository = $frontendUserRepository; @@ -106,10 +112,11 @@ public function setPersonalDutyRosterFilterAction(PersonalDutyRosterGroupFilterS } // add new settings (hidden groups) foreach ($personalDutyRosterFilterSettings->getSettings() as $entry) { - if (! $entry->getVisible()) { + if (!$entry->getVisible()) { $u->addHiddenPersonalDutyRosterGroups($entry->getFrontendUserGroup()); } } + $u->setOnlyScheduledEvents($personalDutyRosterFilterSettings->getOnlyScheduledEvents()); // debug($u); $this->frontendUserRepository->update($u); } @@ -131,7 +138,7 @@ public function showAction(): void * @var PersonalDutyRosterGroupFilterSettings $personalDutyRosterFilterSettings * @var array $personalDutyRosterGroups */ - list ($personalDutyRosterGroups, $personalDutyRosterFilterSettings) = $this->getPersonalDutyRosterFilterSettings(); + list($personalDutyRosterGroups, $personalDutyRosterFilterSettings) = $this->getPersonalDutyRosterFilterSettings(); // debug($personalDutyRosterGroups); // debug($personalDutyRosterFilterSettings); @@ -141,6 +148,8 @@ public function showAction(): void /** @var FrontendUser $user */ $user = $this->frontendUserRepository->findByUid($this->frontendUserService->getCurrentUserUid()); + $personalDutyRosterFilterSettings->setOnlyScheduledEvents($user->getOnlyScheduledEvents()); + $canViewMembers = false; $allowGroup = $this->settings['canViewMembers']; foreach ($user->getUserGroup() as $ug) { @@ -180,7 +189,7 @@ public function showAction(): void /** * The view contains a iCal list. * - * @param Integer $id + * @param int $id * @return void */ public function downloadAllVisibleCalendarEntriesAction(int $id): void @@ -192,7 +201,7 @@ public function downloadAllVisibleCalendarEntriesAction(int $id): void /** * The view contains a iCal list. * - * @param Integer $id + * @param int $id * @return void */ public function downloadAllPromisedVisibleCalendarEntriesAction(int $id): void @@ -214,7 +223,7 @@ public function downloadAllPromisedVisibleCalendarEntriesAction(int $id): void /** * The view contains a iCal list. * - * @param Integer $id + * @param int $id * @return void */ public function downloadAllPromisedCalendarEntriesAction(int $id): void @@ -243,7 +252,7 @@ public function setPresentAction(Commitment $commitment): string $eventUid = $commitment->getEvent()->getUid(); $return['$eventUid'] = $eventUid; $return['present'] = $commitment->getPresent(); - if (! $commitment->_isNew() && $commitment->_isDirty('present')) { + if (!$commitment->_isNew() && $commitment->_isDirty('present')) { $settings = $this->getPreparedSettings(intval($this->request->getArgument('id'))); $this->commitmentRepository->update($commitment); $this->persistenceManager->persistAll(); @@ -284,8 +293,9 @@ public function getMembersAction(Commitment $commitment): string $eventUid = $commitment->getEvent()->getUid(); $settings = $this->request->hasArgument('id') ? $this->getPreparedSettings(intval($this->request->getArgument('id'))) : $this->getPreparedSettings(); $return['event_uid'] = $eventUid; - $return['members'] = $this->commitmentRepository->getEventMembers($settings[PersonalDutyRosterController::PLANNING_STORAGE_UID], $eventUid); - $return['dropouts'] = $this->commitmentRepository->getEventCancels($settings[PersonalDutyRosterController::PLANNING_STORAGE_UID], $eventUid); + $return['members'] = $this->commitmentRepository->getEventCommitments(PresentState::PRESENT, $settings[PersonalDutyRosterController::PLANNING_STORAGE_UID], $eventUid, null); + $return['dropouts'] = $this->commitmentRepository->getEventCommitments(PresentState::NOT_PRESENT, $settings[PersonalDutyRosterController::PLANNING_STORAGE_UID], $eventUid); + $return['undecideds'] = $this->commitmentRepository->getEventCommitments(PresentState::UNKNOWN, $settings[PersonalDutyRosterController::PLANNING_STORAGE_UID], $eventUid); return json_encode($return); } else { $return['members'] = []; @@ -319,17 +329,13 @@ private function getPreparedSettings(int $id = null): array { $piFlexform = null; if ($id == null) { - if (isset($this->configurationManager->getContentObject()->data['list_type']) && $this->configurationManager->getContentObject()->data['list_type'] == PersonalDutyRosterController::LIST_TYPE) { - $piFlexform = $this->configurationManager->getContentObject()->data['pi_flexform']; - } else { - throw new \Exception("The content object is not correct plugin (controller)."); - } + return $this->prepareSettings($this->settings); } else { $qb = $this->getQueryBuilder('tt_content'); $s = $qb->select('list_type', 'pi_flexform') ->from('tt_content') ->where($qb->expr() - ->eq('uid', $qb->createNamedParameter($id))) + ->eq('uid', $qb->createNamedParameter($id))) ->execute(); // debug($qb->getSql()); if ($row = $s->fetch()) { @@ -394,11 +400,11 @@ private function getPersonalDutyRosterFilterSettings(array $personalDutyRosterGr * @var PersonalDutyRosterGroupFilterSettings $personalDutyRosterFilterSettings */ $personalDutyRosterFilterSettings = $this->objectManager->get(PersonalDutyRosterGroupFilterSettings::class); - if (! $ignoreCurrentUserSettings) { + if (!$ignoreCurrentUserSettings) { foreach ($optionalHiddenPersonalDutyRosterGroups as $optionalGroups) { if (in_array($optionalGroups, $personalDutyRosterGroups)) { $ug = $this->frontendUserGroupRepository->findByUid($optionalGroups); - $personalDutyRosterFilterSettings->add($ug, ! array_key_exists($ug->getUid(), $userHiddenDutyRosterGroups)); + $personalDutyRosterFilterSettings->add($ug, !array_key_exists($ug->getUid(), $userHiddenDutyRosterGroups)); } } } @@ -426,7 +432,7 @@ private function getCurrentUserCommitments(int $id, bool $ignoreCurrentUserSetti $planningStorageUid = $this->settings[PersonalDutyRosterController::PLANNING_STORAGE_UID]; $dutyRosterStorageUids = $this->settings[PersonalDutyRosterController::DUTY_ROSTER_STORAGE_UIDS]; - list ($personalDutyRosterGroups, $personalDutyRosterFilterSettings) = $this->getPersonalDutyRosterFilterSettings($personalDutyRosterGroups, $optionalHiddenPersonalDutyRosterGroups, $ignoreCurrentUserSettings); + list($personalDutyRosterGroups, $personalDutyRosterFilterSettings) = $this->getPersonalDutyRosterFilterSettings($personalDutyRosterGroups, $optionalHiddenPersonalDutyRosterGroups, $ignoreCurrentUserSettings); // debug($hiddenTargetGroups); // debug($this->getTargetGroups($settings)); @@ -454,6 +460,5 @@ private function getQueryBuilder(string $table): QueryBuilder private function toIntArray(string $value): array { return GeneralUtility::intExplode(',', $value); - ; } -} +} \ No newline at end of file diff --git a/Classes/Domain/Model/Commitment.php b/Classes/Domain/Model/Commitment.php index 529ac15..22f0dab 100755 --- a/Classes/Domain/Model/Commitment.php +++ b/Classes/Domain/Model/Commitment.php @@ -1,176 +1,151 @@ - */ -class Commitment extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity -{ - - /** - * present - * - * @var bool - */ - protected $present = false; - - /** - * presentDefault - * - * @var bool - */ +* This file is part of the 'Participants' Extension for TYPO3 CMS. +* +* For the full copyright and license information, please read the +* LICENSE.txt file that was distributed with this source code. +* +* ( c ) 2022 C. Gogolin +*/ + +class Commitment extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { + + /** + * @var int + */ + protected $present = PresentState::UNKNOWN; + + /** + * @var bool + */ protected $presentDefault = false; /** - * Event - * - * @var Event - */ + * Event + * + * @var Event + */ protected $event = null; /** - * user - * - * @var FrontendUser - */ + * @var FrontendUser + */ protected $user = null; /** - * __construct - */ - public function __construct() - { + * __construct + */ + + public function __construct() { // Do not remove the next line: It would break the functionality $this->initStorageObjects(); } /** - * Initializes all ObjectStorage properties - * Do not modify this method! - * It will be rewritten on each save in the extension builder - * You may modify the constructor of this class instead - * - * @return void - */ - protected function initStorageObjects() - {} + * Initializes all ObjectStorage properties + * Do not modify this method! + * It will be rewritten on each save in the extension builder + * You may modify the constructor of this class instead + * + * @return void + */ + protected function initStorageObjects() { + } /** - * Returns the user - * - * @return FrontendUser $user - */ - public function getUser() - { + * @return FrontendUser $user + */ + + public function getUser() { return $this->user; } /** - * Sets the user - * - * @param FrontendUser $user - * @return void - */ - public function setUser(FrontendUser $user) - { + * @param FrontendUser $user + * @return void + */ + + public function setUser( FrontendUser $user ) { $this->user = $user; } /** - * Returns the present - * - * @return bool $present - */ - public function getPresent() - { + * @return bool $present + */ + + public function getPresent() { return $this->present; } /** - * Sets the present - * - * @param bool $present - * @return void - */ - public function setPresent($present) - { + * @param bool $present + * @return void + */ + + public function setPresent( $present ) { $this->present = $present; } /** - * Returns the boolean state of present - * - * @return bool - */ - public function isPresent() - { + * @return bool + */ + + public function isPresent() { return $this->present; } /** - * Returns the presentDefault - * - * @return bool $presentDefault - */ - public function getPresentDefault() - { + * @return bool $presentDefault + */ + + public function getPresentDefault() { return $this->presentDefault; } /** - * Sets the presentDefault - * - * @param bool $presentDefault - * @return void - */ - public function setPresentDefault($presentDefault) - { + * @param bool $presentDefault + * @return void + */ + + public function setPresentDefault( $presentDefault ) { $this->presentDefault = $presentDefault; } /** - * Returns the boolean state of presentDefault - * - * @return bool - */ - public function isPresentDefault() - { + * @return bool + */ + + public function isPresentDefault() { return $this->presentDefault; } /** - * - * @return Event - * - */ - public function getEvent(): Event - { + * @return Event + */ + + public function getEvent(): Event { return $this->event; } /** - * - * @param Event $event - * @return void - */ - public function setEvent($event): void - { + * @param Event $event + * @return void + */ + + public function setEvent( $event ): void { $this->event = $event; } /** - * - * @return bool - */ - public function getIsNotChangable(): bool - { - return $this->getEvent() - ->getDateTime() - ->getTimestamp() < time(); + * @return bool + */ + + public function getIsNotChangable(): bool { + return $this->getEvent() + ->getDateTime() + ->getTimestamp() < time(); } -} +} \ No newline at end of file diff --git a/Classes/Domain/Model/FrontendUser.php b/Classes/Domain/Model/FrontendUser.php index 8e0f4e6..7aa8989 100644 --- a/Classes/Domain/Model/FrontendUser.php +++ b/Classes/Domain/Model/FrontendUser.php @@ -80,6 +80,9 @@ class FrontendUser extends AbstractEntity */ protected $hiddenPersonalDutyRosterGroups = null; + /** @var bool */ + protected $onlyScheduledEvents = false; + /** @var boolean */ protected $applyPlanningData = true; @@ -416,7 +419,7 @@ public function setHiddenPersonalDutyRosterGroups(ObjectStorage $hiddenPersonalD * * @return boolean */ - public function getApplyPlanningData(): bool + public function getApplyPlanningData(): ?bool { return $this->applyPlanningData; } @@ -425,7 +428,7 @@ public function getApplyPlanningData(): bool * * @param boolean $b */ - public function setApplyPlanningData(bool $b): void + public function setApplyPlanningData(?bool $b): void { $this->applyPlanningData = $b; } @@ -467,4 +470,22 @@ private function getSubUserGroups(FrontendUserGroup $frontendUserGroup, array &$ } return $return; } + + /** + * + * @return bool + */ + public function getOnlyScheduledEvents():bool { + return $this->onlyScheduledEvents; + } + + /** + * + * @param bool $onlyScheduledEvents + * @return self + */ + public function setOnlyScheduledEvents($onlyScheduledEvents): self { + $this->onlyScheduledEvents = $onlyScheduledEvents; + return $this; + } } diff --git a/Classes/Domain/Model/PersonalDutyRosterGroupFilterSettings.php b/Classes/Domain/Model/PersonalDutyRosterGroupFilterSettings.php index 6fd1fd9..b4c6304 100755 --- a/Classes/Domain/Model/PersonalDutyRosterGroupFilterSettings.php +++ b/Classes/Domain/Model/PersonalDutyRosterGroupFilterSettings.php @@ -13,7 +13,7 @@ * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * - * (c) 2022 C. Gogolin + * (c) 2023 C. Gogolin */ class PersonalDutyRosterGroupFilterSettings { @@ -32,7 +32,11 @@ public function __set(string $name , $value): void{ } } + + /** @var bool */ + protected $onlyScheduledEvents = false; + /** @var array */ private $settings = []; /** @@ -82,4 +86,24 @@ public function usable(): bool { return ! empty($this->settings); } + + + + /** + * + * @return bool + */ + public function getOnlyScheduledEvents() { + return $this->onlyScheduledEvents; + } + + /** + * + * @param bool $onlyScheduledEvents + * @return self + */ + public function setOnlyScheduledEvents($onlyScheduledEvents): self { + $this->onlyScheduledEvents = $onlyScheduledEvents; + return $this; + } } diff --git a/Classes/Domain/PresentState.php b/Classes/Domain/PresentState.php new file mode 100644 index 0000000..caaf002 --- /dev/null +++ b/Classes/Domain/PresentState.php @@ -0,0 +1,22 @@ + + */ +abstract class PresentState +{ + + + const UNKNOWN = -1; + + const PRESENT = 1; + + const NOT_PRESENT = 0; +} + \ No newline at end of file diff --git a/Classes/Domain/Repository/CommitmentRepository.php b/Classes/Domain/Repository/CommitmentRepository.php index b8e3c04..1961542 100755 --- a/Classes/Domain/Repository/CommitmentRepository.php +++ b/Classes/Domain/Repository/CommitmentRepository.php @@ -1,6 +1,7 @@ select('tx_participants_domain_model_commitment.uid', 'tx_participants_domain_model_event.date', 'tx_participants_domain_model_event.time') ->from('tx_participants_domain_model_commitment') ->join('tx_participants_domain_model_commitment', 'tx_participants_domain_model_event', 'tx_participants_domain_model_event', $qb->expr() - ->andX($qb->expr() - ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() - ->in('tx_participants_domain_model_event.pid', $dutyRosterStrorageUids))) - ->where($qb->expr() - ->andX($qb->expr() - ->gte('tx_participants_domain_model_event.date', $qb->createNamedParameter($startMoment->format('Y-m-d'))), $qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($user->getUid())), $qb->expr() - ->eq('tx_participants_domain_model_commitment.pid', $planningStorageUid))) + ->andX($qb->expr() + ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() + ->in('tx_participants_domain_model_event.pid', $dutyRosterStrorageUids))) + ->where( + $qb->expr() + ->andX( + $qb->expr()->gte('tx_participants_domain_model_event.date', $qb->createNamedParameter($startMoment->format('Y-m-d'))), + $qb->expr()->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($user->getUid())), + $qb->expr()->eq('tx_participants_domain_model_commitment.pid', $planningStorageUid) + ) + ) ->orderby('tx_participants_domain_model_event.date', 'ASC') ->addOrderby('tx_participants_domain_model_event.time', 'ASC') ->groupBy('tx_participants_domain_model_commitment.uid'); - if (! $withCanceledEvents) { + if (!$withCanceledEvents) { $qb->andWhere($qb->expr() ->eq('tx_participants_domain_model_event.canceled', 0)); } - + if ($personalDutyRosterFilterSettings->getOnlyScheduledEvents()) { + $qb->andWhere($qb->expr() + ->eq('tx_participants_domain_model_commitment.present_default', 1)); + } $s = $qb->execute(); // debug($qb->getSQL()); $return = array(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { // minute-by-minute calculation // /** @var \DateTime $eventStart */ // if(empty($row['time'])){ @@ -105,18 +112,23 @@ public function findCurrentEventCommitments(FrontendUser $user, array $dutyRoste * @var Commitment $c */ $c = $this->findByUid($row['uid']); - $g = array_unique(array_merge(array_map($getUid, $c->getEvent() - ->getUsergroups() - ->toArray()), array_map($getUid, $c->getEvent() - ->getEventType() - ->getUsergroups() - ->toArray()))); + $g = array_unique( + array_merge( + array_map($getUid, $c->getEvent() + ->getUsergroups() + ->toArray()), + array_map($getUid, $c->getEvent() + ->getEventType() + ->getUsergroups() + ->toArray()) + ) + ); $canDisplayBecause = array_intersect($g, $personalDutyRosterGroups); $f = false; foreach ($canDisplayBecause as $uid) { $existsOpt = $personalDutyRosterFilterSettings->exists($uid); - if (! $existsOpt || ($existsOpt && $personalDutyRosterFilterSettings->get($uid)->getVisible())) { + if (!$existsOpt || ($existsOpt && $personalDutyRosterFilterSettings->get($uid)->getVisible())) { $f = true; break; } @@ -146,21 +158,21 @@ public function findMissingCommitmentsOf(int $userUid, int $commitmentStorageUid $qb->select('tx_participants_domain_model_event.uid', 'tx_participants_domain_model_commitment.pid') ->from('tx_participants_domain_model_event') ->leftJoin('tx_participants_domain_model_event', 'tx_participants_domain_model_commitment', 'tx_participants_domain_model_commitment', $qb->expr() - ->andx($qb->expr() - ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($userUid)), $qb->expr() - ->eq('tx_participants_domain_model_commitment.pid', $qb->createNamedParameter($commitmentStorageUid)))) + ->andx($qb->expr() + ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() + ->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($userUid)), $qb->expr() + ->eq('tx_participants_domain_model_commitment.pid', $qb->createNamedParameter($commitmentStorageUid)))) ->where($qb->expr() - ->isNull('tx_participants_domain_model_commitment.uid')) + ->isNull('tx_participants_domain_model_commitment.uid')) ->andWhere($qb->expr() - ->in('tx_participants_domain_model_event.pid', $eventStorageUids)) + ->in('tx_participants_domain_model_event.pid', $eventStorageUids)) ->andWhere($qb->expr() - ->gt('tx_participants_domain_model_event.date', $yesterday->format('y-m-d'))); + ->gt('tx_participants_domain_model_event.date', $yesterday->format('y-m-d'))); // debug($qb->getSQL()); $s = $qb->execute(); $return = array(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { $return[] = $row['uid']; } return $return; @@ -187,20 +199,20 @@ public function findExistsFutureCommitments(int $userUid, int $commitmentStorage $qb->select('tx_participants_domain_model_commitment.uid AS cuid', 'tx_participants_domain_model_event.uid AS euid') ->from('tx_participants_domain_model_event') ->join('tx_participants_domain_model_event', 'tx_participants_domain_model_commitment', 'tx_participants_domain_model_commitment', $qb->expr() - ->andx($qb->expr() - ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($userUid)))) + ->andx($qb->expr() + ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() + ->eq('tx_participants_domain_model_commitment.user', $qb->createNamedParameter($userUid)))) ->where($qb->expr() - ->in('tx_participants_domain_model_event.pid', $eventStorageUids)) + ->in('tx_participants_domain_model_event.pid', $eventStorageUids)) ->andWhere($qb->expr() - ->gt('tx_participants_domain_model_event.date', $yesterday->format('y-m-d'))) + ->gt('tx_participants_domain_model_event.date', $yesterday->format('y-m-d'))) ->andWhere($qb->expr() - ->eq('tx_participants_domain_model_commitment.pid', $commitmentStorageUid)); + ->eq('tx_participants_domain_model_commitment.pid', $commitmentStorageUid)); // debug($qb->getSql()); $s = $qb->execute(); $return = array(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { $return[] = [ 'commitment' => $row['cuid'], 'event' => $row['euid'] @@ -229,10 +241,10 @@ public function getEventCommitmentCounts(int $planningStorageUid, int $eventUid ->addSelectLiteral('sum( if(present_default = true,1,0)) AS present_default_count') ->addSelectLiteral('sum(if(present = true, 1,0)) AS present_count ') ->join('tx_participants_domain_model_commitment', 'fe_users', 'fe_users', $qb->expr() - ->andX($qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->quoteIdentifier('fe_users.uid')), $qb->expr() - ->neq('fe_users.disable', $qb->createNamedParameter(1)), $qb->expr() - ->neq('fe_users.deleted', $qb->createNamedParameter(1)))) + ->andX($qb->expr() + ->eq('tx_participants_domain_model_commitment.user', $qb->quoteIdentifier('fe_users.uid')), $qb->expr() + ->neq('fe_users.disable', $qb->createNamedParameter(1)), $qb->expr() + ->neq('fe_users.deleted', $qb->createNamedParameter(1)))) ->from('tx_participants_domain_model_commitment') ->where($planningStorageUidTerm, $eventTerm) ->groupBy('tx_participants_domain_model_commitment.event'); @@ -240,7 +252,7 @@ public function getEventCommitmentCounts(int $planningStorageUid, int $eventUid $s = $qb->execute(); $counts = array(); // $counts['sql'] = $qb->getSql(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { $counts[intval($row['event'])] = Utility::calculatePresentDatas($row['present_count'], $row['present_default_count']); } @@ -248,91 +260,49 @@ public function getEventCommitmentCounts(int $planningStorageUid, int $eventUid return $eventUid == null ? $counts : $counts[$eventUid]; } + /** * - * @param string $storageUids + * @param array $storageUids * @param int $eventUid * @return array */ - public function getEventCancels(string $storageUids, int $eventUid = null): array + public function getEventCommitments(int $presentState, int $pidList, int $eventUid = null, ?bool $userIsScheduled = true): array { $qb = $this->getQueryBuilder('tx_participants_domain_model_commitment'); + $pagesTerm = ''; - if ($storageUids != null) { - $pidList = GeneralUtility::intExplode(',', $storageUids, TRUE); + if ($pidList != null) { $pagesTerm = $qb->expr()->in('tx_participants_domain_model_commitment.pid', $pidList); } $eventTerm = $eventUid == null ? '' : $qb->expr()->eq('tx_participants_domain_model_commitment.event', $eventUid); + $undecided = $qb->expr()->eq('tx_participants_domain_model_commitment.present', $qb->createNamedParameter($presentState)); - $notPresent = $qb->expr()->eq('tx_participants_domain_model_commitment.present', $qb->createNamedParameter(0)); - $isScheduled = $qb->expr()->eq('tx_participants_domain_model_commitment.present_default', $qb->createNamedParameter(1)); // debug($pagesTerm); $qb->select('tx_participants_domain_model_commitment.event', 'fe_users.uid', 'fe_users.first_name', 'fe_users.last_name', 'fe_users.currently_off_duty') ->join('tx_participants_domain_model_commitment', 'fe_users', 'fe_users', $qb->expr() - ->andX($qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->quoteIdentifier('fe_users.uid')), $qb->expr() - ->neq('fe_users.disable', $qb->createNamedParameter(1)), $qb->expr() - ->neq('fe_users.deleted', $qb->createNamedParameter(1)))) + ->andX($qb->expr() + ->eq('tx_participants_domain_model_commitment.user', $qb->quoteIdentifier('fe_users.uid')), $qb->expr() + ->neq('fe_users.disable', $qb->createNamedParameter(1)), $qb->expr() + ->neq('fe_users.deleted', $qb->createNamedParameter(1)))) ->from('tx_participants_domain_model_commitment') - ->where($pagesTerm, $eventTerm, $isScheduled, $notPresent) + ->where($pagesTerm, $eventTerm, $undecided) ->addOrderBy('fe_users.last_name', 'ASC') ->addOrderBy('fe_users.first_name', 'ASC'); - // ->orderBy('last_name','first_name'); - $users = array(); - // $sql = $qb->getSql(); - $s = $qb->execute(); - while ($row = $s->fetch()) { - $users[$row['uid']] = [ - 'last_name' => $row['last_name'], - 'first_name' => $row['first_name'], - 'currently_off_duty' => $row['currently_off_duty'] - ]; + if($userIsScheduled != null) { + $qb->andWhere($qb->expr()->eq('tx_participants_domain_model_commitment.present_default', $qb->createNamedParameter($userIsScheduled))); } - // $return['sql'] = $sql; - // debug(json_encode($counts)); - return $users; - } - - /** - * - * @param int $planningStorageUid - * @param int $eventUid - * @return array - */ - public function getEventMembers(int $planningStorageUid, int $eventUid = null): array - { - $qb = $this->getQueryBuilder('tx_participants_domain_model_commitment'); - $planningStorageUidTerm = $qb->expr()->eq('tx_participants_domain_model_commitment.pid', $planningStorageUid); - $eventTerm = $eventUid == null ? '' : $qb->expr()->eq('tx_participants_domain_model_commitment.event', $eventUid); - - $memberTerm = $qb->expr()->eq('tx_participants_domain_model_commitment.present', $qb->createNamedParameter(1)); - - // debug($pagesTerm); - $qb->select('tx_participants_domain_model_commitment.event', 'fe_users.uid', 'fe_users.first_name', 'fe_users.last_name', 'fe_users.currently_off_duty') - ->join('tx_participants_domain_model_commitment', 'fe_users', 'fe_users', $qb->expr() - ->andX($qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $qb->quoteIdentifier('fe_users.uid')), $qb->expr() - ->neq('fe_users.disable', $qb->createNamedParameter(1)), $qb->expr() - ->neq('fe_users.deleted', $qb->createNamedParameter(1)))) - ->from('tx_participants_domain_model_commitment') - ->where($planningStorageUidTerm, $eventTerm, $memberTerm) - ->addOrderBy('fe_users.last_name', 'ASC') - ->addOrderBy('fe_users.first_name', 'ASC'); - // ->orderBy('last_name','first_name'); - - // $sql = $qb->getSql(); $users = array(); + // $sql = $qb->getSql(); $s = $qb->execute(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { $users[$row['uid']] = [ 'last_name' => $row['last_name'], 'first_name' => $row['first_name'], 'currently_off_duty' => $row['currently_off_duty'] ]; } - // debug($sql); - - // $return['sql'] = $sql; + // $users['sql'] = $sql; // debug(json_encode($counts)); return $users; } @@ -351,23 +321,34 @@ public function dropout(int $userId, \DateTime $from, \DateTime $until): void $qb->select('tx_participants_domain_model_commitment.uid') ->from('tx_participants_domain_model_commitment') ->join('tx_participants_domain_model_commitment', 'tx_participants_domain_model_event', 'tx_participants_domain_model_event', $qb->expr() - ->andX($qb->expr() - ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), $qb->expr() - ->gte('tx_participants_domain_model_event.date', $qb->createNamedParameter($from->format('Y-m-d'))), $qb->expr() - ->lte('tx_participants_domain_model_event.date', $qb->createNamedParameter($until->format('Y-m-d'))))) - ->where($qb->expr() - ->eq('tx_participants_domain_model_commitment.user', $userId)); + ->andX( + $qb->expr() + ->eq('tx_participants_domain_model_commitment.event', $qb->quoteIdentifier('tx_participants_domain_model_event.uid')), + $qb->expr() + ->gte('tx_participants_domain_model_event.date', $qb->createNamedParameter($from->format('Y-m-d'))), + $qb->expr() + ->lte('tx_participants_domain_model_event.date', $qb->createNamedParameter($until->format('Y-m-d'))) + ) + ) + ->where( + $qb->expr() + ->eq('tx_participants_domain_model_commitment.user', $userId) + ) + ->andWhere( + $qb->expr() + ->eq('tx_participants_domain_model_commitment.present', PresentState::PRESENT) + ); // debug($sql = $qb->getSql()); $s = $qb->execute(); - while ($row = $s->fetch()) { + while ($row = $s->fetchAssociative()) { // debug($row); $u = $qb->update('tx_participants_domain_model_commitment') - ->set('present', 0) + ->set('present', PresentState::NOT_PRESENT) ->where($qb->expr() - ->eq('tx_participants_domain_model_commitment.uid', $row['uid'])); + ->eq('tx_participants_domain_model_commitment.uid', $row['uid'])); // debug($u->getSQL()); $u->execute(); } } -} +} \ No newline at end of file diff --git a/Classes/Task/PersonalDutyRosterPlanningTask.php b/Classes/Task/PersonalDutyRosterPlanningTask.php index 23d89db..21702f8 100644 --- a/Classes/Task/PersonalDutyRosterPlanningTask.php +++ b/Classes/Task/PersonalDutyRosterPlanningTask.php @@ -1,6 +1,7 @@ getUid(), $this->eventGroupAssociation)) { - - $this->eventGroupAssociation[$event->getUid()] = array_merge( // - array_map('\Cylancer\Participants\Service\FrontendUserService::getUid', $event->getUsergroups()->toArray()), // - array_map('\Cylancer\Participants\Service\FrontendUserService::getUid', $event->getEventType() - ->getUsergroups() - ->toArray())); + if (!array_key_exists($event->getUid(), $this->eventGroupAssociation)) { + + $this->eventGroupAssociation[$event->getUid()] = array_merge( + // + array_map('\Cylancer\Participants\Service\FrontendUserService::getUid', $event->getUsergroups()->toArray()), + // + array_map('\Cylancer\Participants\Service\FrontendUserService::getUid', $event->getEventType() + ->getUsergroups() + ->toArray()) + ); } + // debug($this->eventGroupAssociation); + // debug($this->frontendUserGroupStructure); /** * 1. iterate over all user groups * 2. get the path of the user group to the root (over the subgroups) * 3. has the event groups and the user group path an intersect: return true... */ foreach ($user->getUsergroup() as $ug) { - if (! empty(array_intersect($this->frontendUserGroupStructure[$ug->getUid()], $this->eventGroupAssociation[$event->getUid()]))) { + if (!empty(array_intersect($this->frontendUserGroupStructure[$ug->getUid()], $this->eventGroupAssociation[$event->getUid()]))) { return true; } } @@ -238,7 +244,7 @@ private function eventReminder(): void /** @var Event $event **/ foreach ($this->eventRepository->findTomorrowsEvents() as $event) { /** @var FrontendUser $frontendUser **/ - foreach ($this->commitmentRepository->getEventMembers($this->planningStorageUid, $event->getUid()) as $frontendUserUid => $data) { + foreach ($this->commitmentRepository->getEventCommitments(PresentState::PRESENT, $this->planningStorageUid, $event->getUid()) as $frontendUserUid => $data) { $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid); // debug($frontendUser, 'eventReminder()'); @@ -293,7 +299,7 @@ public function execute() /** @var Event $e */ foreach ($users as $u) { - $userCount ++; + $userCount++; // $pages = $this->getPages(); $inserts = array(); $updates = array(); @@ -301,7 +307,7 @@ public function execute() // update foreach ($this->commitmentRepository->findExistsFutureCommitments($u->getUid(), $this->planningStorageUid, $this->dutyRosterStorageUids) as $uids) { - $loadedData ++; + $loadedData++; // debug($uids); $createdCount = 0; /** @@ -313,28 +319,32 @@ public function execute() if ($e != null && $e->getDatetime() > $now) { - $d = $u->getCurrentlyOffDuty() ? false : $this->calculatePlanningPresent($u, $e); + $planningPresent = $u->getCurrentlyOffDuty() ? false : $this->calculatePlanningPresent($u, $e); + // debug($ds); if ($e->getHidden() || $e->getDeleted()) { - if ($c->getPresent()) { + if ($c->getPresent() !== PresentState::NOT_PRESENT) { $canceled[] = $c; } - $canceledCount ++; + $canceledCount++; $c->setEvent($e); // <-- for the template - $c->setPresent(false); + $c->setPresent(PresentState::NOT_PRESENT); $c->setPresentDefault(false); if (PersonalDutyRosterPlanningTask::DISABLE_PERSISTENCE_MANAGER) { debug($c, "CANCELED:"); } $this->commitmentRepository->update($c); - } else if ($this->resetUser || $c->getPresentDefault() != $d) { - $updatedCount ++; - if ($c->getPresent() xor $d) { + } else if ($this->resetUser || $c->getPresentDefault() != $planningPresent) { + $updatedCount++; + if (($c->getPresent() === PresentState::UNKNOWN) || (($c->getPresent() === PresentState::PRESENT) xor $planningPresent)) { $updates[] = $c; } - $c->setPresentDefault($d); - $c->setPresent($u->getApplyPlanningData() ? $d : false); - + $c->setPresentDefault($planningPresent); + $c->setPresent( + ($u->getApplyPlanningData() && $planningPresent) + ? PresentState::PRESENT + : $c->getPresent() + ); if (PersonalDutyRosterPlanningTask::DISABLE_PERSISTENCE_MANAGER) { debug($c, "UPDATE:"); } @@ -347,7 +357,7 @@ public function execute() foreach ($this->commitmentRepository->findMissingCommitmentsOf($u->getUid(), $this->planningStorageUid, $this->dutyRosterStorageUids) as $eventUid) { $e = $this->eventRepository->findByUid($eventUid); if ($e != null) { - $createdCount ++; + $createdCount++; /** * * @var Commitment $c @@ -357,10 +367,14 @@ public function execute() $c->setEvent($e); $c->setUser($u); - $d = $u->getCurrentlyOffDuty() ? false : $this->calculatePlanningPresent($u, $e); + $planningPresent = $u->getCurrentlyOffDuty() ? false : $this->calculatePlanningPresent($u, $e); - $c->setPresent($u->getApplyPlanningData() ? $d : false); - $c->setPresentDefault($d); + $c->setPresent( + ($u->getApplyPlanningData() && $planningPresent) + ? PresentState::PRESENT + : PresentState::UNKNOWN + ); + $c->setPresentDefault($planningPresent); $c->setPid($this->planningStorageUid); if (PersonalDutyRosterPlanningTask::DISABLE_PERSISTENCE_MANAGER) { debug($c, "CREATE"); @@ -378,7 +392,7 @@ public function execute() } } - if (! PersonalDutyRosterPlanningTask::DISABLE_PERSISTENCE_MANAGER) { + if (!PersonalDutyRosterPlanningTask::DISABLE_PERSISTENCE_MANAGER) { $this->persistenceManager->persistAll(); } @@ -392,10 +406,10 @@ public function execute() private function sendInfoMail(FrontendUser $user, array $inserts, array $updates, array $canceled) { - // debug($inserts, 'I'); - // debug($updates, 'U'); - // debug($canceled, 'C'); - if (filter_var($user->getEmail(), FILTER_VALIDATE_EMAIL) && (! empty($inserts) || ! empty($updates) || ! empty($canceled))) { + // debug($inserts, 'I'); + // debug($updates, 'U'); + // debug($canceled, 'C'); + if (filter_var($user->getEmail(), FILTER_VALIDATE_EMAIL) && (!empty($inserts) || !empty($updates) || !empty($canceled))) { $recipient = [ $user->getEmail() => $user->getFirstName() . ' ' . $user->getLastName() ]; @@ -407,13 +421,13 @@ private function sendInfoMail(FrontendUser $user, array $inserts, array $updates $data = [ 'user' => $user ]; - if (! empty($inserts)) { + if (!empty($inserts)) { $data['inserts'] = $inserts; } - if (! empty($updates)) { + if (!empty($updates)) { $data['updates'] = $updates; } - if (! empty($canceled)) { + if (!empty($canceled)) { $data['canceled'] = $canceled; } @@ -429,12 +443,12 @@ private function sendInfoMail(FrontendUser $user, array $inserts, array $updates public function getAdditionalInformation() { return 'Duty roster stroarge uids:' . $this->dutyRosterStorageUids . // - ' / planning storage uid: ' . $this->planningStorageUid . // - ' / frontend user storage uids: ' . $this->feUserStorageUids . // - ' / frontend user group storage uids: ' . $this->feUsergroupStorageUids . // - ' / specified user uids:' . $this->specifiedUserUids . // - ' / enable reminder:' . $this->enableReminder . // - ' / reminder target url:' . $this->reminderTargetUrl; + ' / planning storage uid: ' . $this->planningStorageUid . // + ' / frontend user storage uids: ' . $this->feUserStorageUids . // + ' / frontend user group storage uids: ' . $this->feUsergroupStorageUids . // + ' / specified user uids:' . $this->specifiedUserUids . // + ' / enable reminder:' . $this->enableReminder . // + ' / reminder target url:' . $this->reminderTargetUrl; } /** @@ -504,6 +518,4 @@ public function set(string $key, $value) throw new \Exception("Unknown key: $key"); } } -} - - +} \ No newline at end of file diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php index 9e0ecc2..62ef423 100755 --- a/Configuration/TCA/Overrides/fe_users.php +++ b/Configuration/TCA/Overrides/fe_users.php @@ -90,6 +90,21 @@ 'default' => 1, ] ], + 'show_only_scheduled_events' => [ + 'label' => 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_user.show_only_scheduled_events', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + ] + ], + 'readOnly' => true, + 'default' => 1, + ] + ], ]; @@ -113,7 +128,7 @@ $tmp_types = array_keys($GLOBALS['TCA']['fe_users']['types']); foreach($tmp_types as $type){ - $GLOBALS['TCA']['fe_users']['types'][$type]['showitem'] .= ', --div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_user.tab_settings, apply_planning_data, info_mail_when_personal_duty_roster_changed, personal_duty_event_reminder, hidden_personal_duty_roster_groups '; + $GLOBALS['TCA']['fe_users']['types'][$type]['showitem'] .= ', --div--;LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_user.tab_settings, apply_planning_data, info_mail_when_personal_duty_roster_changed, personal_duty_event_reminder, hidden_personal_duty_roster_groups, show_only_scheduled_events '; } diff --git a/Configuration/TCA/Overrides/tx_participants_domain_model_commitment.php b/Configuration/TCA/Overrides/tx_participants_domain_model_commitment.php index 00773ef..1419357 100755 --- a/Configuration/TCA/Overrides/tx_participants_domain_model_commitment.php +++ b/Configuration/TCA/Overrides/tx_participants_domain_model_commitment.php @@ -5,9 +5,3 @@ 'participants', 'tx_participants_domain_model_commitment' ); - - - -$GLOBALS['TCA']['tx_participants_domain_model_commitment']['columns']['present']['config']['readOnly'] = 1; -$GLOBALS['TCA']['tx_participants_domain_model_commitment']['columns']['user']['config']['readOnly'] = 1; -$GLOBALS['TCA']['tx_participants_domain_model_commitment']['columns']['event']['config']['readOnly'] = 1; diff --git a/Configuration/TCA/tx_participants_domain_model_commitment.php b/Configuration/TCA/tx_participants_domain_model_commitment.php index d3ca6d9..7db38e6 100755 --- a/Configuration/TCA/tx_participants_domain_model_commitment.php +++ b/Configuration/TCA/tx_participants_domain_model_commitment.php @@ -1,4 +1,5 @@ [ 'title' => 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment', @@ -11,6 +12,7 @@ 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource', 'enablecolumns' => [ + 'present' => 'present', ], 'searchFields' => '', 'iconfile' => 'EXT:participants/Resources/Public/Icons/tx_participants_domain_model_commitment.gif' @@ -19,7 +21,9 @@ 'showRecordFieldList' => ' l10n_parent, l10n_diffsource, present, present_default, event, user', ], 'types' => [ - '1' => ['showitem' => ' l10n_parent, l10n_diffsource, present, present_default, event, user'], + '1' => [ + 'showitem' => ' l10n_parent, l10n_diffsource, present, present_default, event, user' + ], ], 'columns' => [ 'sys_language_uid' => [ @@ -48,7 +52,7 @@ 'renderType' => 'selectSingle', 'default' => 0, 'items' => [ - ['', 0], + [ '', 0 ], ], 'foreign_table' => 'tx_participants_domain_model_commitment', 'foreign_table_where' => 'AND {#tx_participants_domain_model_commitment}.{#pid}=###CURRENT_PID### AND {#tx_participants_domain_model_commitment}.{#sys_language_uid} IN (-1,0)', @@ -70,33 +74,32 @@ 'present' => [ 'label' => 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.present', + 'config' => [ - 'type' => 'check', + 'type' => 'select', + 'renderType' => 'selectSingle', + 'readOnly' => false, 'items' => [ - '1' => [ - '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' - ] + [ 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.present.option.unknown', PresentState::UNKNOWN ], + [ 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.present.option.notPresent', PresentState::NOT_PRESENT ], + [ 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.present.option.present', PresentState::PRESENT ], ], - 'default' => 0, + 'default' => PresentState::UNKNOWN, ] ], 'present_default' => [ 'label' => 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.present_default', 'config' => [ 'type' => 'check', - 'readOnly' => true, - 'items' => [ - '1' => [ - '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' - ] - ], + 'readOnly' => false, + 'renderType' => 'checkboxToggle', 'default' => 0, ] ], 'event' => [ 'label' => 'LLL:EXT:participants/Resources/Private/Language/locallang_db.xlf:tx_participants_domain_model_commitment.event', 'config' => [ - 'readOnly' => true, + 'readOnly' => true, 'type' => 'select', 'dbType' => 'event', 'renderType' => 'selectSingle', @@ -115,6 +118,6 @@ 'maxitems' => 1, ], ], - + ], -]; +]; \ No newline at end of file diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 3b04c24..347701d 100755 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -37,6 +37,10 @@ Dropouts Absagen + + No feedback + Keine Rückmeldung + List of Members ... Liste der Teilnehmer*innen... @@ -58,14 +62,34 @@ Not scheduled. Nicht eingeplant + + Not yet set. + Noch nicht festgelegt. + + + ❓ + + I am involved Bin dabei + + ✓ + + I am absend Bin abwesend + + ∅ + + + + There are no event planning entries for which you can accept or cancel. + Es existieren keine Veranstaltungsplanungseinträge für die Sie zusagen oder absagen können. + 📅 🔎 @@ -91,11 +115,14 @@ Download all promised calendar entries. Alle zugestimmte Kalendereinträge herunterladen. + + Show only scheduled events + Zeige nur eingeplante Termine + Download calendar entries in CalDAV format: Kalendereinträge im CalDAV-Format herunterladen: - This download contains an ICS file. This file contains the calendar entries in CalDAV format. Many calendars can import this file format. Dieser Download enhält eine ICS-Datei. Diese Datei enhält die Kalendereinträge im CalDAV-Format. Viele Kalender können dieses Datei-Format importieren. diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 2e8c135..1845b36 100755 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -1,29 +1,36 @@ - +
- + - + Commitment Rückmeldung - + + Present + Anwesend + + + Unknown + Unbestimmt (Noch nicht festgelegt) + + + Not present + Nicht anwesend + + Present Anwesend - + Present Default Anwesend (geplant) - + User Benutzer @@ -31,37 +38,39 @@ User Benutzer - + - + Participants - Teilnehmer + Teilnehmer Participation (duty roster) - Teilnahme (Dienstplan) + Teilnahme (Dienstplan) Hidden personal duty roster groups Versteckte Nutzergruppen (im Individuellen Dienstplan) - + Apply the planning data in your own events list if an event is added. Wenn ein neuer Termin zum persönlichen Dienstplan hinzugefügt wird, wird automatisch die Plannungseinstellung für die persönliche Zusage übernommen. - + Sends an email if the own events is changed. Sendet eine Benachtigungs-E-Mail, wenn der persönliche Dienstplan verändert wurde. - + Reminder email when an event is coming up. Sendet eine Erinnerungsmail, wenn ein Event demnächst ansteht. + + Show only scheduled events + Zeige nur eingeplante Termine + @@ -85,15 +94,14 @@ Time out Auszeit - + Contains all entries from a user time offes. Enthält alle Nutzer_Auszeiten. - + - + Event type Veranstaltungsart @@ -113,7 +121,7 @@ - + Event Veranstaltung @@ -192,7 +200,7 @@ Beschreibung - + Acronym Akronym diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 5f98f84..56133bb 100755 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -29,6 +29,9 @@ Dropouts + + No feedback + List of Members ... @@ -45,12 +48,28 @@ Not scheduled. + + Not yet set. + + + ❓ + I am involved + + ✓ + I am absend + + ∅ + + + There are no event planning entries for which you can accept or cancel. + + 📅 🔎 @@ -69,6 +88,9 @@ Download all promised calendar entries. + + Show only scheduled appointments + Download calendar entries in CalDAV format: diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index e450796..e1bfec2 100755 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,36 +1,43 @@ - +
- + - + Commitment - + + Present + + + Unknown + Unbestimmt (Noch nicht festgelegt) + + + Not present + Nicht anwesend + + Present + Anwesend - + Present Default - + User User - + - - + + Participants @@ -40,17 +47,18 @@ Hidden personal duty roster groups - + Apply the planning data in your own events list if an event is added. - + Sends an email if the own event is changed. - + Reminder email when an event is coming up. + + Show only scheduled events + @@ -69,14 +77,13 @@ Time out - + Contains all entries from a user time offes. - + - + Event type @@ -92,7 +99,7 @@ - + Event @@ -153,7 +160,7 @@ - + Acronym diff --git a/Resources/Private/Partials/PersonalDutyRoster/DefaultICalendarEntries.html b/Resources/Private/Partials/PersonalDutyRoster/DefaultICalendarEntries.html index fd7fdd9..63648fe 100755 --- a/Resources/Private/Partials/PersonalDutyRoster/DefaultICalendarEntries.html +++ b/Resources/Private/Partials/PersonalDutyRoster/DefaultICalendarEntries.html @@ -27,7 +27,7 @@ CREATED:{commitment.event.crdate}T{commitment.event.crdate}Z DTSTAMP:{commitment.event.tstamp}T{commitment.event.tstamp}Z UID:dutyRoster-{commitment.event.uid}@{domain} -DTSTART;VALUE=DATETZID=Europe/Berlin:{commitment.event.date}{commitment.event.time} +DTSTART;VALUE=DATETZID=Europe/Berlin:{commitment.event.date}{commitment.event.time} DTEND;VALUE=DATETZID=Europe/Berlin: +1 day +{commitment.event.duration} hours SUMMARY:🚒 {commitment.event.eventType.title -> f:format.htmlspecialchars()} DESCRIPTION:{ug.title}, ( {commitment.event.description -> f:format.stripTags()} ) diff --git a/Resources/Private/Templates/PersonalDutyRoster/Show.html b/Resources/Private/Templates/PersonalDutyRoster/Show.html index f60057f..d329f89 100755 --- a/Resources/Private/Templates/PersonalDutyRoster/Show.html +++ b/Resources/Private/Templates/PersonalDutyRoster/Show.html @@ -1,60 +1,83 @@ - - + + + - + + - This Template is responsible for creating a table of domain objects. If you modify this template, do not forget to change the overwrite settings in - /Configuration/ExtensionBuilder/settings.yaml: Resources: Private: Templates: List.html: keep Otherwise your changes will be overwritten the next time you save + This Template is responsible for creating a table of domain objects. If you modify this template, do not forget to + change the overwrite settings in + /Configuration/ExtensionBuilder/settings.yaml: Resources: Private: Templates: List.html: keep Otherwise your changes + will be overwritten the next time you save the extension in the extension builder - - - - + + + +
-
-
-
-
- -
- +
+ +
+
+
+
-
-
-
- - - +
+
+
+
+ +
+
+
+ + +
- +
-
+
@@ -66,25 +89,28 @@
- + class="btn btn-outline-primary" pageType="104" + action="downloadAllVisibleCalendarEntries" arguments="{id:uid}"> +
- + class="btn btn-outline-primary" pageType="104" + action="downloadAllPromisedVisibleCalendarEntries" arguments="{id:uid}"> +
- + class="btn btn-outline-primary" pageType="104" + action="downloadAllPromisedCalendarEntries" arguments="{id:uid}"> +
@@ -98,51 +124,70 @@
- - + + + + + - {counts.{commitment.event.uid}.presentDefaultCount} - bg-success - {f:if(condition:'{presentDefaultCount} == 0', then:'bg-success', else: 'bg-primary')} - - tooLate - canceled - - success - primary - - - - tooLate - canceled - - primary - light - + {counts.{commitment.event.uid}.presentDefaultCount} + bg-success + {f:if(condition:'{presentDefaultCount} == 0', + then:'bg-success', else: 'bg-primary')} - + - + + + + + + + + + + +

+

+

-

+

+
+

-

- + +
+ + + + + + +
+
+ + +   + + + +   + + + +   + + + +
+
+
@@ -158,7 +203,8 @@
- {commitment.event.eventType.title} + {commitment.event.eventType.title}
@@ -171,7 +217,8 @@
    - +
  • {userGroup.title}
@@ -182,7 +229,8 @@
+ +
@@ -193,31 +241,37 @@
-
-
{counts.{commitment.event.uid}.displayPercent}%
-
-
: {counts.{commitment.event.uid}.presentCount} - ( {counts.{commitment.event.uid}.presentDefaultCount} ) - - @@ -229,7 +283,8 @@
-
+
Loading... @@ -239,23 +294,44 @@
+ +

+ +

+
+ + + + - + + \ No newline at end of file diff --git a/Resources/Public/Css/tx_participants_custom_style.css b/Resources/Public/Css/tx_participants_custom_style.css index 8d0bb82..7a8cfde 100755 --- a/Resources/Public/Css/tx_participants_custom_style.css +++ b/Resources/Public/Css/tx_participants_custom_style.css @@ -97,6 +97,10 @@ text-decoration: line-through; } +.tx_participants .presentDescription { + min-width: 13em; +} + .error { color: #d31f1f; } \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php index 8568023..0154f33 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'uploadfolder' => 0, 'createDirs' => '', 'clearCacheOnLoad' => 1, - 'version' => '3.5.1', + 'version' => '3.6.5', 'constraints' => [ 'depends' => [ 'typo3' => '11.5.0-11.5.99', @@ -26,10 +26,18 @@ ], ]; + /** * Change log: * -3.5.1 :: Fix : Fix the event sorting. + +3.6.5 :: Fix : Optimize the commitment description text output. +3.6.4 :: Fix : Correct the commitments calculation when the scheduling is changed. +3.6.3 :: Fix : The list of members also contains appointment commitments from persons who are not registered. +3.6.2 :: Update : Adds "only scheduled events" filter for personal duty roster. +3.6.1 :: Update : Displays the undecideds in the members list. +3.6.0 :: Update : Add a unknwon state in your personal duty roster. +3.5.1 :: Fix : Fix the event sorting. 3.5.0 :: Undo : Remove the trying of time as integer in the database. (don't use 3.4.* !) 3.4.1 :: Fix: Fix the timzone handling in the converter wizzard. 3.4.0 :: Add: Add an reasons for prevention service (interface for the lending extension connection). diff --git a/ext_tables.sql b/ext_tables.sql index ab60dc1..247d39a 100755 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -5,22 +5,16 @@ CREATE TABLE tx_participants_domain_model_commitment ( uid int(11) UNSIGNED NOT NULL AUTO_INCREMENT, pid int(11) DEFAULT '0' NOT NULL, record_type VARCHAR(255) DEFAULT '' NOT NULL, - - present SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, - present_default SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, + present SMALLINT (5) DEFAULT -1 NOT NULL, + present_default SMALLINT (5) UNSIGNED DEFAULT 0 NOT NULL, event int (11) UNSIGNED DEFAULT '0', user int (11) UNSIGNED DEFAULT '0' NOT NULL, - - PRIMARY KEY - ( - uid - ), - KEY parent ( pid), + PRIMARY KEY (uid), + KEY parent (pid), KEY t3ver_old (t3ver_oid, t3ver_wsid), - KEY language (l10n_parent, sys_language_uid ), + KEY language (l10n_parent, sys_language_uid), KEY event (event), KEY userEvent (user, event) - ); # @@ -33,6 +27,7 @@ CREATE TABLE fe_users ( apply_planning_data SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, info_mail_when_personal_duty_roster_changed SMALLINT (5) UNSIGNED DEFAULT '1' NOT NULL, personal_duty_event_reminder SMALLINT (5) UNSIGNED DEFAULT '1' NOT NULL, + show_only_scheduled_events SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, ); # @@ -43,11 +38,7 @@ CREATE TABLE tx_participants_user_category_mm ( uid_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY - ( - uid_local, - uid_foreign - ), + PRIMARY KEY (uid_local, uid_foreign), KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); @@ -60,16 +51,11 @@ CREATE TABLE tx_participants_user_hiddenpersonaldutyrostergroup_mm ( uid_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY - ( - uid_local, - uid_foreign - ), + PRIMARY KEY (uid_local, uid_foreign), KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); - # # Table structure for table 'tx_participants_domain_model_timeout' # @@ -77,14 +63,13 @@ CREATE TABLE tx_participants_domain_model_timeout ( uid int(11) UNSIGNED DEFAULT '0' NOT NULL auto_increment, pid int(11) DEFAULT '0' NOT NULL, record_type VARCHAR(255) DEFAULT '' NOT NULL, - user int (11) UNSIGNED DEFAULT '0' NOT NULL, - from DATE DEFAULT '0000-00-00' NOT NULL, - until DATE DEFAULT '0000-00-00' NOT NULL, - reason TINYTEXT, - - PRIMARY KEY (uid), - KEY parent (pid) + from + DATE DEFAULT '0000-00-00' NOT NULL, + until DATE DEFAULT '0000-00-00' NOT NULL, + reason TINYTEXT, + PRIMARY KEY (uid), + KEY parent (pid) ); # @@ -94,12 +79,10 @@ CREATE TABLE tx_participants_domain_model_eventtype ( uid int(11) UNSIGNED DEFAULT '0' NOT NULL auto_increment, pid int(11) DEFAULT '0' NOT NULL, record_type VARCHAR(255) DEFAULT '' NOT NULL, - title VARCHAR (255) DEFAULT '' NOT NULL, description TEXT DEFAULT '', usergroups SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, public SMALLINT (5) UNSIGNED DEFAULT '1' NOT NULL, - PRIMARY KEY (uid), KEY parent (pid) ); @@ -112,13 +95,7 @@ CREATE TABLE tx_participants_eventtype_usergroup_mm ( uid_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, - - PRIMARY KEY - ( - uid_local, - uid_foreign - ), - + PRIMARY KEY (uid_local, uid_foreign), KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); @@ -131,25 +108,19 @@ CREATE TABLE tx_participants_domain_model_event ( pid int(11) DEFAULT '0' NOT NULL, record_type VARCHAR(255) DEFAULT '' NOT NULL, title VARCHAR(1) DEFAULT '' NOT NULL, - canceled SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, - - description TEXT DEFAULT '', show_public_description SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, public_description TEXT DEFAULT '', event_type int (11) UNSIGNED DEFAULT '0' NOT NULL, usergroups SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, - show_public_usergroups SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, public_usergroups SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, - 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', + date date DEFAULT '2000-01-01' NOT NULL, + time time DEFAULT '19:00:00', duration SMALLINT (5) UNSIGNED DEFAULT '0' NOT NULL, - PRIMARY KEY (uid), KEY parent (pid) ); @@ -162,13 +133,7 @@ CREATE TABLE tx_participants_event_usergroup_mm ( uid_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, - - PRIMARY KEY - ( - uid_local, - uid_foreign - ), - + PRIMARY KEY (uid_local, uid_foreign), KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); @@ -181,13 +146,7 @@ CREATE TABLE tx_participants_event_publicusergroup_mm ( uid_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting int (11) UNSIGNED DEFAULT '0' NOT NULL, sorting_foreign int (11) UNSIGNED DEFAULT '0' NOT NULL, - - PRIMARY KEY - ( - uid_local, - uid_foreign - ), - + PRIMARY KEY (uid_local, uid_foreign), KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); @@ -195,7 +154,4 @@ CREATE TABLE tx_participants_event_publicusergroup_mm ( # # Table structure for table 'fe_groups' # -CREATE TABLE fe_groups ( - accronym VARCHAR (30) DEFAULT '', -); - +CREATE TABLE fe_groups (accronym VARCHAR (30) DEFAULT '',); \ No newline at end of file