diff options
| author | Greg Roach <fisharebest@gmail.com> | 2014-09-28 14:58:07 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2014-09-28 14:58:07 +0100 |
| commit | 8d31edab472e8b189c7062f5ad95ef43b05542a3 (patch) | |
| tree | aeba9b293f69a681bfb23a252f1ded8fab5a7699 /library | |
| parent | 00f42fa35d8447ddea9b60631e42b9d551f0f9d5 (diff) | |
| download | webtrees-8d31edab472e8b189c7062f5ad95ef43b05542a3.tar.gz webtrees-8d31edab472e8b189c7062f5ad95ef43b05542a3.tar.bz2 webtrees-8d31edab472e8b189c7062f5ad95ef43b05542a3.zip | |
Fix #1266160 - Vital Records Report does not sort
Diffstat (limited to 'library')
| -rw-r--r-- | library/WT/Individual.php | 16 | ||||
| -rw-r--r-- | library/WT/Report/Base.php | 26 |
2 files changed, 8 insertions, 34 deletions
diff --git a/library/WT/Individual.php b/library/WT/Individual.php index 48a627874f..c703e7d076 100644 --- a/library/WT/Individual.php +++ b/library/WT/Individual.php @@ -541,25 +541,19 @@ class WT_Individual extends WT_GedcomRecord { return $this->_getEstimatedBirthDate; } function getEstimatedDeathDate() { - if (is_null($this->_getEstimatedDeathDate)) { + if ($this->_getEstimatedDeathDate === null) { foreach ($this->getAllDeathDates() as $date) { if ($date->isOK()) { $this->_getEstimatedDeathDate=$date; break; } } - if (is_null($this->_getEstimatedDeathDate)) { - $tmp=$this->getEstimatedBirthDate(); - if ($tmp->MinJD()) { + if ($this->_getEstimatedDeathDate === null) { + if ($this->getEstimatedBirthDate()->MinJD()) { global $MAX_ALIVE_AGE; - $tmp2=$tmp->AddYears($MAX_ALIVE_AGE, 'BEF'); - if ($tmp2->MaxJD() < WT_CLIENT_JD) { - $this->_getEstimatedDeathDate=$tmp2; - } else { - $this->_getEstimatedDeathDate=new WT_Date(''); // always return a date object - } + $this->_getEstimatedDeathDate = $this->getEstimatedBirthDate()->AddYears($MAX_ALIVE_AGE, 'BEF'); } else { - $this->_getEstimatedDeathDate=new WT_Date(''); // always return a date object + $this->_getEstimatedDeathDate = new WT_Date(''); // always return a date object } } } diff --git a/library/WT/Report/Base.php b/library/WT/Report/Base.php index ec808addcb..c82115e45f 100644 --- a/library/WT/Report/Base.php +++ b/library/WT/Report/Base.php @@ -2652,29 +2652,9 @@ function ListSHandler($attrs) { uasort($list, array("WT_GedcomRecord", "compare")); break; case "CHAN": - uasort( - $list, - function (WT_GedcomRecord $x, WT_GedcomRecord $y) { - $f1 = $x->getFirstFact('CHAN'); - $f2 = $y->getFirstFact('CHAN'); - if ($f1 && $f2) { - $d1 = $f1->getDate(); - $d2 = $f2->getDate(); - $cmp = WT_Date::compare($d1, $d2); - if ($cmp) { - return $cmp; - } else { - // Same date. Compare times - preg_match('/\n3 TIME (.+)/', $f1->getGedcom(), $m1); - preg_match('/\n3 TIME (.+)/', $f2->getGedcom(), $m2); - - return strcmp($m1[1], $m2[1]); - } - } else { - return 0; - } - } - ); + uasort($list, function (WT_GedcomRecord $x, WT_GedcomRecord $y) { + return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true); + }); break; case "BIRT:DATE": uasort($list, array("WT_Individual", "CompareBirtDate")); |
