diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-11-19 17:57:46 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-11-19 18:00:40 +0000 |
| commit | 63b1851d18dc5df8dcb1a599116a3831998ab96c (patch) | |
| tree | a6c4befe698bc87b6e6af40cb4a3d11bbd682930 /app/Report | |
| parent | dbfc3863950ec8bae86dadccc2608863d6ffb574 (diff) | |
| download | webtrees-63b1851d18dc5df8dcb1a599116a3831998ab96c.tar.gz webtrees-63b1851d18dc5df8dcb1a599116a3831998ab96c.tar.bz2 webtrees-63b1851d18dc5df8dcb1a599116a3831998ab96c.zip | |
Fix: pending deletions can break the changes report
Diffstat (limited to 'app/Report')
| -rw-r--r-- | app/Report/ReportParserGenerate.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 7fed3c9c7d..b8c13d6490 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1833,7 +1833,7 @@ class ReportParserGenerate extends ReportParserBase // Some filters/sorts can be applied using SQL, while others require PHP switch ($listname) { case 'pending': - $xrefs = DB::table('change') + $this->list = DB::table('change') ->whereIn('change_id', function (Builder $query): void { $query->select(new Expression('MAX(change_id)')) ->from('change') @@ -1841,13 +1841,12 @@ class ReportParserGenerate extends ReportParserBase ->where('status', '=', 'pending') ->groupBy(['xref']); }) - ->pluck('xref'); - - $this->list = []; - foreach ($xrefs as $xref) { - $this->list[] = Registry::gedcomRecordFactory()->make($xref, $this->tree); - } + ->get() + ->map(fn (object $row): ?GedcomRecord => Registry::gedcomRecordFactory()->make($row->xref, $this->tree, $row->new_gedcom ?: $row->old_gedcom)) + ->filter() + ->all(); break; + case 'individual': $query = DB::table('individuals') ->where('i_file', '=', $this->tree->id()) |
