Skip to content

Commit

Permalink
dev/core#2748 Remove unused token assigns
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Aug 12, 2021
1 parent 6e36519 commit bbb7e15
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
7 changes: 0 additions & 7 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3090,15 +3090,8 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa
// and this function should assign them (assigning null if not set).
// the way the pcpParams & honor Params section works is a baby-step towards this.
$template = CRM_Core_Smarty::singleton();
$template->assign('first_name', $this->_relatedObjects['contact']->first_name);
$template->assign('last_name', $this->_relatedObjects['contact']->last_name);
$template->assign('displayName', $this->_relatedObjects['contact']->display_name);
$template->assign('billingName', $values['billingName']);

// For some unit tests contribution cannot contain paymentProcessor information
$billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode'];
$template->assign('contributeMode', CRM_Core_SelectValues::contributeMode()[$billingMode] ?? NULL);

//assign honor information to receipt message
$softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Upgrade/Incremental/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function getMessageTemplateWarning(string $workflowName, string $old, str
OR civicrm_msg_template.msg_text LIKE '%$old%'
)
")) {
return ts('Please review your %1 message template and remove references to the token %2 as it has been replaced by %3', [
return ts('We have migrates some of our tokens and attempted to upgrade them in the database. Please review your %1 message template and remove any remaining references to the token %2 as it has been replaced by %3', [
1 => $workflowName,
2 => '{' . $old . '}',
3 => '{' . $new . '}',
Expand Down
14 changes: 10 additions & 4 deletions CRM/Upgrade/Incremental/php/FiveFortyTwo.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NU
* an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
*/
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
// Example: Generate a post-upgrade message.
// if ($rev == '5.12.34') {
// $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
// }
if ($rev === '5.42.alpha1') {
$templateUpgrader = new CRM_Upgrade_Incremental_MessageTemplates($rev);
$upgradeMessage[] = $templateUpgrader->getMessageTemplateWarning('contribution_invoice_receipt', '$contributionMode', 'no longer available / relevant');
$upgradeMessage[] = $templateUpgrader->getMessageTemplateWarning('contribution_invoice_receipt', '$first_name', 'contact.first_name');
$upgradeMessage[] = $templateUpgrader->getMessageTemplateWarning('contribution_invoice_receipt', '$last_name', 'contact.last_name');
$upgradeMessage[] = $templateUpgrader->getMessageTemplateWarning('contribution_invoice_receipt', '$displayName', 'contact.display_name');
if (!empty($upgradeMessage)) {
$postUpgradeMessage .= ' ' . htmlspecialchars(implode(' ', $upgradeMessage)) . '';
}
}
}

/*
Expand Down
7 changes: 0 additions & 7 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2078,9 +2078,7 @@ public function testCompleteTransaction() {
'currency:::USD',
'receive_date:::' . date('Ymd', strtotime($contribution['receive_date'])),
"receipt_date:::\n",
'contributeMode:::notify',
'title:::Contribution',
'displayName:::Mr. Anthony Anderson II',
'contributionStatus:::Completed',
]);
$mut->stop();
Expand Down Expand Up @@ -2118,9 +2116,7 @@ public function testCompleteTransactionEuro() {
'currency:::EUR',
'receive_date:::' . date('Ymd', strtotime($contribution['receive_date'])),
"receipt_date:::\n",
'contributeMode:::notify',
'title:::Contribution',
'displayName:::Mr. Anthony Anderson II',
'contributionStatus:::Completed',
]);
$mut->stop();
Expand Down Expand Up @@ -2156,7 +2152,6 @@ public function testPayLater(): void {
'is_pay_later:::1',
'email:::anthony_anderson@civicrm.org',
'pay_later_receipt:::This is a pay later receipt',
'displayName:::Mr. Anthony Anderson II',
'contributionPageId:::' . $contributionPageID,
'title:::Test Contribution Page',
'amount:::100',
Expand Down Expand Up @@ -3190,9 +3185,7 @@ public function testCompleteTransactionWithTestTemplate() {
'currency:::USD',
'receive_date:::' . date('Ymd', strtotime($receive_date)),
'receipt_date:::' . date('Ymd'),
'contributeMode:::notify',
'title:::Contribution',
'displayName:::Mr. Anthony Anderson II',
'trxn_id:::kazam',
'contactID:::' . $this->_params['contact_id'],
'contributionID:::' . $contribution['id'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
receipt_text:::{$receipt_text}
{/if}
is_pay_later:::{$is_pay_later}
displayName:::{$displayName}
financialTypeId:::{$financialTypeId}
financialTypeName:::{$financialTypeName}
contactID:::{$contactID}
Expand Down Expand Up @@ -52,9 +51,6 @@
{if isset($is_recur)}
is_recur:::{$is_recur}
{/if}
{if isset($contributeMode)}
contributeMode:::{$contributeMode}
{/if}
{if isset($trxn_id)}
trxn_id:::{$trxn_id}
{/if}
Expand Down

0 comments on commit bbb7e15

Please sign in to comment.