Skip to content

Commit 0caf86a

Browse files
committed
Merge branch 'fixRorRecommendationForOJS330-888' into 'stable-3_3_0'
Fixes the author's ROR recommendation notification and adds a record in the activity log when the message is successfully sent. See merge request softwares-pkp/plugins_ojs/OASwitchboard!40
2 parents 7c7c0e2 + 144ef73 commit 0caf86a

File tree

8 files changed

+24
-12
lines changed

8 files changed

+24
-12
lines changed

OASwitchboardPlugin.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function register($category, $path, $mainContextId = null)
2727
$resources = new Resources($this);
2828
HookRegistry::register('Publication::publish', [$message, 'sendToOASwitchboard']);
2929
HookRegistry::register('TemplateManager::display', [$resources, 'addWorkflowNotificationsJavaScript']);
30+
HookRegistry::register('NotificationManager::getNotificationMessage', [$resources, 'addMessageToInformationNotification']);
3031
}
3132
return $success;
3233
}

classes/Message.inc.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ public function sendToOASwitchboard($hookName, $args)
2424
if ($publication->getData('status') === STATUS_PUBLISHED) {
2525
$OASwitchboard = new OASwitchboardService($this->plugin, $contextId, $submission);
2626
$OASwitchboard->sendP1PioMessage();
27+
$keyMessage = 'plugins.generic.OASwitchboard.sendMessageWithSuccess';
28+
$this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_SUCCESS);
29+
$this->registerSubmissionEventLog($request, $submission, $keyMessage);
2730
if (!OASwitchboardService::isRorAssociated($submission)) {
28-
$keyMessage = 'plugins.generic.OASwitchboard.postRequirementsError.recipient';
29-
$this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_WARNING);
31+
$keyMessage = 'plugins.generic.OASwitchboard.rorRecommendation';
32+
$this->sendNotification($userId, __($keyMessage), NOTIFICATION_TYPE_INFORMATION);
3033
$this->registerSubmissionEventLog($request, $submission, $keyMessage);
3134
}
32-
$this->sendNotification($userId, __('plugins.generic.OASwitchboard.sendMessageWithSuccess'), NOTIFICATION_TYPE_SUCCESS);
3335
}
3436
} catch (P1PioException $e) {
3537
$this->sendNotification($userId, $e->getMessage(), NOTIFICATION_TYPE_WARNING);

classes/Resources.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@ public function addWorkflowNotificationsJavaScript($hookName, $args)
4141

4242
return false;
4343
}
44+
45+
public function addMessageToInformationNotification($hookName, $args)
46+
{
47+
$notification = & $args[0];
48+
$message = & $args[1];
49+
$notificationSettingsDao = DAORegistry::getDAO('NotificationSettingsDAO');
50+
$notificationSettings = $notificationSettingsDao->getNotificationSettings($notification->getId());
51+
$message = $notificationSettings['contents'];
52+
}
4453
}

cypress/tests/Test4_sendMessageSuccess.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('Send P1-PIO message with success', function () {
5454
cy.get('.pkpPublication > .pkpHeader > .pkpHeader__actions > button.pkpButton').contains("Schedule For Publication").click();
5555
cy.get('.pkpFormPage__footer button:contains("Publish")').click();
5656

57-
cy.get('.app__notifications').contains("At least one author of the article must have a ROR associated with their affiliation.");
57+
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.");
5858
cy.get('.app__notifications').contains("The message was successfully sent to the OA Switchboard");
5959
})
6060
})

locale/en_US/locale.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ msgstr "Server error when sending message. The OA Switchboard API server encount
4444
msgid "plugins.generic.OASwitchboard.postRequirementsError"
4545
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."
4646

47-
msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient"
48-
msgstr "At least one author of the article must have a ROR associated with their affiliation."
47+
msgid "plugins.generic.OASwitchboard.rorRecommendation"
48+
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."
4949

5050
msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName"
5151
msgstr "The family name of an author must be present."

locale/es_ES/locale.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ msgstr "Error del servidor al enviar el mensaje. El servidor de la API de OA Swi
4444
msgid "plugins.generic.OASwitchboard.postRequirementsError"
4545
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."
4646

47-
msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient"
48-
msgstr "Al menos uno de los autores del artículo debe tener un ROR asociado con su afiliación."
47+
msgid "plugins.generic.OASwitchboard.rorRecommendation"
48+
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."
4949

5050
msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName"
5151
msgstr "El apellido de un autor debe estar presente."

locale/pt_BR/locale.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ msgstr "Erro do servidor ao enviar a mensagem. O servidor da API do OA Switchboa
4444
msgid "plugins.generic.OASwitchboard.postRequirementsError"
4545
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."
4646

47-
msgid "plugins.generic.OASwitchboard.postRequirementsError.recipient"
48-
msgstr "Pelo menos um autor do artigo deve ter um ROR associado à sua afiliação."
47+
msgid "plugins.generic.OASwitchboard.rorRecommendation"
48+
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."
4949

5050
msgid "plugins.generic.OASwitchboard.postRequirementsError.familyName"
5151
msgstr "O sobrenome de um autor deve estar presente."

version.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<version>
1313
<application>OASwitchboard</application>
1414
<type>plugins.generic</type>
15-
<release>1.1.1.2</release>
16-
<date>2024-09-20</date>
15+
<release>1.1.1.3</release>
16+
<date>2024-09-23</date>
1717
<lazy-load>1</lazy-load>
1818
<class>OASwitchboardPlugin</class>
1919
</version>

0 commit comments

Comments
 (0)