diff options
| author | Greg Roach <fisharebest@gmail.com> | 2017-08-05 21:48:14 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-08-05 21:51:57 +0100 |
| commit | 0c08b4d7d53550d6e6945a78edc4b79a437b0fe4 (patch) | |
| tree | 2100453d33d3e9861c562535d6ff63ba8c061187 /app/Controller/LifespanController.php | |
| parent | 8df8981e771e1456aa1a9e5f694851327f495cba (diff) | |
| download | webtrees-0c08b4d7d53550d6e6945a78edc4b79a437b0fe4.tar.gz webtrees-0c08b4d7d53550d6e6945a78edc4b79a437b0fe4.tar.bz2 webtrees-0c08b4d7d53550d6e6945a78edc4b79a437b0fe4.zip | |
Fix #1301 - Lifepsan chart errors when a family has ane event with a place but no marriage
Diffstat (limited to 'app/Controller/LifespanController.php')
| -rw-r--r-- | app/Controller/LifespanController.php | 25 |
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 |
