Skip to content

Commit

Permalink
Merge pull request #143 from systemseed/rg-email
Browse files Browse the repository at this point in the history
feat(backend): allow different email configuration for recurring donations
  • Loading branch information
PavelBulat committed Feb 8, 2021
2 parents 7a319a7 + 183695a commit 0278110
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ public function orderCompleteHandler(WorkflowTransitionEvent $event) {
$subject = $appeal->get('field_thankyou_email_subject')->value;
$body = $appeal->get('field_thankyou_email_body')->value;

// Allow different email configuration for recurring donations.
$donation_type = $order->order_items->entity->field_donation_type->value;
if ($donation_type === 'recurring_donation'
&& $appeal->hasField('field_thankyou_email_subject_rg')
&& $appeal->hasField('field_thankyou_email_body_rg')
&& !$appeal->get('field_thankyou_email_subject_rg')->isEmpty()
&& !$appeal->get('field_thankyou_email_body_rg')->isEmpty()
) {
$subject = $appeal->get('field_thankyou_email_subject_rg')->value;
$body = $appeal->get('field_thankyou_email_body_rg')->value;
}

// Check subject and body for thank you email.
if (empty($subject) || empty($body)) {
$this->logger
Expand Down

0 comments on commit 0278110

Please sign in to comment.