Skip to content

Commit

Permalink
External Identity Source Records
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Nov 24, 2025
1 parent 7550520 commit 6e831c5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/plugins/Transmogrify/config/schema/tables.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,5 +591,20 @@
"eppn_suffix": null,
"org_identity_source_id": "external_identity_source_id"
}
},
"ext_identity_source_records": {
"source": "cm_org_identity_source_records",
"displayField": "id",
"cache": ["org_identity_id", "sorid"],
"preRow": "findAdoptedPersonByLinkedOrgIdentityId",
"fieldMap": {
"org_identity_source_id": "external_identity_source_id",
"sorid": "source_key",
"org_identity_id": "external_identity_id",
"co_petition_id": null,
"co_person_id": "adopted_person_id",
"reference_identifier": "reference_identifier",
"org_identity_source_record_id": "ext_identity_source_record_id"
}
}
}
40 changes: 40 additions & 0 deletions app/plugins/Transmogrify/src/Lib/Traits/TypeMapperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,46 @@ trait TypeMapperTrait
'dateOfBirth' => '',
];


/**
* Find and set adopted person ID based on linked external/org identity ID
*
* Attempts to find the associated CO Person ID using either external_identity_id
* or org_identity_id from either original or current row data. If found, updates
* the co_person_id in the original row.
*
* @param array &$origRow Original row data by reference
* @param array &$row Current row data by reference
* @return void
* @throws Exception
* @since COmanage Registry v5.2.0
*/
protected function findAdoptedPersonByLinkedOrgIdentityId(array &$origRow, array &$row): void
{
// Try to locate an external identity (or legacy org identity) id from either array
$externalIdentityId = null;

if (!empty($row['external_identity_id'])) {
$externalIdentityId = (int)$row['external_identity_id'];
} elseif (!empty($origRow['org_identity_id'])) {
$externalIdentityId = (int)$origRow['org_identity_id'];
} elseif (!empty($row['org_identity_id'])) {
$externalIdentityId = (int)$row['org_identity_id'];
}

$personId = null;

if ($externalIdentityId !== null) {
$personId = $this->mapOrgIdentityCoPersonId(['id' => $externalIdentityId]);
}


$row['co_person_id'] = null;
if ($personId !== null) {
$row['co_person_id'] = $personId;
}
}

/**
* Map address type to corresponding type ID
*
Expand Down

0 comments on commit 6e831c5

Please sign in to comment.