Open Vitaliy-1 opened 1 month ago
@Vitaliy-1 Thank you for the sharing the files path.
I have added functionality to log email data for the "Add Reviewer" action in OJS 3.4. Below are the changes made:
Files Modified lib/pkp/classes/log/event/PKPSubmissionEventLogEntry.php lib/pkp/classes/submission/action/EditorAction.php
Changes
Added new constants for email events:
`class PKPSubmissionEventLogEntry extends EventLogEntry { // ... existing constants ...
public const SUBMISSION_EMAIL_REVIEW_REQUEST = 0x50000001;
public const SUBMISSION_EMAIL_REVIEW_REQUEST_SUBSEQUENT = 0x50000002;
// ... existing methods ...
} `
Modified the addReviewer method to include email logging:
`public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $reviewDueDate, $responseDueDate, $reviewMethod = null) { // ... existing code ...
if (!$assigned && isset($reviewer) && !Hook::call('EditorAction::addReviewer', [&$submission, $reviewerId])) {
// ... existing code ...
// Send mail
if (!$request->getUserVar('skipEmail')) {
$context = PKPServices::get('context')->get($submission->getData('contextId'));
$emailTemplate = Repo::emailTemplate()->getByKey($submission->getData('contextId'), $request->getUserVar('template'));
$emailBody = $request->getUserVar('personalMessage');
$emailSubject = $emailTemplate->getLocalizedData('subject');
$mailable = $this->createMail($submission, $reviewAssignment, $reviewer, $user, $emailBody, $emailSubject, $context);
try {
Mail::send($mailable);
// Log email
$eventType = ($reviewRound->getRound() == 1) ? PKPSubmissionEventLogEntry::SUBMISSION_EMAIL_REVIEW_REQUEST : PKPSubmissionEventLogEntry::SUBMISSION_EMAIL_REVIEW_REQUEST_SUBSEQUENT;
$submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
$submissionEmailLogDao->logMailable($eventType, $mailable, $submission, $user);
} catch (TransportException $e) {
$notificationMgr = new PKPNotificationManager();
$notificationMgr->createTrivialNotification(
$user->getId(),
PKPNotification::NOTIFICATION_TYPE_ERROR,
['contents' => __('email.compose.error')]
);
trigger_error('Failed to send email: ' . $e->getMessage(), E_USER_WARNING);
}
}
}
}
Summary
These changes ensure that email data is logged whenever a reviewer is added.`
@Vitaliy-1 I've created PRs for this. Please take a look.
PRs: pkp-lib (main) - https://github.com/pkp/pkp-lib/pull/10229 pkp lib (stable 3.4) - https://github.com/pkp/pkp-lib/pull/10230
ojs (main) - https://github.com/pkp/ojs/pull/4373 ojs (stable 3.4) - https://github.com/pkp/ojs/pull/4374
omp (main) - https://github.com/pkp/omp/pull/1651 omp (stable 3.4) - https://github.com/pkp/omp/pull/1652
Describe the bug Described on the forum https://forum.pkp.sfu.ca/t/review-request-emails-no-longer-logged-in-ojs-3-4-intentionally/88499
In 3.3, when sending a review request email, the email information was recorded in the
email_log
table. It didn't have a specificevent_type
for that action.To Reproduce Steps to reproduce the behavior:
Add Reviewer
email_log
tableWhat application are you using? OJS 3.4, OJS main
Additional information
SUBMISSION_EMAIL_REVIEW_REQUEST
andSUBMISSION_EMAIL_REVIEW_REQUEST_SUBSEQUENT
PKP\submission\action\EditorAction::addReviewer()
, usePKP\log\SubmissionEmailLogDAO::logMailable()
to record the data.