first commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/IssuePublishedNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class IssuePublishedNotify
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to all registered users to notify about new published issue
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\issue\Issue;
|
||||
use APP\mail\variables\IssueEmailVariable;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class IssuePublishedNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.issuePublishNotify.name';
|
||||
protected static ?string $description = 'mailable.issuePublishNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'ISSUE_PUBLISH_NOTIFY';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Issue $issue)
|
||||
{
|
||||
parent::__construct([$context, $issue]);
|
||||
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Issue::class] = IssueEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a footer with unsubscribe link
|
||||
*/
|
||||
protected function addFooter(string $locale): Mailable
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/OpenAccessNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class OpenAccessNotify
|
||||
*
|
||||
* @brief Email sent to notify user about issue open access
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\issue\Issue;
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\variables\IssueEmailVariable;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class OpenAccessNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.openAccessNotify.name';
|
||||
protected static ?string $description = 'mailable.openAccessNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'OPEN_ACCESS_NOTIFY';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
protected Journal $context;
|
||||
|
||||
public function __construct(Journal $context, Issue $issue)
|
||||
{
|
||||
parent::__construct([$context, $issue]);
|
||||
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Issue::class] = IssueEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a footer with unsubscribe link
|
||||
*/
|
||||
protected function addFooter(string $locale): Mailable
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/PaymentRequest.php
|
||||
*
|
||||
* Copyright (c) 2014-2023 Simon Fraser University
|
||||
* Copyright (c) 2000-2023 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class PaymentRequest
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to notify authors of the submission about the required payment
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\variables\ContextEmailVariable;
|
||||
use APP\submission\Submission;
|
||||
use PKP\core\PKPApplication;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\variables\ContextEmailVariable as PKPContextEmailVariable;
|
||||
use PKP\payment\QueuedPayment;
|
||||
use PKP\security\Role;
|
||||
|
||||
class PaymentRequest extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.paymentRequest.name';
|
||||
protected static ?string $description = 'mailable.paymentRequest.description';
|
||||
protected static ?string $emailTemplateKey = 'PAYMENT_REQUEST_NOTIFICATION';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
protected static string $queuedPaymentUrl = 'queuedPaymentUrl';
|
||||
protected static string $submissionGuidelinesUrl = 'submissionGuidelinesUrl';
|
||||
|
||||
public function __construct(Journal $context, Submission $submission, QueuedPayment $queuedPayment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
$this->setupPaymentUrlVariable($context, $queuedPayment);
|
||||
}
|
||||
|
||||
protected function setupPaymentUrlVariable(Journal $context, QueuedPayment $queuedPayment)
|
||||
{
|
||||
$request = Application::get()->getRequest();
|
||||
$dispatcher = $request->getDispatcher();
|
||||
$this->addData([
|
||||
static::$queuedPaymentUrl => $dispatcher->url(
|
||||
$request,
|
||||
PKPApplication::ROUTE_PAGE,
|
||||
$context->getPath(),
|
||||
'payment',
|
||||
'pay',
|
||||
[$queuedPayment->getId()]
|
||||
),
|
||||
static::$submissionGuidelinesUrl => $dispatcher->url(
|
||||
$request,
|
||||
Application::ROUTE_PAGE,
|
||||
$context->getPath(),
|
||||
'about',
|
||||
'submissions'
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::getDataDescriptions(),
|
||||
[
|
||||
static::$queuedPaymentUrl => __('emailTemplate.variable.queuedPaymentUrl'),
|
||||
static::$submissionGuidelinesUrl => __('emailTemplate.variable.submissionGuidelinesUrl'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function addFooter(string $locale): self
|
||||
{
|
||||
$this->footer = $this->renameContextVariables(
|
||||
__('emails.paymentRequestNotification.footer', [], $locale)
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace email template variables in the locale string, so they correspond to the application,
|
||||
* e.g., contextName => journalName/pressName/serverName
|
||||
*/
|
||||
protected function renameContextVariables(string $footer): string
|
||||
{
|
||||
$map = [
|
||||
'{$' . PKPContextEmailVariable::CONTEXT_NAME . '}' => '{$' . ContextEmailVariable::CONTEXT_NAME . '}',
|
||||
'{$' . PKPContextEmailVariable::CONTEXT_URL . '}' => '{$' . ContextEmailVariable::CONTEXT_URL . '}',
|
||||
];
|
||||
|
||||
return str_replace(array_keys($map), array_values($map), $footer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionExpired.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionExpired
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscriber that their subscription has expired
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionExpired extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionExpired.name';
|
||||
protected static ?string $description = 'mailable.subscriptionExpired.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_AFTER_EXPIRY';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionExpired.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionExpired
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscriber the second time that their subscription has expired
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionExpiredLast extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionExpiredLast.name';
|
||||
protected static ?string $description = 'mailable.subscriptionExpiredLast.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_AFTER_EXPIRY_LAST';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionExpiresSoon.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionExpiresSoon
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscriber that their subscription expires soon
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionExpiresSoon extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionExpiresSoon.name';
|
||||
protected static ?string $description = 'mailable.subscriptionExpiresSoon.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_BEFORE_EXPIRY';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionNotify
|
||||
*
|
||||
* @brief Email sent to notify user about new subscription
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionNotify.name';
|
||||
protected static ?string $description = 'mailable.subscriptionNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_NOTIFY';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
public function __construct(Journal $context, Subscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionPurchaseIndividual.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionPurchaseIndividual
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscription manager about new subscription
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\IndividualSubscription;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionPurchaseIndividual extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Sender;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionPurchaseIndividual.name';
|
||||
protected static ?string $description = 'mailable.subscriptionPurchaseIndividual.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_PURCHASE_INDL';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_READER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
|
||||
|
||||
public function __construct(Journal $context, IndividualSubscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionPurchaseInstitutional.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionPurchaseInstitutional
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscription manager about new subscription
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionInstitutional;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\InstitutionalSubscription;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\institution\Institution;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionPurchaseInstitutional extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Sender;
|
||||
use SubscriptionInstitutional;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionPurchaseInstitutional.name';
|
||||
protected static ?string $description = 'mailable.subscriptionPurchaseInstitutional.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_PURCHASE_INSTL';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_READER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
|
||||
|
||||
public function __construct(
|
||||
Journal $context,
|
||||
InstitutionalSubscription $subscription,
|
||||
SubscriptionType $subscriptionType,
|
||||
Institution $institution
|
||||
) {
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupInstitutionalVariables($subscription, $institution);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for institution related template variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables = static::addInstitutionalVariablesDescription($variables);
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionRenewIndividual.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionRenewIndividual
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscription manager about subscription renewal
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\IndividualSubscription;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionRenewIndividual extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Sender;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionRenewIndividual.name';
|
||||
protected static ?string $description = 'mailable.subscriptionRenewIndividual.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_RENEW_INDL';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_READER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
|
||||
|
||||
public function __construct(Journal $context, IndividualSubscription $subscription, SubscriptionType $subscriptionType)
|
||||
{
|
||||
parent::__construct([$context, $subscription]);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for subscription type related variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubscriptionRenewInstitutional.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubscriptionRenewInstitutional
|
||||
*
|
||||
* @brief Email sent automatically to notify a subscription manager about subscription renewal
|
||||
*/
|
||||
|
||||
namespace APP\mail\mailables;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use APP\mail\traits\SubscriptionInstitutional;
|
||||
use APP\mail\traits\SubscriptionTypeVariables;
|
||||
use APP\mail\variables\SubscriptionEmailVariable;
|
||||
use APP\subscription\InstitutionalSubscription;
|
||||
use APP\subscription\Subscription;
|
||||
use APP\subscription\SubscriptionType;
|
||||
use PKP\institution\Institution;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubscriptionRenewInstitutional extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Sender;
|
||||
use SubscriptionInstitutional;
|
||||
use SubscriptionTypeVariables;
|
||||
|
||||
protected static ?string $name = 'mailable.subscriptionRenewInstitutional.name';
|
||||
protected static ?string $description = 'mailable.subscriptionRenewInstitutional.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBSCRIPTION_RENEW_INSTL';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_READER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUBSCRIPTION_MANAGER];
|
||||
|
||||
public function __construct(
|
||||
Journal $context,
|
||||
InstitutionalSubscription $subscription,
|
||||
SubscriptionType $subscriptionType,
|
||||
Institution $institution,
|
||||
) {
|
||||
parent::__construct(func_get_args());
|
||||
$this->setupInstitutionalVariables($subscription, $institution);
|
||||
$this->setupSubscriptionTypeVariables($subscriptionType, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup subscription related variables
|
||||
*/
|
||||
protected static function templateVariablesMap(): array
|
||||
{
|
||||
$map = parent::templateVariablesMap();
|
||||
$map[Subscription::class] = SubscriptionEmailVariable::class;
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description for institution related template variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables = static::addInstitutionalVariablesDescription($variables);
|
||||
return static::addSubscriptionTypeVariablesDescription($variables);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user