Skip to content

Add EIS badges to Person Canvas (CFM-417) #364

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

arlen
Copy link
Contributor

@arlen arlen commented Jan 20, 2026

This PR adds External Identity Source descriptions to MVEAs on the person canvas (see screenshot). It does not currently take into account "Name" MVEAs, however. (And this PR will be marked as draft until that's addressed.)

image

@@ -90,6 +90,29 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_default_name_type', $settings->default_name_type_id);
}

if(!$this->request->is('restful') && $this->request->getParam('action') == 'edit') {
// Get the external identity sources for this person
$externalIdentitySources = $this->fetchTable('ExternalIdentities')
Copy link
Contributor

@benno benno Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look above we use TableRegistry and then run the find on the table as a second action. This is a bit more general of a solution (less work in contexts where we run multiple actions on a table, more generic where fetchTable() isn't a thing) though some older code does still use fetchTable(). Minimally, adjacent code shouldn't do the same thing two different ways.

Comment on lines 97 to 112
->where(['ExternalIdentities.person_id' => $this->request->getParam('pass.0')])
->contain([
'ExtIdentitySourceRecords' => [
'ExternalIdentitySources'
]
])
->all();

// Create a lookup table for badging EIS descriptions on Person Canvas MVEAS
$eisLookupTable = [];
foreach ($externalIdentitySources as $extIdentity) {
if (!empty($extIdentity->ext_identity_source_record) &&
!empty($extIdentity->ext_identity_source_record->external_identity_source)) {
$eisLookupTable[$extIdentity->id] = $extIdentity->ext_identity_source_record->external_identity_source->description;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your query will be simpler if you always pull all EIS for the CO, instead of walking from the Person to the EIS Records that the Person is associated with. ie: you're doing more work to get a more exact answer, but it's probably an over-optimization. Something like

$ExternalIdentitySources = TableRegistry::getTableLocator()->get('ExternalIdentitySources');

$eis = $ExternalIdentitySources->find()->where('co_id' => $this->getCOID();

You can then use Cake's Hash utility to create your lookup table. I believe combine() will do what you want, but you should figure it out yourself because it will be a good learning experience :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reworked the query completely to produce the lookup table - including a switch to the TableRegistry approach. I still need to be able to relate the External Identity id with the External Identity Source description, and the new code does this more efficiently.

@arlen arlen force-pushed the feature-cfm417-eisBadgesPersonCanvas branch from 2ee926a to d2585be Compare January 28, 2026 13:41
@arlen arlen force-pushed the feature-cfm417-eisBadgesPersonCanvas branch from e4988db to d4d04e4 Compare February 17, 2026 19:04
@arlen
Copy link
Contributor Author

arlen commented Feb 17, 2026

The query to pull the External Identity Sources has been reworked using the TableRegistry and finding a list (to produce the lookup table in one shot).

@arlen arlen marked this pull request as ready for review February 17, 2026 19:07
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants