// Use hook_civicrm_caseTypes to build a list of OptionValues
// In the long run, we may want more specialized logic for this, but
// this design is fairly convenient and will allow us to replace it
// without changing the hook_civicrm_caseTypes interface.
// Use hook_civicrm_caseTypes to build a list of OptionValues
// In the long run, we may want more specialized logic for this, but
// this design is fairly convenient and will allow us to replace it
// without changing the hook_civicrm_caseTypes interface.
'module' => $caseType['module'],
'name' => $caseType['name'],
'entity' => 'CaseType',
'module' => $caseType['module'],
'name' => $caseType['name'],
'entity' => 'CaseType',
'version' => 3,
'name' => $caseType['name'],
'title' => (string) $xml->name,
'version' => 3,
'name' => $caseType['name'],
'title' => (string) $xml->name,
* @see CRM_Utils_Hook::managed
*/
public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
* @see CRM_Utils_Hook::managed
*/
public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
$validActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
$actTypes = $xmlRepo->getAllDeclaredActivityTypes();
foreach ($actTypes as $actType) {
$validActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
$actTypes = $xmlRepo->getAllDeclaredActivityTypes();
foreach ($actTypes as $actType) {
'module' => 'civicrm',
'name' => "civicase:act:$actType",
'entity' => 'OptionValue',
'update' => 'never',
'cleanup' => 'unused',
'module' => 'civicrm',
'name' => "civicase:act:$actType",
'entity' => 'OptionValue',
'update' => 'never',
'cleanup' => 'unused',
'version' => 3,
'option_group_id' => 'activity_type',
'label' => $actType,
'name' => $actType,
'description' => $actType,
'component_id' => 'CiviCase',
'version' => 3,
'option_group_id' => 'activity_type',
'label' => $actType,
'name' => $actType,
'description' => $actType,
'component_id' => 'CiviCase',
// We'll create managed-entity if this record doesn't exist yet
// or if we previously decided to manage this record.
// We'll create managed-entity if this record doesn't exist yet
// or if we previously decided to manage this record.
* @see CRM_Utils_Hook::managed
*/
public static function createManagedRelationshipTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
* @see CRM_Utils_Hook::managed
*/
public static function createManagedRelationshipTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me) {
if (!isset(Civi::$statics[__CLASS__]['reltypes'])) {
$relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE, NULL);
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);
+ foreach ($relationshipInfo as $id => $relTypeDetails) {
+ Civi::$statics[__CLASS__]['reltypes']["{$id}_a_b"] = $relTypeDetails['label_a_b'];
+ if ($relTypeDetails['label_a_b'] != $relTypeDetails['label_b_a']) {
+ Civi::$statics[__CLASS__]['reltypes']["{$id}_b_a"] = $relTypeDetails['label_b_a'];
+ }
+ }
}
$validRelTypes = Civi::$statics[__CLASS__]['reltypes'];
$relTypes = $xmlRepo->getAllDeclaredRelationshipTypes();
foreach ($relTypes as $relType) {
}
$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",
'entity' => 'RelationshipType',
'update' => 'never',
'cleanup' => 'unused',
'module' => 'civicrm',
'name' => "civicase:rel:$relType",
'entity' => 'RelationshipType',
'update' => 'never',
'cleanup' => 'unused',
'version' => 3,
'name_a_b' => "$relType is",
'name_b_a' => $relType,
'label_a_b' => "$relType is",
'label_b_a' => $relType,
'description' => $relType,
'version' => 3,
'name_a_b' => "$relType is",
'name_b_a' => $relType,
'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,
'contact_sub_type_a' => NULL,
'contact_sub_type_b' => NULL,
// We'll create managed-entity if this record doesn't exist yet
// or if we previously decided to manage this record.
// We'll create managed-entity if this record doesn't exist yet
// or if we previously decided to manage this record.