Skip to content

Commit

Permalink
Merge pull request #1044 from Vitaliy-1/i7264_rename_variables
Browse files Browse the repository at this point in the history
pkp/pkp-lib#7264 Rename email template variables
  • Loading branch information
Vitaliy-1 authored Dec 22, 2021
2 parents 83f4b10 + 4376de8 commit 09b415b
Show file tree
Hide file tree
Showing 25 changed files with 1,608 additions and 1,529 deletions.
28 changes: 28 additions & 0 deletions classes/emailTemplate/DAO.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @file classes/emailTemplate/DAO.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DAO
*
* @brief Read and write email templates to the database.
*/

namespace APP\emailTemplate;

class DAO extends \PKP\emailTemplate\DAO
{
/**
* Renames app-specific email template variables during installation
*/
protected function variablesToRename(): array
{
return [
'contextName' => 'pressName',
'contextUrl' => 'pressUrl',
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I7264_UpdateEmailTemplates
* @brief Describe upgrade/downgrade operations for DB table email_templates.
*/

namespace APP\migration\upgrade\v3_4_0;

class I7264_UpdateEmailTemplates extends \PKP\migration\upgrade\v3_4_0\I7264_UpdateEmailTemplates
{
protected function oldNewVariablesMap(): array
{
$oldNewVariablesMap = parent::oldNewVariablesMap();
array_walk_recursive($oldNewVariablesMap, function (&$newVariable, $oldVariable) {
if ($newVariable === 'contextName') {
$newVariable = 'pressName';
} elseif ($newVariable === 'contextUrl') {
$newVariable = 'pressUrl';
}
});

return $oldNewVariablesMap;
}
}
13 changes: 7 additions & 6 deletions classes/submission/form/SubmissionSubmitStep4Form.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use APP\mail\MonographMailTemplate;
use APP\notification\NotificationManager;
use PKP\log\SubmissionLog;
use PKP\notification\PKPNotification;
use PKP\submission\form\PKPSubmissionSubmitStep4Form;

class SubmissionSubmitStep4Form extends PKPSubmissionSubmitStep4Form
Expand Down Expand Up @@ -68,20 +69,20 @@ public function execute(...$functionParams)
$mail->bccAssignedSeriesEditors($this->submissionId, WORKFLOW_STAGE_ID_SUBMISSION);

$mail->assignParams([
'authorName' => $user->getFullName(),
'authorUsername' => $user->getUsername(),
'editorialContactSignature' => $context->getData('contactName') . "\n" . $context->getLocalizedName(),
'recipientName' => $user->getFullName(),
'recipientUsername' => $user->getUsername(),
'signature' => $context->getData('contactName') . "\n" . $context->getLocalizedName(),
'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $this->submissionId),
]);

if (!$mail->send($request)) {
$notificationMgr = new NotificationManager();
$notificationMgr->createTrivialNotification($request->getUser()->getId(), NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]);
$notificationMgr->createTrivialNotification($request->getUser()->getId(), PKPNotification::NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]);
}

$authorMail->assignParams([
'submitterName' => $user->getFullName(),
'editorialContactSignature' => $context->getData('contactName'),
'signature' => $context->getData('contactName'),
]);

foreach ($this->emailRecipients as $authorEmailRecipient) {
Expand All @@ -92,7 +93,7 @@ public function execute(...$functionParams)
if (!empty($recipients)) {
if (!$authorMail->send($request)) {
$notificationMgr = new NotificationManager();
$notificationMgr->createTrivialNotification($request->getUser()->getId(), NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]);
$notificationMgr->createTrivialNotification($request->getUser()->getId(), PKPNotification::NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<migration class="APP\migration\upgrade\v3_4_0\I6807_SetLastModified" />
<migration class="APP\migration\upgrade\v3_4_0\I7132_AddSourceChapterId" />
<migration class="PKP\migration\upgrade\v3_4_0\I7167_RemoveDuplicatedUserSettingsAndDeprecatedFields" />
<migration class="APP\migration\upgrade\v3_4_0\I7264_UpdateEmailTemplates"/>
<data file="dbscripts/xml/upgrade/3.4.0_preupdate_email_templates.xml" />
<note file="docs/release-notes/README-3.4.0" />
</upgrade>
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 65 files
+20 −0 api/v1/announcements/PKPAnnouncementHandler.inc.php
+3 −5 classes/author/Repository.inc.php
+7 −6 classes/author/maps/Schema.inc.php
+0 −1 classes/components/forms/publication/PKPContributorForm.inc.php
+9 −10 classes/components/listPanels/PKPContributorsListPanel.inc.php
+33 −2 classes/emailTemplate/DAO.inc.php
+1 −0 classes/emailTemplate/Repository.inc.php
+5 −4 classes/mail/MailTemplate.inc.php
+1 −1 classes/mail/SubmissionMailTemplate.inc.php
+1 −1 classes/mail/mailables/ValidateEmailContext.inc.php
+1 −1 classes/mail/mailables/ValidateEmailSite.inc.php
+2 −2 classes/mail/variables/RecipientEmailVariable.inc.php
+3 −0 classes/mail/variables/SiteEmailVariable.inc.php
+4 −4 classes/mail/variables/SubmissionEmailVariable.inc.php
+436 −0 classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php
+1 −1 classes/notification/PKPNotificationOperationManager.inc.php
+4 −1 classes/notification/managerDelegate/AnnouncementNotificationManager.inc.php
+2 −2 classes/observers/listeners/ValidateRegisteredEmail.inc.php
+21 −18 classes/submission/Collector.inc.php
+9 −9 classes/task/ReviewReminder.inc.php
+1 −1 controllers/grid/settings/user/form/UserDetailsForm.inc.php
+1 −1 controllers/grid/users/reviewer/form/CreateReviewerForm.inc.php
+11 −11 controllers/grid/users/reviewer/form/ReviewReminderForm.inc.php
+7 −7 controllers/grid/users/reviewer/form/ReviewerForm.inc.php
+2 −2 controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.inc.php
+7 −7 controllers/grid/users/reviewer/form/ThankReviewerForm.inc.php
+2 −2 controllers/grid/users/stageParticipant/StageParticipantGridHandler.inc.php
+8 −12 controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.inc.php
+11 −11 controllers/modals/editorDecision/form/EditorDecisionWithEmailForm.inc.php
+1 −1 controllers/modals/editorDecision/form/RecommendationForm.inc.php
+1 −1 controllers/modals/editorDecision/form/SendReviewsForm.inc.php
+39 −3 locale/ar_IQ/manager.po
+5 −1 locale/ar_IQ/submission.po
+115 −1 locale/bg_BG/grid.po
+36 −1 locale/cs_CZ/grid.po
+2 −2 locale/cs_CZ/manager.po
+10 −2 locale/cs_CZ/submission.po
+4 −3 locale/cs_CZ/user.po
+2 −2 locale/da_DK/manager.po
+5 −1 locale/da_DK/submission.po
+42 −1 locale/de_DE/manager.po
+6 −2 locale/de_DE/submission.po
+5 −2 locale/en_US/manager.po
+2 −2 locale/hu_HU/manager.po
+4 −3 locale/ja_JP/admin.po
+29 −7 locale/ja_JP/common.po
+458 −2 locale/ja_JP/editor.po
+4 −3 locale/ja_JP/grid.po
+2,217 −2 locale/ja_JP/manager.po
+5 −4 locale/ja_JP/reviewer.po
+25 −21 locale/ja_JP/submission.po
+8 −7 locale/ja_JP/user.po
+2 −2 locale/mk_MK/manager.po
+2 −2 locale/pt_BR/manager.po
+6 −2 locale/pt_BR/submission.po
+2 −2 locale/pt_PT/manager.po
+6 −2 locale/pt_PT/submission.po
+2 −2 locale/ru_RU/manager.po
+5 −1 locale/sl_SI/submission.po
+2 −2 locale/tr_TR/manager.po
+5 −1 locale/tr_TR/submission.po
+2 −2 pages/login/LoginHandler.inc.php
+1 −2 pages/workflow/PKPWorkflowHandler.inc.php
+1 −1 plugins/importexport/users/filter/UserXmlPKPUserFilter.inc.php
+6 −5 schemas/author.json
Loading

0 comments on commit 09b415b

Please sign in to comment.