diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-07-05 19:01:43 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-07-05 19:01:43 +0000 |
| commit | c44cb261061d8cc982c0101d50836758ffd5449f (patch) | |
| tree | fd349ad5478075afa9864272a38c9c4e2dc949ba /modules_v3 | |
| parent | 9b72c30329293c64134d9fa36034d2c751ffcd9d (diff) | |
| download | webtrees-c44cb261061d8cc982c0101d50836758ffd5449f.tar.gz webtrees-c44cb261061d8cc982c0101d50836758ffd5449f.tar.bz2 webtrees-c44cb261061d8cc982c0101d50836758ffd5449f.zip | |
Refactor away get_sub_record()
Diffstat (limited to 'modules_v3')
| -rw-r--r-- | modules_v3/personal_facts/module.php | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php index abf0b6e638..4cc3a29c63 100644 --- a/modules_v3/personal_facts/module.php +++ b/modules_v3/personal_facts/module.php @@ -465,41 +465,41 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab { ); foreach ($associates as $associate) { foreach ($associate->getFacts() as $fact) { - $srec = $fact->getGedcom(); - foreach (array('ASSO', '_ASSO') as $asso_tag) { - $arec = get_sub_record(2, '2 ' . $asso_tag . ' @' . $person->getXref() . '@', $srec); - if ($arec) { - // Extract the important details from the fact - $factrec='1 '.$fact->getTag(); - if (preg_match('/\n2 DATE .*/', $srec, $match)) { - $factrec.=$match[0]; - } - if (preg_match('/\n2 PLAC .*/', $srec, $match)) { - $factrec.=$match[0]; + $arec = $fact->getAttribute('_ASSO'); + if (!$arec) { + $arec = $fact->getAttribute('ASSO'); + } + if ($arec) { + // Extract the important details from the fact + $factrec='1 '.$fact->getTag(); + if (preg_match('/\n2 DATE .*/', $srec, $match)) { + $factrec.=$match[0]; + } + if (preg_match('/\n2 PLAC .*/', $srec, $match)) { + $factrec.=$match[0]; + } + if ($associate instanceof WT_Family) { + foreach ($associate->getSpouses() as $spouse) { + $factrec.="\n2 $asso_tag @".$spouse->getXref().'@'; } - if ($associate instanceof WT_Family) { - foreach ($associate->getSpouses() as $spouse) { - $factrec.="\n2 $asso_tag @".$spouse->getXref().'@'; - } - } else { - $factrec.="\n2 $asso_tag @".$associate->getXref().'@'; - // CHR/BAPM events are commonly used. Generate the reverse relationship - if (preg_match('/^(?:BAPM|CHR)$/', $fact->getTag()) && preg_match('/3 RELA god(?:parent|mother|father)/', $fact->getGedcom())) { - switch ($associate->getSex()) { - case 'M': - $factrec.="\n3 RELA godson"; - break; - case 'F': - $factrec.="\n3 RELA goddaughter"; - break; - case 'U': - $factrec.="\n3 RELA godchild"; - break; - } + } else { + $factrec.="\n2 $asso_tag @".$associate->getXref().'@'; + // CHR/BAPM events are commonly used. Generate the reverse relationship + if (preg_match('/^(?:BAPM|CHR)$/', $fact->getTag()) && preg_match('/3 RELA god(?:parent|mother|father)/', $fact->getGedcom())) { + switch ($associate->getSex()) { + case 'M': + $factrec.="\n3 RELA godson"; + break; + case 'F': + $factrec.="\n3 RELA goddaughter"; + break; + case 'U': + $factrec.="\n3 RELA godchild"; + break; } } - $facts[] = new WT_Fact($factrec, $associate, 'asso'); } + $facts[] = new WT_Fact($factrec, $associate, 'asso'); } } } |
