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-20875 - Fix membership import to avoid notice error to be thrown #10664

Merged
merged 1 commit into from
Jul 24, 2017

Conversation

jitendrapurohit
Copy link
Contributor

@jitendrapurohit jitendrapurohit commented Jul 14, 2017

@seamuslee001
Copy link
Contributor

This looks sensible to me @eileenmcnaughton does it make sense to you? @jitendrapurohit is there anyway to get a test added to this?

@@ -279,7 +279,8 @@ public function import($onDuplicate, &$values) {
$session = CRM_Core_Session::singleton();
$dateType = $session->get('dateTypes');
$formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
$customDataType = !empty($params['contact_type']) ? $params['contact_type'] : 'Membership';
$customFields = CRM_Core_BAO_CustomField::getFields($customDataType);
Copy link
Member

Choose a reason for hiding this comment

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

onto single line change by

 $customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params, 'Membership'));

If $customDataType is not used below

@monishdeb
Copy link
Member

I think in case of notice error or any user warning we can avoid adding UT unless it's affecting the workflow. Still it's always good to have test coverage wherever it's possible

@eileenmcnaughton
Copy link
Contributor

I agree that @monishdeb change to one line is nicer - but I think it is minimal enough I don't think this needs to be held on that.

Re unit tests - once again I agree that they are preferable. However, I also acknowledge that this is a very small change & I'm going to merge it

@eileenmcnaughton eileenmcnaughton merged commit 29a2319 into civicrm:master Jul 24, 2017
@jitendrapurohit jitendrapurohit deleted the CRM-20875 branch July 24, 2017 02:34
@jitendrapurohit
Copy link
Contributor Author

@monishdeb Apologies for not pushing the one-liner for the change. I thought of testing it on php7 and then update, but somehow missed.

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.

5 participants