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] Extract & stdise AmountBlockIsActive #22291

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Dec 21, 2021

Overview

[REF] Extract & stdise AmountBlockIsActive

Before

The amount_block_is_active value is a bit of a mystery. I had to deep dive to figure out what it meant.

After

The value is accessed from a more descriptive function and the comment block provides more detail

Technical Details

Part of trying to stop passing known values around and rather retrieve them via functions - eg pass to isSeparateMembershipTransaction

  • that function should require no input params & be callable with consistent results anywhere

Comments

@civibot civibot bot added the master label Dec 21, 2021
@civibot
Copy link

civibot bot commented Dec 21, 2021

(Standard links)

@@ -487,8 +487,7 @@ public function buildQuickForm() {
$this->buildCustom($this->_values['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes);
}
$this->assign('receiptFromEmail', $this->_values['receipt_from_email'] ?? NULL);
$amount_block_is_active = $this->get('amount_block_is_active');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

set in preProcess - but preProcess also ensure the _values value is set so why have 2 ways?

}
// This can probably go as nothing it 'getting it' anymore since the values data is loaded
// on every form, rather than being passed from form to form.
$this->set('amount_block_is_active', $this->isFormSupportsNonMembershipContributions());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was in 2 minds on commenting vs removing

@@ -365,7 +365,6 @@ public function preProcess() {

// this avoids getting E_NOTICE errors in php
$setNullFields = [
'amount_block_is_active',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the function to interact with this handles the possibility of it not being set we don't need this enotice prevention

It took me a bit to figure out what it even meant - so extracted into a function which can provide explanation.

Part of trying to stop passing known values around - see pass to isSeparateMembershipTransaction
- that function should require no input params & be callable with consistent results anywhere
@mattwire mattwire merged commit 5dc0b4a into civicrm:master Mar 9, 2022
@eileenmcnaughton eileenmcnaughton deleted the amount_block branch March 9, 2022 22:58
@eileenmcnaughton
Copy link
Contributor Author

thanks @mattwire

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