-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Conversation
ITturns out the addition of a unique name at some point caused is_override not to be passed in inn a way the BAO recognises - the api has handling for this...
(Standard links)
|
@@ -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); |
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
'userId' => $session->get('userID'), | ||
]; | ||
$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 comment
The 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
// @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 comment
The reason will be displayed to describe this comment to others. Learn more.
userId goes to modified it - which will default to this anyway
Merging as per review |
Overview
Fix for https://lab.civicrm.org/dev/membership/-/issues/30 whereby is_override is ignored on import
Before
Steps in the gitlab but TLDR = 'is_override' column does not reach the BAO as 'is_override' but as 'member_is_override' - whic the BAO ignores
After
Api handles unique names by passing both the the BAO - we could strip out a lot of the function now....
Technical Details
It turns out the addition of a unique name at some point caused is_override not to be passed in
inn a way the BAO recognises - the api has handling for this...
Comments
Tests in
CRM_Member_Import_Parser_MembershipTest
look like they should have detected this but didn't