From 4ab2485d43d59689895d1820fdc4eb19b7c6587f Mon Sep 17 00:00:00 2001 From: BertKoor Date: Mon, 20 Apr 2026 10:19:35 +0200 Subject: [PATCH 1/5] added option to sort report of burials on place of burial --- app/Individual.php | 27 +++++++++++++++++++++++ app/Place.php | 24 ++++++++++++++++++++ app/Report/ReportParserGenerate.php | 3 +++ resources/xml/reports/cemetery_report.xml | 4 ++-- 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/app/Individual.php b/app/Individual.php index 661f49ce72..6e989ce4c3 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -71,6 +71,17 @@ public static function deathDateComparator(): Closure return static fn (Individual $x, Individual $y): int => Date::compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); } + /** + * A closure which will compare individuals by burial place. + * + * @return Closure(Individual,Individual):int + */ + public static function burialPlaceComparator(): Closure + { + return static fn (Individual $x, Individual $y): int => Place::compare($x->getBurialPlace(), $y->getBurialPlace()); + } + + /** * Can the name of this record be shown? * @@ -414,6 +425,22 @@ public function getDeathPlace(): Place return new Place('', $this->tree); } + /** + * Get the place of burial + * + * @return Place + */ + public function getBurialPlace(): Place + { + $places = $this->getAllEventPlaces(['BURI']); + + foreach ($places as $place) { + return $place; + } + + return new Place('', $this->tree); + } + /** * Get the range of years in which a individual lived. e.g. “1870–”, “1870–1920”, “–1920”. * Provide the place and full date using a tooltip. diff --git a/app/Place.php b/app/Place.php index 01d11141c9..406b28284d 100644 --- a/app/Place.php +++ b/app/Place.php @@ -292,4 +292,28 @@ public function shortName(bool $link = false): string return '' . e($short_name) . ''; } + + /** + * Compare two places, so they can be sorted. + * return -1 if $a<$b + * return +1 if $b>$a + * return 0 if places are the same + * + * @param Place $a + * @param Place $b + * @return int + */ + public static function compare(Place $a, Place $b): int + { + return strcasecmp($a->reversedFullName(), $b->reversedFullName()); + } + + private function reversedFullName(): string + { + if ($this->parts->isEmpty()) { + return ''; + } + return $this->parts->reverse()->implode(I18N::$list_separator); + } + } diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 53633a8eff..458b23bc65 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1705,6 +1705,9 @@ protected function listStartHandler(array $attrs): void case 'MARR:DATE': uasort($this->list, Family::marriageDateComparator()); break; + case 'BURI:PLAC': + uasort($this->list, Individual::burialPlaceComparator()); + break; default: // unsorted or already sorted by SQL break; diff --git a/resources/xml/reports/cemetery_report.xml b/resources/xml/reports/cemetery_report.xml index 774a760414..b9ceae0197 100644 --- a/resources/xml/reports/cemetery_report.xml +++ b/resources/xml/reports/cemetery_report.xml @@ -3,7 +3,7 @@ <var var="I18N::translate('Burials')" /> - + @@ -50,7 +50,7 @@ - + From ffa23ebc73568d16d948b8eccda6222aa5087050 Mon Sep 17 00:00:00 2001 From: BertKoor Date: Mon, 20 Apr 2026 14:24:46 +0200 Subject: [PATCH 2/5] added option to sort report of births on place --- app/Individual.php | 11 ++++++++++- app/Report/ReportParserGenerate.php | 3 +++ resources/xml/reports/birth_report.xml | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/Individual.php b/app/Individual.php index 6e989ce4c3..1167fbcd73 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -71,6 +71,16 @@ public static function deathDateComparator(): Closure return static fn (Individual $x, Individual $y): int => Date::compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); } + /** + * A closure which will compare individuals by birth place. + * + * @return Closure(Individual,Individual):int + */ + public static function birthPlaceComparator(): Closure + { + return static fn (Individual $x, Individual $y): int => Place::compare($x->getBirthPlace(), $y->getBirthPlace()); + } + /** * A closure which will compare individuals by burial place. * @@ -81,7 +91,6 @@ public static function burialPlaceComparator(): Closure return static fn (Individual $x, Individual $y): int => Place::compare($x->getBurialPlace(), $y->getBurialPlace()); } - /** * Can the name of this record be shown? * diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 458b23bc65..1330194f3e 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1699,6 +1699,9 @@ protected function listStartHandler(array $attrs): void case 'BIRT:DATE': uasort($this->list, Individual::birthDateComparator()); break; + case 'BIRT:PLAC': + uasort($this->list, Individual::birthPlaceComparator()); + break; case 'DEAT:DATE': uasort($this->list, Individual::deathDateComparator()); break; diff --git a/resources/xml/reports/birth_report.xml b/resources/xml/reports/birth_report.xml index 3dc06d46bd..0eeb2246ac 100644 --- a/resources/xml/reports/birth_report.xml +++ b/resources/xml/reports/birth_report.xml @@ -6,7 +6,7 @@ - + @@ -36,7 +36,9 @@ - + + + From 4eff3d16ae1f329d51237aa6b06ca1f2905da656 Mon Sep 17 00:00:00 2001 From: BertKoor Date: Mon, 20 Apr 2026 14:29:52 +0200 Subject: [PATCH 3/5] added option to sort deaths report on place of death --- app/Individual.php | 10 ++++++++++ app/Report/ReportParserGenerate.php | 3 +++ resources/xml/reports/death_report.xml | 8 ++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Individual.php b/app/Individual.php index 1167fbcd73..6fac2258cc 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -81,6 +81,16 @@ public static function birthPlaceComparator(): Closure return static fn (Individual $x, Individual $y): int => Place::compare($x->getBirthPlace(), $y->getBirthPlace()); } + /** + * A closure which will compare individuals by death place. + * + * @return Closure(Individual,Individual):int + */ + public static function deathPlaceComparator(): Closure + { + return static fn (Individual $x, Individual $y): int => Place::compare($x->getDeathPlace(), $y->getDeathPlace()); + } + /** * A closure which will compare individuals by burial place. * diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 1330194f3e..cf4c127adb 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1705,6 +1705,9 @@ protected function listStartHandler(array $attrs): void case 'DEAT:DATE': uasort($this->list, Individual::deathDateComparator()); break; + case 'DEAT:PLAC': + uasort($this->list, Individual::deathPlaceComparator()); + break; case 'MARR:DATE': uasort($this->list, Family::marriageDateComparator()); break; diff --git a/resources/xml/reports/death_report.xml b/resources/xml/reports/death_report.xml index de5fd9d307..7c142f99d1 100644 --- a/resources/xml/reports/death_report.xml +++ b/resources/xml/reports/death_report.xml @@ -6,7 +6,7 @@ - + @@ -43,7 +43,11 @@ - + + + + + From cde021d9678701e78a59d8bb1e1bc011b9df45d9 Mon Sep 17 00:00:00 2001 From: BertKoor Date: Mon, 20 Apr 2026 14:34:43 +0200 Subject: [PATCH 4/5] added option to sort marriages report on place --- app/Family.php | 10 ++++++++++ app/Report/ReportParserGenerate.php | 3 +++ resources/xml/reports/marriage_report.xml | 8 ++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Family.php b/app/Family.php index a59bc27d86..ed2f14719b 100644 --- a/app/Family.php +++ b/app/Family.php @@ -310,6 +310,16 @@ public function getAllMarriagePlaces(): array return []; } + /** + * A closure which will compare families by marriage place. + * + * @return Closure(Family,Family):int + */ + public static function marriagePlaceComparator(): Closure + { + return static fn (Family $x, Family $y): int => Place::compare($x->getMarriagePlace(), $y->getMarriagePlace()); + } + /** * Derived classes should redefine this function, otherwise the object will have no name * diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index cf4c127adb..8ac54bff18 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1711,6 +1711,9 @@ protected function listStartHandler(array $attrs): void case 'MARR:DATE': uasort($this->list, Family::marriageDateComparator()); break; + case 'MARR:PLAC': + uasort($this->list, Family::marriagePlaceComparator()); + break; case 'BURI:PLAC': uasort($this->list, Individual::burialPlaceComparator()); break; diff --git a/resources/xml/reports/marriage_report.xml b/resources/xml/reports/marriage_report.xml index e56cffbaae..c3980fe837 100644 --- a/resources/xml/reports/marriage_report.xml +++ b/resources/xml/reports/marriage_report.xml @@ -6,7 +6,7 @@ - + @@ -43,7 +43,11 @@ - + + + + + From e2aa31a97ad294b550e0b4b3d88a90624f04c58a Mon Sep 17 00:00:00 2001 From: BertKoor Date: Mon, 20 Apr 2026 14:44:27 +0200 Subject: [PATCH 5/5] minor rework on option to sort burials report on place of burial --- app/Report/ReportParserGenerate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php index 8ac54bff18..21d33b7116 100644 --- a/app/Report/ReportParserGenerate.php +++ b/app/Report/ReportParserGenerate.php @@ -1708,15 +1708,15 @@ protected function listStartHandler(array $attrs): void case 'DEAT:PLAC': uasort($this->list, Individual::deathPlaceComparator()); break; + case 'BURI:PLAC': + uasort($this->list, Individual::burialPlaceComparator()); + break; case 'MARR:DATE': uasort($this->list, Family::marriageDateComparator()); break; case 'MARR:PLAC': uasort($this->list, Family::marriagePlaceComparator()); break; - case 'BURI:PLAC': - uasort($this->list, Individual::burialPlaceComparator()); - break; default: // unsorted or already sorted by SQL break;