diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-07-05 17:58:11 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-07-05 17:58:11 +0000 |
| commit | a74ae67a836cce479f9ccbdd4716ce648c6b21d2 (patch) | |
| tree | 3a7ab22bb80fa657fcbccb5fce57c20a98e3a11f | |
| parent | 4a94ba3b393b2b30dde98f991e5b38729bf6af0b (diff) | |
| download | webtrees-a74ae67a836cce479f9ccbdd4716ce648c6b21d2.tar.gz webtrees-a74ae67a836cce479f9ccbdd4716ce648c6b21d2.tar.bz2 webtrees-a74ae67a836cce479f9ccbdd4716ce648c6b21d2.zip | |
More refactoring - getNumberOfChildren()
| -rw-r--r-- | library/WT/Family.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/library/WT/Family.php b/library/WT/Family.php index 356c1f3ec8..5e1b531f99 100644 --- a/library/WT/Family.php +++ b/library/WT/Family.php @@ -158,16 +158,13 @@ class WT_Family extends WT_GedcomRecord { return WT_Date::Compare($x->getMarriageDate(), $y->getMarriageDate()); } - /** - * get the number of children in this family - * @return int the number of children - */ + // Number of children - for the individual list function getNumberOfChildren() { - - $nchi1=(int)get_gedcom_value('NCHI', 1, $this->getGedcom()); - $nchi2=(int)get_gedcom_value('NCHI', 2, $this->getGedcom()); - $nchi3=count($this->getChildren()); - return max($nchi1, $nchi2, $nchi3); + $nchi = count($this->getChildren()); + foreach ($this->getFacts('NCHI') as $fact) { + $nchi = max($nchi, (int)$fact->getValue()); + } + return $nchi; } /** |
