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

CRM-19386: Retrieve Activities custom fields in import parser #9072

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

jeromelebleu
Copy link
Contributor

@jeromelebleu jeromelebleu commented Sep 19, 2016

Custom fields for Activities should be retrieved - as it's done in CRM/Activity/Import/Parser.php - instead of contact ones when importing activities. Should it also filter custom fields on the activity_type_id?


@civicrm-builder
Copy link

Can one of the admins verify this patch?

@colemanw
Copy link
Member

jenkins, ok to test

@@ -267,7 +267,7 @@ public function import($onDuplicate, &$values) {
$params['source_contact_id'] = $session->get('userID');
}

$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
$customFields = CRM_Core_BAO_CustomField::getFields('Activity');
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure the contact custom fields will never be needed? If not, you could array_merge both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for my late answer... I don't know enough the CiviCRM code to tell if it will never be used. However, during all my tests the $params array never contained an contact_type key and I don't know where it could be defined elsewhere - and for which purpose since we are importing activities here, but I'm maybe wrong.

I could array_merge both as you suggest to be sure that it'll not introduce another bug. It's just that it will produce at least one more - and maybe useless - MySQL query.

Tell me what I have to do! :)

@colemanw
Copy link
Member

@civicrm-builder add to whitelist

@eileenmcnaughton
Copy link
Contributor

It took a look at whether it is possible to import contact fields on the activity import and they don't show up, so I'm pretty sure the line that was altered was a never-worked-copy-and-paste ug.

screenshot 2017-03-08 20 26 41

Merging based on @Stoob's testing and above analysis of safety

@eileenmcnaughton eileenmcnaughton dismissed colemanw’s stale review March 8, 2017 07:31

Per comments, I can't see any evidence it is possible to import contact custom fields

@eileenmcnaughton eileenmcnaughton merged commit 635c56f into civicrm:master Mar 8, 2017
monishdeb pushed a commit to monishdeb/civicrm-core that referenced this pull request May 2, 2017
CRM-19386: Retrieve Activities custom fields in import parser
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.

4 participants