summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2013-07-06 10:43:00 +0000
committerfisharebest <fisharebest@gmail.com>2013-07-06 10:43:00 +0000
commit65df43b71780855fe23c627316c286df45f57be1 (patch)
treea2ecdd031053bf9b6027ff0b0246e19d677bc2f9
parent13a8e8e24ced233ed300ec707d1521092d43c7d1 (diff)
downloadwebtrees-65df43b71780855fe23c627316c286df45f57be1.tar.gz
webtrees-65df43b71780855fe23c627316c286df45f57be1.tar.bz2
webtrees-65df43b71780855fe23c627316c286df45f57be1.zip
#1144979 - Duplicate events reported on events of close relatives
-rw-r--r--modules_v3/personal_facts/module.php65
1 files changed, 30 insertions, 35 deletions
diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php
index 23945727c6..130bb99e7f 100644
--- a/modules_v3/personal_facts/module.php
+++ b/modules_v3/personal_facts/module.php
@@ -325,7 +325,11 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
$facts = array();
- if ($sosa==1) {
+ // Only include events between birth and death
+ $birt_date = $person->getEstimatedBirthDate();
+ $deat_date = $person->getEstimatedDeathDate();
+
+ if ($sosa == 1) {
foreach ($person->getChildFamilies() as $family) {
// Add siblings
foreach (self::child_facts($person, $family, '_SIBL', '') as $fact) {
@@ -346,11 +350,32 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
}
- }
- // Only include events between birth and death
- $birt_date=$person->getEstimatedBirthDate();
- $deat_date=$person->getEstimatedDeathDate();
+ if (strstr($SHOW_RELATIVES_EVENTS, '_MARR_PARE')) {
+ // add father/mother marriages
+ foreach ($person->getChildFamilies() as $sfamily) {
+ foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
+ if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
+ // marriage of parents (to each other)
+ $rela_fact = clone($fact);
+ $rela_fact->setTag('_'.$fact->getTag().'_FAMC');
+ $facts[] = $rela_fact;
+ }
+ }
+ }
+ foreach ($person->getChildStepFamilies() as $sfamily) {
+ foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
+ if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
+ // marriage of a parent (to another spouse)
+ // Convert the event to a close relatives event
+ $rela_fact = clone($fact);
+ $rela_fact->setTag('_'.$fact->getTag().'_PARE');
+ $facts[] = $rela_fact;
+ }
+ }
+ }
+ }
+ }
foreach ($person->getChildFamilies() as $family) {
foreach ($family->getSpouses() as $parent) {
@@ -381,36 +406,6 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
}
-
- if ($sosa==1 && strstr($SHOW_RELATIVES_EVENTS, '_MARR_PARE')) {
- // add father/mother marriages
- foreach ($family->getSpouses() as $parent) {
- foreach ($parent->getSpouseFamilies() as $sfamily) {
- foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
- if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
- if ($sfamily->equals($family)) {
- if ($parent->getSex()=='F') {
- // show current family marriage only once
- continue;
- }
- // marriage of parents (to each other)
- $rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_FAMC');
- $facts[] = $rela_fact;
- break;
-
- } else {
- // marriage of a parent (to another spouse)
- // Convert the event to a close relatives event
- $rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_PARE');
- $facts[] = $rela_fact;
- }
- }
- }
- }
- }
- }
}
return $facts;