Skip to content

Commit

Permalink
Merge pull request #23866 from civicrm/5.51
Browse files Browse the repository at this point in the history
5.51 to master
  • Loading branch information
eileenmcnaughton authored Jun 22, 2022
2 parents 3786535 + f228e2c commit c558802
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ public static function processOnBehalfOrganization(&$behalfOrganization, &$conta
\Civi\Api4\Relationship::create(FALSE)
->addValue('contact_id_a', $contactID)
->addValue('contact_id_b', $orgID)
->addValue('relationship_type_id', $relTypeId = CRM_Contact_BAO_RelationshipType::getEmployeeRelationshipTypeID())
->addValue('relationship_type_id', CRM_Contact_BAO_RelationshipType::getEmployeeRelationshipTypeID())
->addValue('is_permission_a_b:name', 'View and update')
->execute();
}
Expand Down
18 changes: 15 additions & 3 deletions CRM/Core/SelectValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,21 @@ public static function activityTextOptions() {
*/
public static function getPermissionedRelationshipOptions() {
return [
CRM_Contact_BAO_Relationship::NONE => ts('None'),
CRM_Contact_BAO_Relationship::VIEW => ts('View only'),
CRM_Contact_BAO_Relationship::EDIT => ts('View and update'),
[
'id' => CRM_Contact_BAO_Relationship::NONE,
'name' => 'None',
'label' => ts('None'),
],
[
'id' => CRM_Contact_BAO_Relationship::VIEW,
'name' => 'View only',
'label' => ts('View only'),
],
[
'id' => CRM_Contact_BAO_Relationship::EDIT,
'name' => 'View and update',
'label' => ts('View and update'),
],
];
}

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/api/v4/Entity/RelationshipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testRelCacheCount() {
$this->assertCount(2, $cacheRecords);
}

public function testRelCacheCalcFields() {
public function testRelationshipCacheCalcFields(): void {
$c1 = Contact::create(FALSE)->addValue('first_name', '1')->execute()->first()['id'];
$c2 = Contact::create(FALSE)->addValue('first_name', '2')->execute()->first()['id'];
$relationship = Relationship::create(FALSE)
Expand All @@ -57,7 +57,7 @@ public function testRelCacheCalcFields() {
'relationship_type_id' => 1,
'description' => "Wow, we're related!",
'is_permission_a_b' => 1,
'is_permission_b_a' => 2,
'is_permission_b_a:name' => 'View only',
])->execute()->first();
$relationship = Relationship::get(FALSE)
->addWhere('id', '=', $relationship['id'])
Expand Down

0 comments on commit c558802

Please sign in to comment.