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

[REF] minor code simplification - remove over-handling of amount comp with zero #13783

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Very minor code simplification

Before

Code less readable

After

Code more readable

Technical Details

This just removes the duplicate assign codes & simplifies the <=0 condition

Comments

This just removes the duplicate assign codes & simplifies the /bin/bash condition
@civibot
Copy link

civibot bot commented Mar 7, 2019

(Standard links)

@civibot civibot bot added the master label Mar 7, 2019
@eileenmcnaughton eileenmcnaughton changed the title [REF] minor code simplification [REF] minor code simplification - remove over-handling of amount comp with zero Mar 10, 2019
@@ -596,20 +596,17 @@ public function buildQuickForm() {
// the is_monetary concept probably should be too as it can be calculated from
// the existence of 'amount' & seems fragile.
if ($this->_contributeMode == 'notify' ||
$this->_amount < 0.0 || $this->_params['is_pay_later'] ||
($this->_separateMembershipPayment && $this->_amount <= 0.0)
$this->_amount <= 0.0 || $this->_params['is_pay_later']
Copy link
Contributor

Choose a reason for hiding this comment

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

Worst case we'd end up with the wrong text on a button so this is pretty low risk! What would we need to do to get rid of _contributeMode here?

Also, looks like the is_monetary comment no longer applies and should be removed. Can the _contributeMode comment get a fixme/todo tag?

}
$this->assign('button', $contribButton);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes to these changes.

@mattwire
Copy link
Contributor

@eileenmcnaughton This is good to merge pending my comments about the comments.

@eileenmcnaughton
Copy link
Contributor Author

@mattwire I'm gonna merge this as a simplification - I'm not quite sure what to put in the 'comments' as yet because part of my hope is that we can simplify further - ie. can we get away from having 3 different button names?

@eileenmcnaughton eileenmcnaughton merged commit b8ace46 into civicrm:master Mar 12, 2019
@eileenmcnaughton eileenmcnaughton deleted the confirm_btn branch March 12, 2019 20:34
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.

2 participants