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

Replace all isset checks on line.tax_rate #22421

Merged
merged 2 commits into from
Jan 11, 2022
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jan 8, 2022

Overview

Replace all isset checks on line.tax_rate

Before

isset checks fail when smarty default modifier is on - the value is always set

if (isset($lineItems[$dao->id]['financial_type_id']) && array_key_exists($lineItems[$dao->id]['financial_type_id'], $taxRates)) {
// Cast to float so trailing zero decimals are removed for display.
$lineItems[$dao->id]['tax_rate'] = (float) $taxRates[$lineItems[$dao->id]['financial_type_id']];
}
else {
// There is no Tax Rate associated with this Financial Type
$lineItems[$dao->id]['tax_rate'] = FALSE;
}

  • although tests might reveal a flow in which that is not true....

After

Simple check for truthy - it should be a float or FALSE

Technical Details

I'm not planning on doing any upgrade change for this - for most sites it is an immaterial difference so better to wait until a material change comes along

Comments

@civibot
Copy link

civibot bot commented Jan 8, 2022

(Standard links)

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