Skip to content

Commit

Permalink
Individual list - use same logic to list individuals and surnames
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest committed Dec 16, 2022
1 parent 61cc2bb commit 843973c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Module/IndividualListModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,15 @@ protected function individuals(Tree $tree, string $surname, array $surnames, str
->on('n_file', '=', 'i_file');
})
->where('i_file', '=', $tree->id())
->where('n_surn', '=', $surname)
->select(['i_id AS xref', 'i_gedcom AS gedcom', 'n_givn', 'n_surn']);

$this->whereFamily($fams, $query);
$this->whereMarriedName($marnm, $query);

if ($surnames !== []) {
if ($surnames === []) {
// SURN, with no surname
$query->where('n_surn', '=', $surname);
} else {
$query->whereIn($this->binaryColumn('n_surname'), $surnames);
}

Expand All @@ -727,9 +729,7 @@ protected function individuals(Tree $tree, string $surname, array $surnames, str

$individuals = new Collection();

$rows = $query->get();

foreach ($rows as $row) {
foreach ($query->get() as $row) {
$individual = Registry::individualFactory()->make($row->xref, $tree, $row->gedcom);
assert($individual instanceof Individual);

Expand Down

0 comments on commit 843973c

Please sign in to comment.