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

Reduce PHP warnings with paymentBlock #26505

Merged

Conversation

larssandergreen
Copy link
Contributor

@larssandergreen larssandergreen commented Jun 10, 2023

Overview

This reduces the PHP warnings on the backend when using paymentBlock.tpl.
First, by not adding any of the unnecessary JS to show/hide the payment block when on the backend.
Second, by not checking $contributionPageID and $custom_pre_id when on the backend.

Still more to do here in the future, but this is a step forwards.

@civibot
Copy link

civibot bot commented Jun 10, 2023

(Standard links)

@civibot civibot bot added the master label Jun 10, 2023
{capture assign='contributionPageID'}id={$contributionPageID}&{/capture}
{else}
{capture assign='pageID'}{/capture}
{capture assign='contributionPageID'}{/capture}
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused by this. Is it defining an empty variable to avoid notices?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what it's doing. Seems like a weird way to go about this, but I'm not aiming to change that.

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why this variable needs to be renamed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, there are five variables used to build the dataUrl at 106. Each is defined here in the same way in an if-else block that assigns the value if it exists or nothing if not.
This one was wrong, because it used PageID instead of ContributionPageID in the else. PageID is not a variable used anywhere else here. I'm just correcting that error, so that if there is no ContributionPageID, the variable is still assigned.

@colemanw colemanw merged commit fcd1999 into civicrm:master Jul 3, 2023
@colemanw
Copy link
Member

colemanw commented Jul 3, 2023

Ok I agree this is a step forward.

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