X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCase%2FManagedEntities.php;h=be0d846cb169b0f80bf60f9832feec09ae79c959;hb=00470c3a9e109927a6b2d6f4287387060ac21dc9;hp=461b51f5dafc78929b7c99b7452bf9337fd8dcbd;hpb=a6491ceec03e64e45e127222ae268187c652f5b7;p=civicrm-core.git diff --git a/CRM/Case/ManagedEntities.php b/CRM/Case/ManagedEntities.php index 461b51f5da..be0d846cb1 100644 --- a/CRM/Case/ManagedEntities.php +++ b/CRM/Case/ManagedEntities.php @@ -111,13 +111,24 @@ class CRM_Case_ManagedEntities { $result = []; if (!isset(Civi::$statics[__CLASS__]['reltypes'])) { - $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE, NULL); - Civi::$statics[__CLASS__]['reltypes'] = CRM_Utils_Array::collect(CRM_Case_XMLProcessor::REL_TYPE_CNAME, $relationshipInfo); + $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('name', TRUE, NULL); + foreach ($relationshipInfo as $id => $relTypeDetails) { + Civi::$statics[__CLASS__]['reltypes']["{$id}_a_b"] = $relTypeDetails['name_a_b']; + if ($relTypeDetails['name_a_b'] != $relTypeDetails['name_b_a']) { + Civi::$statics[__CLASS__]['reltypes']["{$id}_b_a"] = $relTypeDetails['name_b_a']; + } + } } $validRelTypes = Civi::$statics[__CLASS__]['reltypes']; $relTypes = $xmlRepo->getAllDeclaredRelationshipTypes(); foreach ($relTypes as $relType) { + // Making assumption that client is the A side of the relationship. + // Relationship label coming from XML, meaning from perspective of + // non-client. + + // These assumptions only apply if a case type is introduced without the + // relationship types already existing. $managed = [ 'module' => 'civicrm', 'name' => "civicase:rel:$relType", @@ -131,8 +142,8 @@ class CRM_Case_ManagedEntities { 'label_a_b' => "$relType is", 'label_b_a' => $relType, 'description' => $relType, - 'contact_type_a' => 'Individual', - 'contact_type_b' => 'Individual', + 'contact_type_a' => NULL, + 'contact_type_b' => NULL, 'contact_sub_type_a' => NULL, 'contact_sub_type_b' => NULL, ],