Skip to content

Commit

Permalink
[REF] Remove pass-by-reference & always empty param
Browse files Browse the repository at this point in the history
Once #17982 is merged there are only 2 places that call this function. In both
places
1) they instantiate an empty values array just to pass in
2) we can see they don't use input or ids afterwards, so they don't need to be passed by reference
  • Loading branch information
eileenmcnaughton committed Jul 28, 2020
1 parent aa328fc commit 31e251e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -4609,9 +4609,8 @@ public static function completeOrder($input, &$ids, $objects, $transaction = NUL
* @throws \CiviCRM_API3_Exception
* @throws \Exception
*/
public static function sendMail(&$input, &$ids, $contributionID, &$values,
$returnMessageText = FALSE) {

public static function sendMail($input, $ids, $contributionID, $returnMessageText = FALSE) {
$values = [];
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $contributionID;
if (!$contribution->find(TRUE)) {
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contribute/Form/Task/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ public function postProcess() {
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);

$values = [];
if (isset($params['from_email_address']) && !$elements['createPdf']) {
// If a logged in user from email is used rather than a domain wide from email address
// the from_email_address params key will be numerical and we need to convert it to be
Expand All @@ -196,8 +195,7 @@ public function postProcess() {
$input['receipt_from_name'] = str_replace('"', '', $fromDetails[0]);
}

$mail = CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution']->id, $values,
$elements['createPdf']);
$mail = CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution']->id, $elements['createPdf']);

if ($mail['html']) {
$message[] = $mail['html'];
Expand Down
4 changes: 2 additions & 2 deletions api/v3/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function _civicrm_api3_contribute_format_params($params, &$values) {
* @throws Exception
*/
function civicrm_api3_contribution_sendconfirmation($params) {
$ids = $values = [];
$ids = [];
$allowedParams = [
'receipt_from_email',
'receipt_from_name',
Expand All @@ -405,7 +405,7 @@ function civicrm_api3_contribution_sendconfirmation($params) {
];
$input = array_intersect_key($params, array_flip($allowedParams));
$input['is_email_receipt'] = TRUE;
CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $params['id'], $values);
CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $params['id']);
}

/**
Expand Down

0 comments on commit 31e251e

Please sign in to comment.