summaryrefslogtreecommitdiff
path: root/app/Individual.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Individual.php')
-rw-r--r--app/Individual.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/app/Individual.php b/app/Individual.php
index f8cc2358a3..43fc193499 100644
--- a/app/Individual.php
+++ b/app/Individual.php
@@ -853,33 +853,33 @@ class Individual extends GedcomRecord {
public function getPrimaryChildFamily() {
$families = $this->getChildFamilies();
switch (count($families)) {
- case 0:
- return null;
- case 1:
- return $families[0];
- default:
- // If there is more than one FAMC record, choose the preferred parents:
- // a) records with '2 _PRIMARY'
- foreach ($families as $famid => $fam) {
- if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
- return $fam;
+ case 0:
+ return null;
+ case 1:
+ return $families[0];
+ default:
+ // If there is more than one FAMC record, choose the preferred parents:
+ // a) records with '2 _PRIMARY'
+ foreach ($families as $famid => $fam) {
+ if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 _PRIMARY Y)/", $this->getGedcom())) {
+ return $fam;
+ }
}
- }
- // b) records with '2 PEDI birt'
- foreach ($families as $famid => $fam) {
- if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
- return $fam;
+ // b) records with '2 PEDI birt'
+ foreach ($families as $famid => $fam) {
+ if (preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI birth)/", $this->getGedcom())) {
+ return $fam;
+ }
}
- }
- // c) records with no '2 PEDI'
- foreach ($families as $famid => $fam) {
- if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
- return $fam;
+ // c) records with no '2 PEDI'
+ foreach ($families as $famid => $fam) {
+ if (!preg_match("/\n1 FAMC @{$famid}@\n(?:[2-9].*\n)*(?:2 PEDI)/", $this->getGedcom())) {
+ return $fam;
+ }
}
- }
- // d) any record
- return $families[0];
+ // d) any record
+ return $families[0];
}
}