From ad96d702bcb0c3f84c7f09204c2d255b05e97546 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Mon, 27 Jan 2014 16:38:35 +0530 Subject: [PATCH] CRM-13965 : email sending template fixes --- CRM/Contribute/Form/AdditionalPayment.php | 13 ++++++++++++- .../payment_or_refund_notification_html.tpl | 2 +- .../payment_or_refund_notification_text.tpl | 8 ++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index f9112f2956..c1b4feae3c 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -78,6 +78,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE); + $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail(); $this->_formType = CRM_Utils_Array::value('formType', $_GET); @@ -86,6 +87,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $enitityType = 'participant'; $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id'); } + $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id'); + $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId); $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType); $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component); @@ -248,7 +251,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract //add receipt for offline contribution $this->addElement('checkbox', 'is_email_receipt', ts('Send Receipt?')); - $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails); + $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails['from_email_id']); $this->add('textarea', 'receipt_text', ts('Confirmation Message')); @@ -351,6 +354,9 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } + if ($sendReceipt) { + $statusMsg .= ' ' . ts('Email has been sent successfully'); + } CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); $session = CRM_Core_Session::singleton(); @@ -542,6 +548,10 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract if (!empty($this->_params['is_email_receipt']) && $sendReceipt) { $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); } + if ($sendReceipt) { + $statusMsg .= ' ' . ts('Email has been sent successfully'); + } + CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success'); $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactId}&selectedChild=participant" @@ -625,5 +635,6 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails); } list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); + return $mailSent; } } \ No newline at end of file diff --git a/xml/templates/message_templates/payment_or_refund_notification_html.tpl b/xml/templates/message_templates/payment_or_refund_notification_html.tpl index a1def6b86b..d7b143ffa1 100644 --- a/xml/templates/message_templates/payment_or_refund_notification_html.tpl +++ b/xml/templates/message_templates/payment_or_refund_notification_html.tpl @@ -153,7 +153,7 @@ {$credit_card_type}
{$credit_card_number}
- {ts 1=$credit_card_exp_date|truncate:7:''|crmDate}Expires: %1{/ts} + {ts}Expires:{/ts} {$credit_card_exp_date|truncate:7:''|crmDate} {/if} diff --git a/xml/templates/message_templates/payment_or_refund_notification_text.tpl b/xml/templates/message_templates/payment_or_refund_notification_text.tpl index 5b9a7b1704..938fd8a333 100644 --- a/xml/templates/message_templates/payment_or_refund_notification_text.tpl +++ b/xml/templates/message_templates/payment_or_refund_notification_text.tpl @@ -1,13 +1,11 @@ Dear {$contactDisplayName} {if $paymentConfig.confirm_email_text} {$paymentConfig.confirm_email_text} -{else} -{if $isRefund} +{elseif $isRefund} {ts}A refund has been issued based on changes in your registration selections.{/ts} {else} {ts}A payment has been received.{/ts} {/if} -{/if} {ts}Please print this confirmation for your records.{/ts} @@ -36,7 +34,7 @@ Dear {$contactDisplayName} {ts}Thank-you. This completes your payment for {/ts}{if $component eq 'event'}{$event.event_title}{/if}. {/if} - +{/if} {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} @@ -71,8 +69,6 @@ Dear {$contactDisplayName} {$credit_card_number} {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} {/if} -{/if} -{/if} {if $component eq 'event'} =============================================================================== -- 2.25.1