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-18467 Set amount to appear on pay-later receipt #8227

Closed
wants to merge 1 commit into from

Conversation

kenwest
Copy link
Contributor

@kenwest kenwest commented Apr 25, 2016

The amount is passed to this function as $form->_params['amount']

If $form->_values['amount'] is not set, then the Amount won't print on the receipt.

The previous if-statement handles the case when the amount is zero. So this elseif checks whether $form->_values['amount'] is empty, and if it is, copies the amount into it.


@eileenmcnaughton
Copy link
Contributor

We really need to lock these things in with tests - otherwise these things will just change & start failing again.... can I help you write a unit test?

@kenwest
Copy link
Contributor Author

kenwest commented Apr 26, 2016

Sure Eileen. Perhaps you could point me at one that I could copy and modify?

@eileenmcnaughton
Copy link
Contributor

Assuming you are working on a front end page this is probably a good starting point https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php#L139

@eileenmcnaughton
Copy link
Contributor

As an aside I have a preference for NOT adding parameters to the $form_values but passing to the next function with an array merge or by doing $sendParams = $form->_values; $sendParams['amount'] = ...

The reason being that things get passed all over the place in post processing & then people tack logic onto them - so I try to reduce the number of things that are set & available in other functions despite not being required in those functions. This is more about how to bring CiviCRM back from where it is than a general coding rule

@monishdeb
Copy link
Member

Closing in favor of #8391

@monishdeb monishdeb closed this May 17, 2016
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.

4 participants