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

Minor refactor preparatory to function extraction #12468

Merged
merged 1 commit into from
Jul 17, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Minor code simplication preparatory to function extraction

Before

$isPrimary is defined & is always TRUE & then used in an if. Detail relating to extraProperties is half way through the code that makes sense to extract.

After

$isPrimary removed, extraProperties code re-ordered

Technical Details

This is highly toxic code. We have some fixes to do but it needs many incremental cleanups first IMHO

Comments

@jitendrapurohit @monishdeb

@civibot
Copy link

civibot bot commented Jul 14, 2018

(Standard links)

@@ -487,7 +487,18 @@ public static function exportComponents(
}
}
else {
$primary = TRUE;
$extraProperties = self::defineExtraProperties($queryMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton not sure why the movement of these 4 lines as they should be done whether we have select fields or not i would have thought, I agree with L495 - L500 tho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seamuslee001 so moving them doesn't affect whether they are run or not - it just moves them to the outside of a code chunk they don't logically fit in the middle of

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 I updated this to remove the move of those lines - mostly because I have a new plan for them which means I'll probably address them before rather than after the follow up code extraction -(once #12485 is merged a whole lot of cleanup options open up)

'im_provider' => 1,
'phone_type_id' => 1,
'current_employer' => 1,
];
Copy link
Member

@colemanw colemanw Jul 17, 2018

Choose a reason for hiding this comment

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

I'm not sure what provider_id even is but it's missing from the diff. Was that omission intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yeah - it's a pseudonym for im_provider - I'll put it back until we figure out which one we don't need

@eileenmcnaughton
Copy link
Contributor Author

@colemanw updated ^^

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb are you ok to merge this - test fail has a fix in #12490

@monishdeb
Copy link
Member

Yes, did a quick check on my local after applying this patch and is safe to merge.

@monishdeb monishdeb merged commit 26cad78 into civicrm:master Jul 17, 2018
@eileenmcnaughton eileenmcnaughton deleted the export_return branch July 17, 2018 07:42
@eileenmcnaughton
Copy link
Contributor Author

thanks!

@jitendrapurohit
Copy link
Contributor

Just a note that this change manipulates the ordering of the columns in the exported CSV. Eg: The export used to start with the contact id before this PR.

image

'phone_type_id' => 1,
'provider_id' => 1,
'current_employer' => 1,
];
$fields = CRM_Contact_BAO_Contact::exportableFields('All', TRUE, TRUE);
foreach ($fields as $key => $var) {
if ($key && (substr($key, 0, 6) != 'custom')) {
Copy link
Contributor

@jitendrapurohit jitendrapurohit Jul 17, 2018

Choose a reason for hiding this comment

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

maybe, move(array_merge) the above initialization after this for loop?

@eileenmcnaughton
Copy link
Contributor Author

@jitendrapurohit ok I'll wait til other open related PRs are merged & then add a test + follow up on this

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.

6 participants