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

Update BillingBlock.tpl - Error with CiviDiscount + Patch Issue #24781 #26064

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

GreysonStalcup
Copy link
Contributor

Fixes a bug where @count is an expecting an array to count but may not be given one in every case. when using CiviDiscount with the patch from issue #24781

Overview

An error, introduced when using the Stripe payment processor along with multi-participant registration, was fixed with a patch moving the payment block to the review page. However, this, when mixed with CiviDiscount, caused an error with the BillingBlock.tpl file. This simple addition checks to see if the variable is set before attempting to count it.

Before

Immediately begins to check $paymentFields|@count & $billingDetailFields|@count.

After

Checks the validity of $paymentFields -> proceeds to $paymentFields|@count || same with $billingDetailFields -> moves to $billingDetailFields|@count.

Technical Details

Minimal change, prevents an error being thrown and TPL breaking when the discount button is clicked.

Comments

This has to do with the issue: issue #24781

@civicrm-builder
Copy link

Can one of the admins verify this patch?

1 similar comment
@civicrm-builder
Copy link

Can one of the admins verify this patch?

@civibot
Copy link

civibot bot commented Apr 14, 2023

(Standard links)

@colemanw
Copy link
Member

@GreysonStalcup I think an even more minimal fix here would be to simply remove the |@count as it's meaningless in the context of an if statement. Empty arrays are already equivalent to false, so counting them does nothing.

@GreysonStalcup
Copy link
Contributor Author

@GreysonStalcup I think an even more minimal fix here would be to simply remove the |@count as it's meaningless in the context of an if statement. Empty arrays are already equivalent to false, so counting them does nothing.

@colemanw I think that makes total sense. I added a new commit to this PR without the @count, just checking for the existence of those variables. Should have done that to begin with honestly. Apologies, I am not the best with smarty 😅

@colemanw
Copy link
Member

Ok great. FYI in the future you can do git commit --amend and git push -f to keep your PR to a single commit.
But it's still fixable, you can do git rebase -i HEAD~2 and put s on the 2nd line. Then when the 2 commits are squashed you can get push -f and the PR will be nice & clean :)

Fixes a bug where @count is an expecting an array to count but may not be given one in every case.
@colemanw
Copy link
Member

@civicrm-builder add to whitelist

@colemanw colemanw merged commit 1e123f8 into civicrm:master Apr 17, 2023
@colemanw
Copy link
Member

Great, thanks @GreysonStalcup for working on this!

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.

3 participants