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

REF Don't check if id is set in ContributionView form - it's required #21274

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

mattwire
Copy link
Contributor

Overview

Following on from work by @jaapjansma around template contributions I'm looking to simplify the contribution view so it always displays "lineitems" - see https://github.com/civicrm/civicrm-core/compare/master...mattwire:contributionviewlineitems?expand=1

However, as a pre-requisite to that I found that $id is a required parameter to preProcess() but if ($id) is being used in some places in the function. This cleans that up, making it clear that $id is required and not doing additional checks to see if $id is set.

Before

Unnecessary checks. Unclear if $id is required without checking functions where it is a param.

After

$id is clearly always required.

Technical Details

Comments

Review with w=1 in URL to hide whitespace changes.

@civibot
Copy link

civibot bot commented Aug 26, 2021

(Standard links)

@civibot civibot bot added the master label Aug 26, 2021
@@ -177,7 +174,7 @@ public function preProcess() {
}

// assign values to the template
$this->assign($values);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not supposed to work because assign takes a key + value as params. But somehow it manages to work because most of the fields on the form come from this array. Replaced with assignVariables which is actually meant to do what it does.

@seamuslee001
Copy link
Contributor

This all seems fine to me MOP

@seamuslee001 seamuslee001 merged commit 75f7801 into civicrm:master Aug 27, 2021
@mattwire mattwire deleted the contributionviewid branch August 27, 2021 09:28
@mattwire
Copy link
Contributor Author

Thanks @seamuslee001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants