diff --git a/api/v1/authorVersion/AuthorVersionHandler.php b/api/v1/authorVersion/AuthorVersionHandler.php index c3f5d30..50a2699 100644 --- a/api/v1/authorVersion/AuthorVersionHandler.php +++ b/api/v1/authorVersion/AuthorVersionHandler.php @@ -124,13 +124,18 @@ private function sendSubmittedVersionEmail($submission, $publication, $versionJu private function sendDeletedVersionEmail($submission, $publication, $deletingJustification) { + $authors = $publication->getData('authors'); + if ($authors->isEmpty()) { + return; + } + $request = $this->getRequest(); $context = $request->getContext(); - $emailTemplateKey = 'DELETED_VERSION_NOTIFICATION'; - $primaryAuthor = $publication->getPrimaryAuthor(); + $recipientAuthor = $publication->getPrimaryAuthor() ?? $authors->first(); + $recipients = [ - ['email' => $primaryAuthor->getData('email'), 'name' => $primaryAuthor->getFullName()] + ['email' => $recipientAuthor->getData('email'), 'name' => $recipientAuthor->getFullName()] ]; $params = ['deletingJustification' => $deletingJustification]; @@ -180,7 +185,7 @@ private function getManagersAssigned($publication): array while ($assignment = $allAssignments->next()) { $userId = $assignment->getUserId(); - if($this->userIsManager($userId)) { + if ($this->userIsManager($userId)) { $manager = Repo::user()->get($userId); $managers[] = [ 'email' => $manager->getEmail(), @@ -200,7 +205,7 @@ private function userIsManager($userId): bool $managerGroupName = 'preprint server manager'; foreach ($userGroupsOfUser as $userGroup) { - if(strtolower($userGroup->getName('en')) == $managerGroupName) { + if (strtolower($userGroup->getName('en')) == $managerGroupName) { return true; } } diff --git a/version.xml b/version.xml index 6075ab1..066dc10 100755 --- a/version.xml +++ b/version.xml @@ -12,8 +12,8 @@ authorVersion plugins.generic - 2.0.2.0 - 2024-08-12 + 2.0.3.0 + 2025-01-20 1 AuthorVersionPlugin