Update BillingBlock.tpl - Error with CiviDiscount + Patch Issue #24781 #26064
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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