Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
00538ec6
Commit
00538ec6
authored
6 years ago
by
jitendra
Browse files
Options
Downloads
Patches
Plain Diff
#154
- Can't edit related records when current employer has a pending membership
check for pending status instead of pay later
parent
bc99a11f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Contact/BAO/Relationship.php
+4
-0
4 additions, 0 deletions
CRM/Contact/BAO/Relationship.php
tests/phpunit/api/v3/MembershipTest.php
+22
-0
22 additions, 0 deletions
tests/phpunit/api/v3/MembershipTest.php
with
26 additions
and
0 deletions
CRM/Contact/BAO/Relationship.php
+
4
−
0
View file @
00538ec6
...
...
@@ -1736,6 +1736,10 @@ SELECT relationship_type_id, relationship_direction
//contact before creating new membership record.
CRM_Member_BAO_Membership
::
deleteRelatedMemberships
(
$membershipId
,
$relatedContactId
);
}
//skip status calculation for pay later memberships.
if
(
!
empty
(
$membershipValues
[
'status_id'
])
&&
$membershipValues
[
'status_id'
]
==
$pendingStatusId
)
{
$membershipValues
[
'skipStatusCal'
]
=
TRUE
;
}
// check whether we have some related memberships still available
$query
=
"
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/MembershipTest.php
+
22
−
0
View file @
00538ec6
...
...
@@ -631,6 +631,28 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
$result
=
$this
->
callAPISuccess
(
'membership'
,
'get'
,
$params
);
$this
->
assertEquals
(
0
,
$result
[
'count'
]);
//Create pay_later membership for organization.
$employerId
[
2
]
=
$this
->
organizationCreate
(
array
(),
1
);
$params
=
array
(
'contact_id'
=>
$employerId
[
2
],
'membership_type_id'
=>
$membershipTypeId
,
'source'
=>
'Test pay later suite'
,
'is_pay_later'
=>
1
,
'status_id'
=>
5
,
);
$organizationMembership
=
CRM_Member_BAO_Membership
::
add
(
$params
);
$organizationMembershipID
=
$organizationMembership
->
id
;
$memberContactId
[
3
]
=
$this
->
individualCreate
(
array
(
'employer_id'
=>
$employerId
[
2
]),
0
);
// Check that the employee inherited the membership
$params
=
array
(
'contact_id'
=>
$memberContactId
[
3
],
'membership_type_id'
=>
$membershipTypeId
,
);
$result
=
$this
->
callAPISuccess
(
'membership'
,
'get'
,
$params
);
$this
->
assertEquals
(
1
,
$result
[
'count'
]);
$result
=
$result
[
'values'
][
$result
[
'id'
]];
$this
->
assertEquals
(
$organizationMembershipID
,
$result
[
'owner_membership_id'
]);
// Set up params for enable/disable checks
$relationship1
=
$this
->
callAPISuccess
(
'relationship'
,
'get'
,
array
(
'contact_id_a'
=>
$memberContactId
[
1
]));
$params
=
array
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment