Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Payment Notification to use greeting, remove text to 'Please print this confirmation for your records. #13655

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Update Payment notification to use the value stored in email_greeting rather than display name (this has been done in other templates).

Also remove text to 'Please print this confirmation for your records.'

Before

Addressed by display name - eg. 'Dear Mr. Anthony Anderson II,'

Sentence Please print this confirmation for your records is present

After

Addressed by email greeting per site config & like other templates eg. 'Dear Anthony,'

Sentence Please print this confirmation for your records has gone

Technical Details

These changes are consistent with other changes. I also switched the parameters for when to include extra detail to deprecate contributeMode

Comments

Resolving inconsistency on greeting as pre-requisite for #13649

@magnolia61 I think this is probably one you'll be please to see

@civibot
Copy link

civibot bot commented Feb 21, 2019

(Standard links)

@civibot civibot bot added the master label Feb 21, 2019
@@ -160,7 +160,7 @@
</td>
</tr>
{/if}
{if $contributeMode eq'direct' and !$isAmountzero}
{if $credit_card_number}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would never have a card number here if it's not been used for a payment so we don't need contributeMode or to check the amount

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@@ -147,7 +147,7 @@
<tr>
<td>
<table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
{if $contributeMode eq 'direct' and !$isAmountzero}
{if $billingName || $address}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are assigned in the processCreditCard code. I would have liked to load them for the db but we don't retain an address per payment - only per contribution - probably we should

These changes are consistent with other changes. I also switched the parameters for when to include
extra detail to deprecate contributeMode
@eileenmcnaughton eileenmcnaughton changed the title Update Payment Notification to use greeting, to not encourage printing Update Payment Notification to use greeting, remove text to 'Please print this confirmation for your records. Feb 21, 2019
@@ -169,6 +169,8 @@ protected static function loadRelatedEntities($id) {
$contactID = self::getPaymentContactID($contributionID);
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
$entities['contact'] = ['id' => $contactID, 'display_name' => $displayName, 'email' => $email];
$contact = civicrm_api3('Contact', 'getsingle', ['id' => $contactID, 'return' => 'email_greeting']);
$entities['contact']['email_greeting'] = $contact['email_greeting_display'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems $contact is not used anywhere below so can we change it to:

$entities['contact']['email_greeting'] = civicrm_api3('Contact', 'getvalue', ['id' => $contactID, 'return' => 'email_greeting_display']);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monishdeb nope we can't - if it's empty getvalue will throw an error

// These 2 rows are temporarily added for sequencing of adding commits. They won't be needed when we
// switch to Payment.send_confirmation api
$contact = civicrm_api3('Contact', 'getsingle', ['id' => $this->_contactId, 'return' => 'email_greeting']);
$this->assign('emailGreeting', $contact['email_greeting_display']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 2 lines will go next pr

@@ -12,7 +12,8 @@
{capture assign=emptyBlockStyle }style="padding: 10px; border-bottom: 1px solid #999;background-color: #f7f7f7;"{/capture}
{capture assign=emptyBlockValueStyle }style="padding: 10px; border-bottom: 1px solid #999;"{/capture}

<p>Dear {$contactDisplayName}</p>
{if $emailGreeting}<p>{$emailGreeting},</p>{/if}

<center>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@monishdeb
Copy link
Member

Tested working fine. Also has an extended UT to assert billing address and card details

@monishdeb monishdeb merged commit 7ae65a0 into civicrm:master Feb 21, 2019
@eileenmcnaughton eileenmcnaughton deleted the payment_receipt branch February 21, 2019 08:41
@magnolia61
Copy link
Contributor

Hi Eileen,
Indeed nice to see this one also move to the emailgreeting token. Maybe a good occasion also to move the greeting to within the first like in other templates. Now the greeting is left aligned outside of the table.

screenshot from 2019-02-22 11-26-17

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 indeed! having already set the upgrade script on this it's good to tweak that at the same time - are you able to to test the revisted tpl in #13669

@magnolia61
Copy link
Contributor

When I upgrade my dev site to the current master a fatal error get's thrown on the
UPDATE civicrm_msg_template:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1]"]

@eileenmcnaughton
Copy link
Contributor Author

@magnolia61 is there any more info? That update script hasn't changed so it's a bit weird

@magnolia61
Copy link
Contributor

magnolia61 commented Mar 6, 2019

This is from the CiviCRM log: [debug_info]
UPDATE civicrm_msg_template SET msg_text = *'{if $emailGreeting}{$emailGreeting},\n{/if}{if $isRefund}\n{ts}A refund has been issued based on changes in your registration selections.{/ts}\n{else}\n{ts}A payment has been received.{/ts}\n{/if}\n\n{if $isRefund}\n===============================================================================\n\n{ts}Refund Details{/ts}\n\n===============================================================================\n{ts}Total Fees{/ts}: {$totalAmount|crmMoney}\n{ts}You Paid{/ts}: {$totalPaid|crmMoney}\n------------------------------------------------------------------------------------\n{ts}Refund Amount{/ts}: {$refundAmount|crmMoney}\n\n{else}\n===============================================================================\n\n{ts}Payment Details{/ts}\n\n===============================================================================\n{ts}Total Fees{/ts}: {$totalAmount|crmMoney}\n{ts}This Payment Amount{/ts}: {$paymentAmount|crmMoney}\n------------------------------------------------------------------------------------\n{ts}Balance Owed{/ts}: {$amountOwed|crmMoney} { This will be zero after final payment. *}\n\n{if $paymentsComplete}\n\n{ts}Thank you for completing payment.{/ts}\n{/if}\n{/if}\n{if $receive_date}\n{ts}Transaction Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n{/if}\n{if $paidBy}\n{ts}Paid By{/ts}: {$paidBy}\n{/if}\n{if $checkNumber}\n{ts}Check Number{/ts}: {$checkNumber}\n{/if}\n{if $billingName || $address}\n\n===============================================================================\n\n{ts}Billing Name and Address{/ts}\n\n===============================================================================\n\n{$billingName}\n{$address}\n{/if}\n\n{if $credit_card_number}\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===============================================================================\n\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}\n{/if}\n{if $component eq 'event'}\n===============================================================================\n\n{ts}Event Information and Location{/ts}\n\n===============================================================================\n\n{$event.event_title}\n{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}\n\n{if $event.participant_role}\n{ts}Participant Role{/ts}: {$event.participant_role}\n{/if}\n\n{if $isShowLocation}\n{$location.address.1.display|strip_tags:false}\n{/if}{End of isShowLocation condition}\n\n{if $location.phone.1.phone || $location.email.1.email}\n\n{ts}Event Contacts:{/ts}\n{foreach from=$location.phone item=phone}\n{if $phone.phone}\n\n{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}\n{/foreach}\n{foreach from=$location.email item=eventEmail}\n{if $eventEmail.email}\n\n{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}\n{/if}\n{/if}\n'**WHERE id IN () [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1]

@magnolia61
Copy link
Contributor

Solved it! For some reason a former upgrade did not work well and left me with a double entry in the civicrm_option_value table for the payment_or_refund_notification template. When I removed the redundant ones, the upgrade worked like a charm.

@eileenmcnaughton
Copy link
Contributor Author

thanks - & phew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants