Skip to content

Improve Relink UI and add People Picker (CFM-125) #316

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/field.po
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ msgstr "Redirect on Duplicate"
msgid "EnrollmentFlows.redirect_on_finalize"
msgstr "Redirect on Finalize"

msgid "ExternalIdentities.target_person_id"
msgstr "Target Person"

msgid "ExternalIdentitySources.hash_source_record"
msgstr "Hash Source Records"

Expand Down
1 change: 1 addition & 0 deletions app/src/Controller/ExternalIdentitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function beforeRender(EventInterface $event) {
// Pull the Person name for breadcrumb rendering

$link = $this->getPrimaryLink(true);
$this->populateAutoViewVars();

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->ExternalIdentities->People->get($link->value));
Expand Down
10 changes: 10 additions & 0 deletions app/src/Model/Table/ExternalIdentitiesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ public function initialize(array $config): void {
'type' => 'enum',
// XXX maybe this (and EIRoles) should be SuspendableStatusEnum?
'class' => 'StatusEnum'
],
// Required for peoplePicker (for re-linking)
'cosettings' => [
'type' => 'auxiliary',
'model' => 'CoSettings'
],
// Required for peoplePicker (for re-linking)
'types' => [
'type' => 'auxiliary',
'model' => 'Types'
]
]);

Expand Down
31 changes: 27 additions & 4 deletions app/templates/ExternalIdentities/relink.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,32 @@
]);

print $this->Form->hidden('external_identity_id', ['default' => $vv_external_identity->id]);
// This label isn't localized, but it should go away when the UX is fixed
print $this->Form->control('target_person_id', ['type' => 'integer', 'label' => 'Target Person ID']);

print $this->Form->submit();
?>
<ul id="edit_ei-relink" class="fields form-list">
<?php
$vv_autocomplete_arguments = [
'fieldName' => 'target_person_id',
'fieldLabel' => __d('field', 'ExternalIdentities.target_person_id'),
'autocomplete' => [
'configuration' => [
'action' => 'GET',
'for' => 'co'
]
]
];
print $this->element('form/listItem', ['arguments' => $vv_autocomplete_arguments]);

?>
<li class="fields-submit">
<div class="field">
<div class="field-name">
</div>
<div class="field-info">
<?= $this->Form->submit() ?>
</div>
</div>
</li>
</ul>

<?php
print $this->Form->end();
2 changes: 1 addition & 1 deletion app/templates/element/form/listItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
declare(strict_types = 1);

// Make the element configuration available downstream
// XXX Unfortunately CAKEPHP doe not create a viewvar space for the element
// XXX Unfortunately CAKEPHP does not create a viewvar space for the element
// parameters. As a result we do not know which one is which unless we:
// - add a prefix and create a namespace
// - wrap them in an array.
Expand Down