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

php/smarty notices on contribution view part 2 #22869

Merged

Conversation

demeritcowboy
Copy link
Contributor

Overview

Some variables not defined when viewing a contribution.

Before

Notice: Undefined index: pricesetFieldsCount in include() (line 124 of ...\templates_c\en_US\%%F2\F21\F21A46C1%%LineItem.tpl.php).
Notice: Undefined index: hookDiscount in include() (line 150 of ...\templates_c\en_US\%%F2\F21\F21A46C1%%LineItem.tpl.php).

... and more.

After

Still some more.

Technical Details

Comments

I've left currencySymbol in for now. I'm not a javascript expert but is this function even callable?

function moneyFormat(amount) {

@civibot
Copy link

civibot bot commented Mar 2, 2022

(Standard links)

@civibot civibot bot added the master label Mar 2, 2022
@@ -44,6 +44,16 @@ public function preProcess() {
$values = (array) $contribution;
$contributionStatus = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $values['contribution_status_id']);

if (!isset($this->get_template_vars()['hookDiscount'])) {
$this->assign('hookDiscount', ['message' => '']);
Copy link
Contributor

Choose a reason for hiding this comment

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

urgh but ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Looking at it now maybe another way would be to just add hookDiscount in the expected smarty vars below, and then update the if in the template so it's {if $hookDiscount && $hookDiscount.message} instead of {if $hookDiscount.message}. I think I still have one more round before the other PR will pass so I will probably do that.

@seamuslee001 seamuslee001 merged commit d7d1dc9 into civicrm:master Mar 2, 2022
@demeritcowboy demeritcowboy deleted the contributionview-notices2 branch March 2, 2022 22:36
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