CRM-13965 : email sending template fixes
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Mon, 27 Jan 2014 11:08:35 +0000 (16:38 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Mon, 27 Jan 2014 11:08:35 +0000 (16:38 +0530)
CRM/Contribute/Form/AdditionalPayment.php
xml/templates/message_templates/payment_or_refund_notification_html.tpl
xml/templates/message_templates/payment_or_refund_notification_text.tpl

index f9112f295632a5d49ec93aae72f8e9ad02f10e58..c1b4feae3c90bd8cd283e4b0a6b7ccfcacb4e071 100644 (file)
@@ -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
index a1def6b86be99e087b8dfa4f1ca0aecf6aaffde6..d7b143ffa1d36ffe44a8c983d52672f46b970834 100644 (file)
             <td colspan="2" {$valueStyle}>
              {$credit_card_type}<br />
              {$credit_card_number}<br />
-             {ts 1=$credit_card_exp_date|truncate:7:''|crmDate}Expires: %1{/ts}
+             {ts}Expires:{/ts} {$credit_card_exp_date|truncate:7:''|crmDate}
             </td>
           </tr>
          {/if}
index 5b9a7b170488b6714142b51c6ea707fbb8a4c325..938fd8a33327699f07ba358366c8c2e601921f79 100644 (file)
@@ -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'}
 ===============================================================================