-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
dev/membership#30 switch Membership import to use the v3 api #18821
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,9 +308,6 @@ public function import($onDuplicate, &$values) { | |
$params[$key] = $this->parsePseudoConstantField($val, $this->fieldMetadata[$key]); | ||
break; | ||
|
||
case 'member_is_override': | ||
$params[$key] = CRM_Utils_String::strtobool($val); | ||
break; | ||
} | ||
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { | ||
if ($customFields[$customFieldID]['data_type'] == 'Date') { | ||
|
@@ -371,20 +368,9 @@ public function import($onDuplicate, &$values) { | |
CRM_Price_BAO_LineItem::getLineItemArray($formatted, NULL, 'membership', $formatted['membership_type_id']); | ||
} | ||
|
||
// @todo stop passing $ids array (and put details in $formatted if required) | ||
$ids = [ | ||
'membership' => $formatValues['membership_id'], | ||
'userId' => $session->get('userID'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. userId goes to modified it - which will default to this anyway |
||
]; | ||
$newMembership = CRM_Member_BAO_Membership::create($formatted, $ids, TRUE); | ||
if (civicrm_error($newMembership)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exceptions are caught further down in the function as the api is used elsewhere in this class |
||
array_unshift($values, $newMembership['is_error'] . ' for Membership ID ' . $formatValues['membership_id'] . '. Row was skipped.'); | ||
return CRM_Import_Parser::ERROR; | ||
} | ||
else { | ||
$this->_newMemberships[] = $newMembership->id; | ||
return CRM_Import_Parser::VALID; | ||
} | ||
$newMembership = civicrm_api3('Membership', 'create', $formatted); | ||
$this->_newMemberships[] = $newMembership['id']; | ||
return CRM_Import_Parser::VALID; | ||
} | ||
else { | ||
array_unshift($values, 'Matching Membership record not found for Membership ID ' . $formatValues['membership_id'] . '. Row was skipped.'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api handles this validation