diff --git a/OASwitchboardPlugin.inc.php b/OASwitchboardPlugin.inc.php index d0e3d4d..d53b30c 100644 --- a/OASwitchboardPlugin.inc.php +++ b/OASwitchboardPlugin.inc.php @@ -27,6 +27,7 @@ public function register($category, $path, $mainContextId = null) $resources = new Resources($this); HookRegistry::register('Publication::publish', [$message, 'sendToOASwitchboard']); HookRegistry::register('TemplateManager::display', [$resources, 'addWorkflowNotificationsJavaScript']); + HookRegistry::register('NotificationManager::getNotificationMessage', [$resources, 'addMessageToInformationNotification']); } return $success; } diff --git a/classes/Message.inc.php b/classes/Message.inc.php index 7fb5492..ba89e7e 100644 --- a/classes/Message.inc.php +++ b/classes/Message.inc.php @@ -24,12 +24,14 @@ public function sendToOASwitchboard($hookName, $args) if ($publication->getData('status') === STATUS_PUBLISHED) { $OASwitchboard = new OASwitchboardService($this->plugin, $contextId, $submission); $OASwitchboard->sendP1PioMessage(); + $keyMessage = 'plugins.generic.OASwitchboard.sendMessageWithSuccess'; + $this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_SUCCESS); + $this->registerSubmissionEventLog($request, $submission, $keyMessage); if (!OASwitchboardService::isRorAssociated($submission)) { - $keyMessage = 'plugins.generic.OASwitchboard.postRequirementsError.recipient'; - $this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_WARNING); + $keyMessage = 'plugins.generic.OASwitchboard.rorRecommendation'; + $this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_INFORMATION); $this->registerSubmissionEventLog($request, $submission, $keyMessage); } - $this->sendNotification($userId, __('plugins.generic.OASwitchboard.sendMessageWithSuccess'), NOTIFICATION_TYPE_SUCCESS); } } catch (P1PioException $e) { $this->sendNotification($userId, $e->getMessage(), NOTIFICATION_TYPE_WARNING); diff --git a/classes/Resources.inc.php b/classes/Resources.inc.php index 522a9c9..534484c 100644 --- a/classes/Resources.inc.php +++ b/classes/Resources.inc.php @@ -41,4 +41,13 @@ public function addWorkflowNotificationsJavaScript($hookName, $args) return false; } + + public function addMessageToInformationNotification($hookName, $args) + { + $notification = & $args[0]; + $message = & $args[1]; + $notificationSettingsDao = DAORegistry::getDAO('NotificationSettingsDAO'); + $notificationSettings = $notificationSettingsDao->getNotificationSettings($notification->getId()); + $message = $notificationSettings['contents']; + } } diff --git a/cypress/tests/Test4_sendMessageSuccess.cy.js b/cypress/tests/Test4_sendMessageSuccess.cy.js index 87d7150..ed48f60 100644 --- a/cypress/tests/Test4_sendMessageSuccess.cy.js +++ b/cypress/tests/Test4_sendMessageSuccess.cy.js @@ -54,7 +54,7 @@ describe('Send P1-PIO message with success', function () { cy.get('.pkpPublication > .pkpHeader > .pkpHeader__actions > button.pkpButton').contains("Schedule For Publication").click(); cy.get('.pkpFormPage__footer button:contains("Publish")').click(); - cy.get('.app__notifications').contains("At least one author of the article must have a ROR associated with their affiliation."); + cy.get('.app__notifications').contains("At least one author should have a ROR ID linked to their affiliation (requires the ROR plugin) for the message to be sent to the affiliation."); cy.get('.app__notifications').contains("The message was successfully sent to the OA Switchboard"); }) }) \ No newline at end of file diff --git a/locale/en_US/locale.po b/locale/en_US/locale.po index 9792200..f5ad1c5 100644 --- a/locale/en_US/locale.po +++ b/locale/en_US/locale.po @@ -44,8 +44,8 @@ msgstr "Server error when sending message. The OA Switchboard API server encount msgid "plugins.generic.OASwitchboard.postRequirementsError" msgstr "We don't have the mandatory data for sending the message to the OA Switchboard, please check the submission activity log to understand the pending requirements." -msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient" -msgstr "At least one author of the article must have a ROR associated with their affiliation." +msgid "plugins.generic.OASwitchboard.rorRecommendation" +msgstr "At least one author should have a ROR ID linked to their affiliation (requires the ROR plugin) for the message to be sent to the affiliation." msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName" msgstr "The family name of an author must be present." diff --git a/locale/es_ES/locale.po b/locale/es_ES/locale.po index 55f4c68..5d6bd07 100644 --- a/locale/es_ES/locale.po +++ b/locale/es_ES/locale.po @@ -44,8 +44,8 @@ msgstr "Error del servidor al enviar el mensaje. El servidor de la API de OA Swi msgid "plugins.generic.OASwitchboard.postRequirementsError" msgstr "No tenemos los datos obligatorios para enviar el mensaje al OA Switchboard, por favor revise el Registro de actividad de lo envío para entender los requisitos pendientes." -msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient" -msgstr "Al menos uno de los autores del artículo debe tener un ROR asociado con su afiliación." +msgid "plugins.generic.OASwitchboard.rorRecommendation" +msgstr "Al menos un autor debe tener un ID ROR vinculado a su afiliación (requiere el plugin ROR) para que el mensaje sea enviado a la afiliación." msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName" msgstr "El apellido de un autor debe estar presente." diff --git a/locale/pt_BR/locale.po b/locale/pt_BR/locale.po index 544e451..98fda5b 100644 --- a/locale/pt_BR/locale.po +++ b/locale/pt_BR/locale.po @@ -44,8 +44,8 @@ msgstr "Erro do servidor ao enviar a mensagem. O servidor da API do OA Switchboa msgid "plugins.generic.OASwitchboard.postRequirementsError" msgstr "Não temos os dados obrigatórios para envio da mensagem para o OA Switchboard, verifique o histórico de atividades da submissão para entender os requisitos pendentes." -msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient" -msgstr "Pelo menos um autor do artigo deve ter um ROR associado à sua afiliação." +msgid "plugins.generic.OASwitchboard.rorRecommendation" +msgstr "Pelo menos um autor deve ter um ID ROR vinculado à sua afiliação (requer o plugin ROR) para que a mensagem seja enviada à afiliação." msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName" msgstr "O sobrenome de um autor deve estar presente." diff --git a/version.xml b/version.xml index c7c1f34..a452d93 100644 --- a/version.xml +++ b/version.xml @@ -12,8 +12,8 @@ OASwitchboard plugins.generic - 1.1.1.2 - 2024-09-20 + 1.1.1.3 + 2024-09-23 1 OASwitchboardPlugin