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

CRM-19710 - Preserve is_email_receipt parameter through to email sent #9487

Closed
wants to merge 9 commits into from

Conversation

agileware
Copy link
Contributor

@agileware agileware commented Dec 2, 2016

//not really sure what params might be passed in but lets merge em into values
$values = array_merge($this->_gatherMessageValues($input, $values, $ids), $values);
$values = array_merge($this->_gatherMessageValues($input, $values, $ids), $tmp_values);
if (!empty($input['receipt_date'])) {
$values['receipt_date'] = $input['receipt_date'];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@agileware Can we assign $values after _gatherMessageValues() is done similar to receipt_date? Since we could avoid defining $tmp_values in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we can, but if any extra options are passed through in $values that differ from any options after _gatherMessageValues(), they'll be lost anyway.

e.g. If receipt_from_email is passed along in $values, but differs from whatever is retrieved after _gatherMessageValues().

Not sure if/when this would ever be a problem. If you think it's not an issue, let me know and we'll adjust the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's ditch this bit because I feel it's blocking the PR. That function is only called from here & ideally it would be dismantled into the calling function in bits e.g

extract this

    if ($this->address_id) {
      $addressParams = array('id' => $this->address_id);
      $addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id');
      $addressDetails = array_values($addressDetails);
    }
    // Else we assign the billing address of the contribution contact.
    else {
      $addressParams = array('contact_id' => $this->contact_id, 'is_billing' => 1);
      $addressDetails = (array) CRM_Core_BAO_Address::getValues($addressParams);
      $addressDetails = array_values($addressDetails);
    }

    if (!empty($addressDetails[0]['display'])) {
      $values['address'] = $addressDetails[0]['display'];
    }

into a function & call from composeMessageArray, ideally with tests, and possibly some review of how consistently that address token is used.

slow & painful, yes.

@@ -4684,6 +4694,7 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re
civicrm_api3('Contribution', 'sendconfirmation', array(
'id' => $contribution->id,
'payment_processor_id' => $paymentProcessorId,
'is_email_receipt' => $values['is_email_receipt'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the test failures are related to undefined index is_email_receipt here. Can you use CRM_Utils_Array::value('is_email_receipt', $values ) and check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like is_email_receipt wasn't included as part of the $allowedParams in sendconfirmation. Committed and will be included in the updated PR.

@jitendrapurohit
Copy link
Contributor

Test failures seems related - https://test.civicrm.org/job/CiviCRM-Core-PR/12878/testReport/

----------------------------------------
* CRM-19710: Preserve is_email_receipt parameter through to email sent
  https://issues.civicrm.org/jira/browse/CRM-19710
@@ -4684,6 +4695,7 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re
civicrm_api3('Contribution', 'sendconfirmation', array(
'id' => $contribution->id,
'payment_processor_id' => $paymentProcessorId,
'is_email_receipt' => (array_key_exists('is_email_receipt', $values) ? $values['is_email_receipt'] : 0),
Copy link
Contributor

Choose a reason for hiding this comment

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

@agileware Instead of using ternary operator, can we use existing function which does this ?

 'is_email_receipt' =>  CRM_Utils_Array::value('is_email_receipt', $values);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do. Updating now.

@agileware
Copy link
Contributor Author

agileware commented Dec 7, 2016

Latest test failed due to not being able to find the string '<p>Please print this receipt for your records.</p>'. Removed the tags. Resubmitting test.

@agileware
Copy link
Contributor Author

Last failing test was for a test we didn't write. Is ours okay to go?

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@agileware
Copy link
Contributor Author

Any movement on this one?

@jitendrapurohit
Copy link
Contributor

jenkins, retest this please

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Jan 9, 2017

@agileware The test failure https://test.civicrm.org/job/CiviCRM-Core-PR/13338/ is related to this PR.

@agileware
Copy link
Contributor Author

jenkins, retest this please

@agileware
Copy link
Contributor Author

(Couldn't get at results)

@eileenmcnaughton
Copy link
Contributor

test this please

Copy link
Contributor

@eileenmcnaughton eileenmcnaughton left a comment

Choose a reason for hiding this comment

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

ditch the one contentious line & I think this is good to go

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

@agileware I am proposing a replacement PR = #10000 - can you take a look? & spot the lucky number!

@agileware
Copy link
Contributor Author

Closing in favour of #10000

@agileware agileware closed this Mar 17, 2017
@eileenmcnaughton
Copy link
Contributor

Ohh I got a heart emoji! Not sure I've ever had one of them before :-)

nganivet pushed a commit to cividesk/civicrm-core that referenced this pull request May 6, 2021
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.

6 participants