Skip to content

Commit

Permalink
Fix Primary Name error (CFM-494)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Dec 18, 2025
1 parent f0b5328 commit 7651e88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
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 @@ -848,6 +848,9 @@ msgstr "Subject (Group)"
msgid "Notifications.subject_person_id"
msgstr "Subject (Person)"

msgid "People.name.type_id"
msgstr "Name Type"

msgid "Petitions.enrollee_email"
msgstr "Enrollee Email Address"

Expand Down
6 changes: 5 additions & 1 deletion app/src/Model/Table/PeopleTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ public function findIndexed(Query $query): Query {

public function generateDisplayField(Person $entity): string {
if(empty($entity->primary_name)) {
throw new \InvalidArgumentException(__d('error', 'Names.primary_name'));
// Adding a new Person manually will generate an empty Person entity (with no Primary Name),
// which the Breadcrumbs logic (more specifically entityAndActionToTitle) will eventually
// pass here.

return __d('controller', 'People', [1]);
}

return $entity->primary_name->full_name;
Expand Down
1 change: 1 addition & 0 deletions app/templates/People/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if($vv_action == 'add') {

$fields['names.0.type_id'] = [
'default' => $vv_default_name_type,
'fieldLabel' => __d('field', 'People.name.type_id'),
'required' => true,
'fieldType' => 'string'
];
Expand Down

0 comments on commit 7651e88

Please sign in to comment.