Skip to content
Snippets Groups Projects
Unverified Commit cbec685e authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #18821 from eileenmcnaughton/531im

membership#30 switch Membership import to use the v3 api
parents b2860edb f3a5127d
No related branches found
No related tags found
No related merge requests found
......@@ -308,9 +308,6 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
$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 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
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'),
];
$newMembership = CRM_Member_BAO_Membership::create($formatted, $ids, TRUE);
if (civicrm_error($newMembership)) {
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.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment