summaryrefslogtreecommitdiff
path: root/app/Controller/LifespanController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/LifespanController.php')
-rw-r--r--app/Controller/LifespanController.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/app/Controller/LifespanController.php b/app/Controller/LifespanController.php
index 6d47b2576a..b34d390d46 100644
--- a/app/Controller/LifespanController.php
+++ b/app/Controller/LifespanController.php
@@ -197,23 +197,26 @@ class LifespanController extends PageController {
foreach ($xrefs as $key => $xref) {
$valid = false;
$person = Individual::getInstance($xref, $this->tree());
- if ($person) {
- if ($person->canShow()) {
- foreach ($person->getFacts() as $fact) {
+ if ($person !== null && $person->canShow()) {
+ foreach ($person->getFacts() as $fact) {
+ if ($this->checkFact($fact)) {
+ $this->people[] = $person;
+ $valid = true;
+ break;
+ }
+ }
+ } else {
+ $family = Family::getInstance($xref, $this->tree());
+ if ($family !== null && $family->canShow()) {
+ foreach ($family->getFacts() as $fact) {
if ($this->checkFact($fact)) {
- $this->people[] = $person;
$valid = true;
+ $this->people[] = $family->getHusband();
+ $this->people[] = $family->getWife();
break;
}
}
}
- } else {
- $family = Family::getInstance($xref, $this->tree());
- if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) {
- $valid = true;
- $this->people[] = $family->getHusband();
- $this->people[] = $family->getWife();
- }
}
if (!$valid) {
unset($xrefs[$key]); // no point in storing a xref if we can't use it