diff options
| author | fisharebest <fisharebest@gmail.com> | 2010-12-12 19:05:14 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2010-12-12 19:05:14 +0000 |
| commit | 45d20a1adacc060def6b66f491f519fbea6c2b69 (patch) | |
| tree | a86aa7f681cc603b71f28ffd8f5e0d0c4885e271 | |
| parent | 4b63be9879cd36d959b71692b3da7796d43a0f2f (diff) | |
| download | webtrees-45d20a1adacc060def6b66f491f519fbea6c2b69.tar.gz webtrees-45d20a1adacc060def6b66f491f519fbea6c2b69.tar.bz2 webtrees-45d20a1adacc060def6b66f491f519fbea6c2b69.zip | |
#677540 - config SHOW_RELATIVES_EVENTS is not saved. (Part two - combine similar options). Also fix various bugs such as half-siblings not showing, maternal/paternal grandparent mixups, etc. Also fix various I18N errors, such as "Death of sister" instead of "Death of a sister"
| -rw-r--r-- | editconfig_gedcom.php | 5 | ||||
| -rw-r--r-- | help_text.php | 50 | ||||
| -rw-r--r-- | includes/classes/class_person.php | 342 | ||||
| -rw-r--r-- | includes/config_data.php | 35 | ||||
| -rw-r--r-- | includes/db_schema/db_schema_5_6.php | 59 | ||||
| -rw-r--r-- | includes/session.php | 2 | ||||
| -rw-r--r-- | includes/set_gedcom_defaults.php | 2 | ||||
| -rw-r--r-- | pgv_to_wt.php | 9 | ||||
| -rw-r--r-- | setup.php | 2 |
9 files changed, 260 insertions, 246 deletions
diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php index 0b29a32f5b..5f5ec31d1b 100644 --- a/editconfig_gedcom.php +++ b/editconfig_gedcom.php @@ -1225,11 +1225,8 @@ print_header(i18n::translate('GEDCOM configuration')); array('_BIRT_GCHI', '_MARR_GCHI', '_DEAT_GCHI'), array('_BIRT_CHIL', '_MARR_CHIL', '_DEAT_CHIL'), array('_BIRT_SIBL', '_MARR_SIBL', '_DEAT_SIBL'), - array('_BIRT_HSIB', '_MARR_HSIB', '_DEAT_HSIB'), array(null, null, '_DEAT_SPOU'), - array(null, '_MARR_FATH', '_DEAT_FATH'), - array(null, '_MARR_FAMC', null ), - array(null, '_MARR_MOTH', '_DEAT_MOTH'), + array(null, '_MARR_PARE', '_DEAT_PARE'), array(null, null, '_DEAT_GPAR'), ); foreach ($rel_events as $row) { diff --git a/help_text.php b/help_text.php index 6c28e1fa7c..603e0903bb 100644 --- a/help_text.php +++ b/help_text.php @@ -820,11 +820,6 @@ case '_ADOP_GCHI': $text=''; break; -case '_ADOP_HSIB': - $title=translate_fact('_ADOP_HSIB'); - $text=''; - break; - case '_ADOP_SIBL': $title=translate_fact('_ADOP_SIBL'); $text=''; @@ -856,11 +851,6 @@ case '_BAPM_GCHI': $text=''; break; -case '_BAPM_HSIB': - $title=translate_fact('_BAPM_HSIB'); - $text=''; - break; - case '_BAPM_SIBL': $title=translate_fact('_BAPM_SIBL'); $text=''; @@ -881,11 +871,6 @@ case '_BIRT_GCHI': $text=''; break; -case '_BIRT_HSIB': - $title=translate_fact('_BIRT_HSIB'); - $text=''; - break; - case '_BIRT_SIBL': $title=translate_fact('_BIRT_SIBL'); $text=''; @@ -916,11 +901,6 @@ case '_BURI_GPAR': $text=''; break; -case '_BURI_HSIB': - $title=translate_fact('_BURI_HSIB'); - $text=''; - break; - case '_BURI_MOTH': $title=translate_fact('_BURI_MOTH'); $text=''; @@ -946,11 +926,6 @@ case '_CHR_GCHI': $text=''; break; -case '_CHR_HSIB': - $title=translate_fact('_CHR_HSIB'); - $text=''; - break; - case '_CHR_SIBL': $title=translate_fact('_CHR_SIBL'); $text=''; @@ -981,11 +956,6 @@ case '_CREM_GPAR': $text=''; break; -case '_CREM_HSIB': - $title=translate_fact('_CREM_HSIB'); - $text=''; - break; - case '_CREM_MOTH': $title=translate_fact('_CREM_MOTH'); $text=''; @@ -1026,11 +996,6 @@ case '_DEAT_GPAR': $text=''; break; -case '_DEAT_HSIB': - $title=translate_fact('_DEAT_HSIB'); - $text=''; - break; - case '_DEAT_MOTH': $title=translate_fact('_DEAT_MOTH'); $text=''; @@ -1196,11 +1161,6 @@ case '_MARB_GCHI': $text=''; break; -case '_MARB_HSIB': - $title=translate_fact('_MARB_HSIB'); - $text=''; - break; - case '_MARB_MOTH': $title=translate_fact('_MARB_MOTH'); $text=''; @@ -1246,11 +1206,6 @@ case '_MARR_GCHI': $text=''; break; -case '_MARR_HSIB': - $title=translate_fact('_MARR_HSIB'); - $text=''; - break; - case '_MARR_MOTH': $title=translate_fact('_MARR_MOTH'); $text=''; @@ -1411,11 +1366,6 @@ case '__BRTM_GCHI': $text=''; break; -case '__BRTM_HSIB': - $title=translate_fact('__BRTM_HSIB'); - $text=''; - break; - case '__BRTM_SIBL': $title=translate_fact('__BRTM_SIBL'); $text=''; diff --git a/includes/classes/class_person.php b/includes/classes/class_person.php index 44bca78c19..5efdf7f6c5 100644 --- a/includes/classes/class_person.php +++ b/includes/classes/class_person.php @@ -897,9 +897,7 @@ class Person extends GedcomRecord { if (!$this->canDisplayDetails()) return; $this->parseFacts(); //-- Get the facts from the family with spouse (FAMS) - $fams = $this->getSpouseFamilies(); - /* @var $family Family */ - foreach ($fams as $famid=>$family) { + foreach ($this->getSpouseFamilies() as $family) { if (is_null($family)) continue; $updfamily = $family->getUpdatedFamily(); //-- updated family ? $spouse = $family->getSpouse($this); @@ -918,7 +916,7 @@ class Person extends GedcomRecord { if ((!in_array($fact, $nonfacts))&&(!in_array($fact, $nonfamfacts))) { $factrec = $event->getGedcomRecord(); if (!is_null($spouse)) $factrec.="\n2 _WTS @".$spouse->getXref().'@'; - $factrec.="\n2 _WTFS @$famid@\n"; + $factrec.="\n2 _WTFS @".$family->getXref()."@\n"; $event->gedcomRecord = $factrec; if ($fact!='OBJE') $this->indifacts[] = $event; else $this->otherfacts[]=$event; @@ -927,11 +925,11 @@ class Person extends GedcomRecord { } if ($otherfacts) { if (!$hasdiv && !is_null($spouse)) $this->add_spouse_facts($spouse, $family->getGedcomRecord()); - $this->add_children_facts($family); + $this->add_children_facts($family, '_CHIL', ''); } } if ($otherfacts) { - $this->add_parents_facts($this); + $this->add_parents_facts($this, 1); $this->add_historical_facts(); $this->add_asso_facts(); } @@ -939,23 +937,42 @@ class Person extends GedcomRecord { /** * add parents events to individual facts array * - * bdate = indi birth date record - * ddate = indi death date record - * * @param Person $person Person - * @param int $sosa 2=father 3=mother ... + * @param int $sosa 1=parents, 2=father's parents, 3=mother's parents * @return records added to indifacts array */ - function add_parents_facts(&$person, $sosa=1) { + function add_parents_facts(&$person, $sosa) { global $SHOW_RELATIVES_EVENTS; - if (is_null($person) || !$SHOW_RELATIVES_EVENTS) return; + // Deal with recursion. + switch ($sosa) { + case 1: + // Add siblings and half-siblings + foreach ($person->getChildFamilies() as $family) { + foreach (array($family->getHusband(), $family->getWife()) as $spouse) { + foreach ($spouse->getSpouseFamilies() as $sfamily) { + if ($family->getHusbId()==$sfamily->getHusbId() && $family->getWifeId()==$sfamily->getWifeId()) { + // Both parents the same - siblings + $this->add_children_facts($sfamily, '_SIBL', ''); + } else { + // One parent the same - half-siblings + $this->add_children_facts($sfamily, '_HSIB', 'par'); + } + } + } + } + // Add grandparents + foreach ($person->getChildFamilies() as $family) { + $this->add_parents_facts($family->getHusband(), 2); + $this->add_parents_facts($family->getWife (), 3); + } + break; + } switch ($sosa) { case 1: $rela=''; break; case 2: $rela='fat'; break; case 3: $rela='mot'; break; - default: return; // End recursion at G-G-Parent } // Only include events between birth and death @@ -965,20 +982,22 @@ class Person extends GedcomRecord { foreach ($person->getChildFamilies() as $famid=>$family) { foreach (array($family->getWife(), $family->getHusband()) as $parent) { if ($parent) { - // add parent death - if ($sosa==1) { - $fact=$parent->getSex()=='F' ? '_DEAT_MOTH' : '_DEAT_FATH'; - } else { - $fact='_DEAT_GPAR'; - } - if (strstr($SHOW_RELATIVES_EVENTS, $fact)) { - if ($sosa==2) $fact='_DEAT_GPA1'; - elseif ($sosa==3) $fact='_DEAT_GPA2'; + if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT'.($sosa==1 ? '_PARE' : '_GPAR'))) { foreach ($parent->getAllFactsByType(explode('|', WT_EVENTS_DEAT)) as $sEvent) { $srec = $sEvent->getGedcomRecord(); if (GedcomDate::Compare($bDate, $sEvent->getDate())<0 && GedcomDate::Compare($sEvent->getDate(), $dDate)<=0) { - $fact=str_replace('DEAT', $sEvent->getTag(), $fact); // BURI, CREM, etc. - $factrec='1 '.$fact."\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); + switch ($sosa) { + case 1: + $factrec='1 _'.$sEvent->getTag().'_PARE'; + break; + case 2: + $factrec='1 _'.$sEvent->getTag().'_GPA1'; + break; + case 3: + $factrec='1 _'.$sEvent->getTag().'_GPA2'; + break; + } + $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); if (!$sEvent->canShow()) { $factrec .= "\n2 RESN privacy"; } @@ -993,14 +1012,6 @@ class Person extends GedcomRecord { } } } - if ($sosa==1) { - $this->add_stepsiblings_facts($parent, $famid); // stepsiblings with father - } - if ($parent->getSex()=='M') { - $this->add_parents_facts($parent, $sosa*2); // recursive call for father ancestors - } elseif ($parent->getSex()=='F') { - $this->add_parents_facts($parent, $sosa*2+1); // recursive call for mother ancestors - } } } if ($sosa==1) { @@ -1015,21 +1026,21 @@ class Person extends GedcomRecord { // show current family marriage only once continue; } - $fact='_MARR_FAMC'; + $fact='_MARR_FAMC'; // marriage of parents (to each other) $rela1='fat'; $rela2='mot'; } else { if ($parent->getSex()=='M') { - $fact='_MARR_FATH'; + $fact='_MARR_PARE'; // marriage of a parent (to another spouse) $rela1='fat'; $rela2='fatwif'; } else { - $fact='_MARR_MOTH'; + $fact='_MARR_PARE'; $rela1='mot'; $rela2='mothus'; } } - if (strstr($SHOW_RELATIVES_EVENTS, $fact)) { + if (strstr($SHOW_RELATIVES_EVENTS, '_MARR_PARE')) { $sEvent = $sfamily->getMarriage(); $srec = $sEvent->getGedcomRecord(); if (GedcomDate::Compare($bDate, $sEvent->getDate())<0 && GedcomDate::Compare($sEvent->getDate(), $dDate)<=0) { @@ -1049,148 +1060,146 @@ class Person extends GedcomRecord { } } } - //-- find parents' siblings (aunts/uncles) - $this->add_children_facts($family, $sosa, $person->getXref()); } } } + /** * add children events to individual facts array * - * bdate = indi birth date record - * ddate = indi death date record - * - * @param string $family Family object - * @param string $option Family level indicator - * @param string $except Gedcom childid already processed + * @param string $family Family object + * @param string $option Family level indicator + * @param string $relation Relationship path indicator * @return records added to indifacts array */ - function add_children_facts(&$family, $option='_CHIL', $except='') { + function add_children_facts(&$family, $option, $relation) { global $SHOW_RELATIVES_EVENTS; - if ($option=='1') $option='_SIBL'; - if (strstr($SHOW_RELATIVES_EVENTS, $option)===false) return; - - // Only include events between birth and death - $bDate=$this->getEstimatedBirthDate(); - $dDate=$this->getEstimatedDeathDate(); - - $children = $family->getChildren(); - foreach ($children as $key=>$child) { - $spid = $child->getXref(); - if ($spid!=$except) { - $childrec =$child->getGedcomRecord(); - $sex = $child->getSex(); - // children - $rela='chi'; - if ($sex=='F') $rela='dau'; - if ($sex=='M') $rela='son'; - // grandchildren - if ($option=='_GCHI') { - $rela='chichi'; - $parent_sex = Person::getInstance($except)->getSex(); - if ($sex=='F') { $rela='chidau'; - if ($parent_sex=='F') { $rela='daudau'; $op='_GCH1';} - if ($parent_sex=='M') { $rela='sondau'; $op='_GCH2';} - } - if ($sex=='M') { $rela='chison'; - if ($parent_sex=='F') { $rela='dauson'; $op='_GCH1';} - if ($parent_sex=='M') { $rela='sonson'; $op='_GCH2';} + // Deal with recursion. + switch ($option) { + case '_CHIL': + // Add grandchildren + foreach ($family->getChildren() as $child) { + foreach ($child->getSpouseFamilies() as $cfamily) { + switch ($child->getSex()) { + case 'M': + $this->add_children_facts($cfamily, '_GCHI', 'son'); + break; + case 'F': + $this->add_children_facts($cfamily, '_GCHI', 'dau'); + break; + case 'U': + $this->add_children_facts($cfamily, '_GCHI', 'chi'); + break; } } - // stepsiblings - if ($option=='_HSIB') { - $rela='parchi'; - if ($sex=='F') $rela='pardau'; - if ($sex=='M') $rela='parson'; - } - // siblings - if ($option=='_SIBL') { - $rela='sib'; - if ($sex=='F') $rela='sis'; - if ($sex=='M') $rela='bro'; - } - // add child birth - if (strstr($SHOW_RELATIVES_EVENTS, '_BIRT'.$option)) { - /* @var $child Person */ - /* @var $sEvent Event */ - foreach ($child->getAllFactsByType(explode('|', WT_EVENTS_BIRT)) as $sEvent) { - $srec = $sEvent->getGedcomRecord(); - $sgdate=$sEvent->getDate(); - if ($option=='_CHIL' || $sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { - if (isset($op)) { - $factrec='1 _'.$sEvent->getTag().$op; - } else { - $factrec='1 _'.$sEvent->getTag().$option; - } - $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); - if (!$sEvent->canShow()) { - $factrec.='\n2 RESN privacy'; - } - $factrec.="\n2 ASSO @".$spid."@\n3 RELA ".$rela; - $event = new Event($factrec, 0); - $event->setParentObject($this); - if (!in_array($event, $this->indifacts)) { - $this->indifacts[]=$event; - } + } + break; + } + + // For each child in the family + foreach ($family->getChildren() as $child) { + if ($child->getXref()==$this->getXref()) { + // We are not our own sibling! + continue; + } + switch ($child->getSex()) { + case 'M': + $rela=$option=='_SIBL' ? 'bro' : $relation.'son'; + break; + case 'F': + $rela=$option=='_SIBL' ? 'sis' : $relation.'dau'; + break; + case 'U': + $rela=$option=='_SIBL' ? 'sib' : $relation.'chi'; + break; + } + // add child's birth + if (strpos($SHOW_RELATIVES_EVENTS, '_BIRT'.str_replace('_HSIB', '_SIBL', $option))!==false) { + foreach ($child->getAllFactsByType(explode('|', WT_EVENTS_BIRT)) as $sEvent) { + $srec = $sEvent->getGedcomRecord(); + $sgdate=$sEvent->getDate(); + // Always show _BIRT_CHIL, even if the dates are not known + if ($option=='_CHIL' || $sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { + $factrec='1 _'.$sEvent->getTag(); + if ($option=='_GCHI' && $relation=='son') { + $factrec.='_GCH1'; + } elseif ($option=='_GCHI' && $relation=='dau') { + $factrec.='_GCH2'; + } else { + $factrec.=$option; } - } - } - // add child death - if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT'.$option)) { - /* @var $sEvent Event */ - foreach ($child->getAllFactsByType(explode('|', WT_EVENTS_DEAT)) as $sEvent) { - $sgdate=$sEvent->getDate(); - $srec = $sEvent->getGedcomRecord(); - if ($sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { - if (isset($op)) $factrec='1 _'.$sEvent->getTag().$op; - else $factrec='1 _'.$sEvent->getTag().$option; - $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); - if (!$sEvent->canShow()) { - $factrec.='\n2 RESN privacy'; - } - $factrec.="\n2 ASSO @".$spid."@\n3 RELA ".$rela; - $event = new Event($factrec, 0); - $event->setParentObject($this); - if (!in_array($event, $this->indifacts)) { - $this->indifacts[]=$event; - } + $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); + if (!$sEvent->canShow()) { + $factrec.='\n2 RESN privacy'; + } + $factrec.="\n2 ASSO @".$child->getXref()."@\n3 RELA ".$rela; + $event = new Event($factrec, 0); + $event->setParentObject($this); + if (!in_array($event, $this->indifacts)) { + $this->indifacts[]=$event; } } } - // add child marriage - if (strstr($SHOW_RELATIVES_EVENTS, '_MARR'.$option)) { - foreach ($child->getSpouseFamilies() as $sfamid=>$sfamily) { - $sEvent = $sfamily->getMarriage(); - $sgdate=$sEvent->getDate(); - $srec = $sEvent->getGedcomRecord(); - if ($sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { - if (isset($op)) $factrec='1 _'.$sEvent->getTag().$op; - else $factrec='1 _'.$sEvent->getTag().$option; - $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); - if (!$sEvent->canShow()) { - $factrec.='\n2 RESN privacy'; - } - switch ($sex) { - case 'M': $rela2=$rela.'wif'; break; - case 'F': $rela2=$rela.'hus'; break; - case 'U': $rela2=$rela.'spo'; break; - } - $factrec.="\n2 ASSO @".$spid."@\n3 RELA ".$rela; - $factrec.="\n2 ASSO @".$sfamily->getSpouseId($spid)."@\n3 RELA ".$rela2; - $event = new Event($factrec, 0); - $event->setParentObject($this); - if (!in_array($event, $this->indifacts)) { - $this->indifacts[]=$event; - } + } + // add child's death + if (strpos($SHOW_RELATIVES_EVENTS, '_DEAT'.str_replace('_HSIB', '_SIBL', $option))!==false) { + foreach ($child->getAllFactsByType(explode('|', WT_EVENTS_DEAT)) as $sEvent) { + $sgdate=$sEvent->getDate(); + $srec = $sEvent->getGedcomRecord(); + if ($sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { + $factrec='1 _'.$sEvent->getTag(); + if ($option=='_GCHI' && $relation=='son') { + $factrec.='_GCH1'; + } elseif ($option=='_GCHI' && $relation=='dau') { + $factrec.='_GCH2'; + } else { + $factrec.=$option; + } + $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); + if (!$sEvent->canShow()) { + $factrec.='\n2 RESN privacy'; + } + $factrec.="\n2 ASSO @".$child->getXref()."@\n3 RELA ".$rela; + $event = new Event($factrec, 0); + $event->setParentObject($this); + if (!in_array($event, $this->indifacts)) { + $this->indifacts[]=$event; } } } - - // add children of children = grandchildren - if ($option=='_CHIL') { - foreach ($child->getSpouseFamilies() as $sfamid=>$sfamily) { - $this->add_children_facts($sfamily, '_GCHI', $child->getXref()); + } + // add child's marriage + if (strstr($SHOW_RELATIVES_EVENTS, '_MARR'.str_replace('_HSIB', '_SIBL', $option))) { + foreach ($child->getSpouseFamilies() as $sfamily) { + $sEvent = $sfamily->getMarriage(); + $sgdate=$sEvent->getDate(); + $srec = $sEvent->getGedcomRecord(); + if ($sgdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sgdate)<=0 && GedcomDate::Compare($sgdate, $this->getEstimatedDeathDate())<=0) { + $factrec='1 _'.$sEvent->getTag(); + if ($option=='_GCHI' && $relation=='son') { + $factrec.='_GCH1'; + } elseif ($option=='_GCHI' && $relation=='dau') { + $factrec.='_GCH2'; + } else { + $factrec.=$option; + } + $factrec.="\n".get_sub_record(2, '2 DATE', $srec)."\n".get_sub_record(2, '2 PLAC', $srec); + if (!$sEvent->canShow()) { + $factrec.='\n2 RESN privacy'; + } + switch ($child->getSex()) { + case 'M': $rela2=$rela.'wif'; break; + case 'F': $rela2=$rela.'hus'; break; + case 'U': $rela2=$rela.'spo'; break; + } + $factrec.="\n2 ASSO @".$child->getXref()."@\n3 RELA ".$rela; + $factrec.="\n2 ASSO @".$sfamily->getSpouseId($child->getXref())."@\n3 RELA ".$rela2; + $event = new Event($factrec, 0); + $event->setParentObject($this); + if (!in_array($event, $this->indifacts)) { + $this->indifacts[]=$event; + } } } } @@ -1237,20 +1246,7 @@ class Person extends GedcomRecord { } } } - /** - * add step-siblings events to individual facts array - * - * @param Person $spouse Father or mother Gedcom id - * @param string $except Gedcom famid already processed - * @return records added to indifacts array - */ - function add_stepsiblings_facts(&$spouse, $except='') { - if (is_null($spouse)) return; - foreach ($spouse->getSpouseFamilies() as $famid=>$family) { - // process children from all step families - if ($famid!=$except) $this->add_children_facts($family, 'step'); - } - } + /** * add historical events to individual facts array * diff --git a/includes/config_data.php b/includes/config_data.php index e3d0696903..0d30a9dbca 100644 --- a/includes/config_data.php +++ b/includes/config_data.php @@ -1363,35 +1363,30 @@ $FACTS=array( '_BRTM:PLAC'=> i18n::translate('Place of brit milah'), '_BRTM:SOUR'=> i18n::translate('Source for brit milah'), '_BURI_CHIL'=> i18n::translate('Burial of a child'), - '_BURI_FATH'=> i18n::translate('Burial of father'), '_BURI_GCHI'=> i18n::translate('Burial of a grandchild'), '_BURI_GPAR'=> i18n::translate('Burial of a grand-parent'), '_BURI_HSIB'=> i18n::translate('Burial of a half-sibling'), - '_BURI_MOTH'=> i18n::translate('Burial of mother'), '_BURI_SIBL'=> i18n::translate('Burial of a sibling'), - '_BURI_SPOU'=> i18n::translate('Burial of spouse'), + '_BURI_SPOU'=> i18n::translate('Burial of a spouse'), '_CHR_CHIL'=> i18n::translate('Christening of a child'), '_CHR_GCHI'=> i18n::translate('Christening of a grandchild'), '_CHR_HSIB'=> i18n::translate('Christening of a half-sibling'), '_CHR_SIBL'=> i18n::translate('Christening of a sibling'), '_COML'=> /* I18N: gedcom tag _COML */ i18n::translate('Common Law Marriage'), '_CREM_CHIL'=> i18n::translate('Cremation of a child'), - '_CREM_FATH'=> i18n::translate('Cremation of father'), '_CREM_GCHI'=> i18n::translate('Cremation of a grandchild'), '_CREM_GPAR'=> i18n::translate('Cremation of a grand-parent'), '_CREM_HSIB'=> i18n::translate('Cremation of a half-sibling'), - '_CREM_MOTH'=> i18n::translate('Cremation of mother'), '_CREM_SIBL'=> i18n::translate('Cremation of a sibling'), - '_CREM_SPOU'=> i18n::translate('Cremation of spouse'), + '_CREM_SPOU'=> i18n::translate('Cremation of a spouse'), '_DBID'=> /* I18N: gedcom tag _DBID */ i18n::translate('Linked database ID'), '_DEAT_CHIL'=> i18n::translate('Death of a child'), - '_DEAT_FATH'=> i18n::translate('Death of father'), '_DEAT_GCHI'=> i18n::translate('Death of a grandchild'), '_DEAT_GPAR'=> i18n::translate('Death of a grand-parent'), '_DEAT_HSIB'=> i18n::translate('Death of a half-sibling'), - '_DEAT_MOTH'=> i18n::translate('Death of mother'), + '_DEAT_PARE'=> i18n::translate('Death of a parent'), '_DEAT_SIBL'=> i18n::translate('Death of a sibling'), - '_DEAT_SPOU'=> i18n::translate('Death of spouse'), + '_DEAT_SPOU'=> i18n::translate('Death of a spouse'), '_DEG'=> /* I18N: gedcom tag _DEG */ i18n::translate('Degree'), '_DETS'=> /* I18N: gedcom tag _DETS */ i18n::translate('Death of one spouse'), '_EMAIL'=> /* I18N: gedcom tag _EMAIL */ i18n::translate('Email address'), @@ -1419,11 +1414,10 @@ $FACTS=array( '_HOL'=> /* I18N: gedcom tag _HOL */ i18n::translate('Holocaust'), '_INTE'=> /* I18N: gedcom tag _INTE */ i18n::translate('Interred'), '_MARB_CHIL'=> i18n::translate('Marriage Banns of a child'), - '_MARB_FAMC'=> i18n::translate('Marriage Banns of parents'), - '_MARB_FATH'=> i18n::translate('Marriage Banns of father'), + '_MARB_FAMC'=> i18n::translate('Marriage banns of parents'), '_MARB_GCHI'=> i18n::translate('Marriage Banns of a grandchild'), '_MARB_HSIB'=> i18n::translate('Marriage banns of a half-sibling'), - '_MARB_MOTH'=> i18n::translate('Marriage Banns of mother'), + '_MARB_PARE'=> i18n::translate('Marriage banns of a parent'), '_MARB_SIBL'=> i18n::translate('Marriage banns of a sibling'), '_MARI'=> /* I18N: gedcom tag _MARI */ i18n::translate('Marriage Intention'), '_MARNM'=> /* I18N: gedcom tag _MARNM */ i18n::translate('Married Name'), @@ -1431,10 +1425,9 @@ $FACTS=array( '_MARNM_SURN'=> i18n::translate('Married Surname'), '_MARR_CHIL'=> i18n::translate('Marriage of a child'), '_MARR_FAMC'=> i18n::translate('Marriage of parents'), - '_MARR_FATH'=> i18n::translate('Marriage of father'), '_MARR_GCHI'=> i18n::translate('Marriage of a grandchild'), '_MARR_HSIB'=> i18n::translate('Marriage of a half-sibling'), - '_MARR_MOTH'=> i18n::translate('Marriage of mother'), + '_MARR_PARE'=> i18n::translate('Marriage of a parent'), '_MARR_SIBL'=> i18n::translate('Marriage of a sibling'), '_MBON'=> /* I18N: gedcom tag _MBON */ i18n::translate('Marriage bond'), '_MDCL'=> /* I18N: gedcom tag _MDCL */ i18n::translate('Medical'), @@ -1501,6 +1494,7 @@ $FACTS_M=array( '_BURI_GPA1'=>i18n::translate ( 'Burial of a paternal grandfather'), '_BURI_GPA2'=>i18n::translate ( 'Burial of a maternal grandfather'), '_BURI_HSIB'=>i18n::translate ( 'Burial of a half-brother'), + '_BURI_PARE'=>i18n::translate ( 'Burial of a father'), '_BURI_SIBL'=>i18n::translate ( 'Burial of a brother'), '_BURI_SPOU'=>i18n::translate ( 'Burial of a husband'), '_CHR_CHIL'=>i18n::translate ( 'Christening of a son'), @@ -1517,6 +1511,7 @@ $FACTS_M=array( '_CREM_GPA1'=>i18n::translate ( 'Cremation of a paternal grandfather'), '_CREM_GPA2'=>i18n::translate ( 'Cremation of a maternal grandfather'), '_CREM_HSIB'=>i18n::translate ( 'Cremation of a half-brother'), + '_CREM_PARE'=>i18n::translate ( 'Cremation of a father'), '_CREM_SIBL'=>i18n::translate ( 'Cremation of a brother'), '_CREM_SPOU'=>i18n::translate ( 'Cremation of a husband'), '_DEAT_CHIL'=>i18n::translate ( 'Death of a son'), @@ -1527,12 +1522,14 @@ $FACTS_M=array( '_DEAT_GPA1'=>i18n::translate ( 'Death of a paternal grandfather'), '_DEAT_GPA2'=>i18n::translate ( 'Death of a maternal grandfather'), '_DEAT_HSIB'=>i18n::translate ( 'Death of a half-brother'), + '_DEAT_PARE'=>i18n::translate ( 'Death of a father'), '_DEAT_SIBL'=>i18n::translate ( 'Death of a brother'), '_DEAT_SPOU'=>i18n::translate ( 'Death of a husband'), '_MARB_CHIL'=>i18n::translate ( 'Marriage Banns of a son'), '_MARB_GCHI'=>i18n::translate ( 'Marriage Banns of a grandson'), '_MARB_GCH1'=>i18n::translate_c('daughter\'s son', 'Marriage banns of a grandson'), '_MARB_GCH2'=>i18n::translate_c('son\'s son', 'Marriage banns of a grandson'), + '_MARB_PARE'=>i18n::translate ( 'Marriage banns of a father'), '_MARB_HSIB'=>i18n::translate ( 'Marriage Banns of a half-brother'), '_MARB_SIBL'=>i18n::translate ( 'Marriage Banns of a brother'), '_MARR_CHIL'=>i18n::translate ( 'Marriage of a son'), @@ -1540,6 +1537,7 @@ $FACTS_M=array( '_MARR_GCH1'=>i18n::translate_c('daughter\'s son', 'Marriage of a grandson'), '_MARR_GCH2'=>i18n::translate_c('son\'s son', 'Marriage of a grandson'), '_MARR_HSIB'=>i18n::translate ( 'Marriage of a half-brother'), + '_MARR_PARE'=>i18n::translate ( 'Marriage of a father'), '_MARR_SIBL'=>i18n::translate ( 'Marriage of a brother'), // this person facts '_ADPF' =>i18n::translate_c('MALE', 'Adopted by father'), @@ -1566,7 +1564,7 @@ $FACTS_F=array( '_BAPM_GCH1'=>i18n::translate_c('daughter\'s daughter','Baptism of a granddaughter'), '_BAPM_GCH2'=>i18n::translate_c('son\'s daughter', 'Baptism of a granddaughter'), '_BAPM_HSIB'=>i18n::translate ( 'Baptism of a half-sister'), - '_BAPM_SIBL'=>i18n::translate ( 'Baptism of sister'), + '_BAPM_SIBL'=>i18n::translate ( 'Baptism of a sister'), '_BIRT_CHIL'=>i18n::translate ( 'Birth of a daughter'), '_BIRT_GCHI'=>i18n::translate ( 'Birth of a granddaughter'), '_BIRT_GCH1'=>i18n::translate_c('daughter\'s daughter','Birth of a granddaughter'), @@ -1581,6 +1579,7 @@ $FACTS_F=array( '_BURI_GPA1'=>i18n::translate ( 'Burial of a paternal grandmother'), '_BURI_GPA2'=>i18n::translate ( 'Burial of a maternal grandmother'), '_BURI_HSIB'=>i18n::translate ( 'Burial of a half-sister'), + '_BURI_PARE'=>i18n::translate ( 'Burial of a mother'), '_BURI_SIBL'=>i18n::translate ( 'Burial of a sister'), '_BURI_SPOU'=>i18n::translate ( 'Burial of a wife'), '_CHR_CHIL'=>i18n::translate ( 'Christening of a daughter'), @@ -1597,9 +1596,11 @@ $FACTS_F=array( '_CREM_GPA1'=>i18n::translate ( 'Cremation of a paternal grandmother'), '_CREM_GPA2'=>i18n::translate ( 'Cremation of a maternal grandmother'), '_CREM_HSIB'=>i18n::translate ( 'Cremation of a half-sister'), + '_CREM_PARE'=>i18n::translate ( 'Cremation of a mother'), '_CREM_SIBL'=>i18n::translate ( 'Cremation of a sister'), '_CREM_SPOU'=>i18n::translate ( 'Cremation of a wife'), '_DEAT_CHIL'=>i18n::translate ( 'Death of a daughter'), + '_DEAT_PARE'=>i18n::translate ( 'Death of a mother'), '_DEAT_GCHI'=>i18n::translate ( 'Death of a granddaughter'), '_DEAT_GCH1'=>i18n::translate_c('daughter\'s daughter','Death of a granddaughter'), '_DEAT_GCH2'=>i18n::translate_c('son\'s daughter', 'Death of a granddaughter'), @@ -1614,12 +1615,14 @@ $FACTS_F=array( '_MARB_GCH1'=>i18n::translate_c('daughter\'s daughter','Marriage banns of a granddaughter'), '_MARB_GCH2'=>i18n::translate_c('son\'s daughter', 'Marriage banns of a granddaughter'), '_MARB_HSIB'=>i18n::translate ( 'Marriage banns of a half-sister'), - '_MARB_SIBL'=>i18n::translate ( 'Marriage Banns of sister'), + '_MARB_PARE'=>i18n::translate ( 'Marriage banns of a mother'), + '_MARB_SIBL'=>i18n::translate ( 'Marriage banns of a sister'), '_MARR_CHIL'=>i18n::translate ( 'Marriage of a daughter'), '_MARR_GCHI'=>i18n::translate ( 'Marriage of a granddaughter'), '_MARR_GCH1'=>i18n::translate_c('daughter\'s daughter','Marriage of a granddaughter'), '_MARR_GCH2'=>i18n::translate_c('son\'s daughter', 'Marriage of a granddaughter'), '_MARR_HSIB'=>i18n::translate ( 'Marriage of a half-sister'), + '_MARR_PARE'=>i18n::translate ( 'Marriage of a mother'), '_MARR_SIBL'=>i18n::translate ( 'Marriage of a sister'), // this person facts '_ADPF' =>i18n::translate_c('FEMALE', 'Adopted by father'), diff --git a/includes/db_schema/db_schema_5_6.php b/includes/db_schema/db_schema_5_6.php new file mode 100644 index 0000000000..945d79c809 --- /dev/null +++ b/includes/db_schema/db_schema_5_6.php @@ -0,0 +1,59 @@ +<?php +/** + * Update the database schema from version 5 to version 6 + * - changes to the values for the gedcom setting SHOW_RELATIVES_EVENTS + * + * The script should assume that it can be interrupted at + * any point, and be able to continue by re-running the script. + * Fatal errors, however, should be allowed to throw exceptions, + * which will be caught by the framework. + * It shouldn't do anything that might take more than a few + * seconds, for systems with low timeout values. + * + * phpGedView: Genealogy Viewer + * Copyright (C) 2010 Greg Roach + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Id$ + */ + +if (!defined('WT_WEBTREES')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} + +define('WT_DB_SCHEMA_5_6', ''); + +$settings=self::prepare( + "SELECT gedcom_id, setting_value FROM `##gedcom_setting` WHERE setting_name='SHOW_RELATIVES_EVENTS'" +)->fetchAssoc(); + +foreach ($settings as $gedcom_id=>$setting) { + // Delete old settings + $setting=preg_replace('/_(BIRT|MARR|DEAT)_(COUS|MSIB|FSIB|GGCH|NEPH|GGPA)/', '', $setting); + $setting=preg_replace('/_FAMC_(RESI_EMIG)/', '', $setting); + // Rename settings + $setting=preg_replace('/_MARR_(MOTH|FATH|FAMC)/', '_MARR_PARE', $setting); + $setting=preg_replace('/_DEAT_(MOTH|FATH)/', '_DEAT_PARE', $setting); + // Remove duplicates + preg_match_all('/[_A-Z]+/', $setting, $match); + // And save + set_gedcom_setting($gedcom_id, 'SHOW_RELATIVES_EVENTS', implode(',', array_unique($match[0]))); +} + +// Update the version to indicate success +set_site_setting($schema_name, $next_version); + diff --git a/includes/session.php b/includes/session.php index 20d4f01cb6..9b28ec6261 100644 --- a/includes/session.php +++ b/includes/session.php @@ -48,7 +48,7 @@ define('WT_DEBUG_SQL', false); define('WT_ERROR_LEVEL', 2); // 0=none, 1=minimal, 2=full // Required version of database tables/columns/indexes/etc. -define('WT_SCHEMA_VERSION', 5); +define('WT_SCHEMA_VERSION', 6); // Regular expressions for validating user input, etc. define('WT_REGEX_XREF', '[A-Za-z0-9:_-]+'); diff --git a/includes/set_gedcom_defaults.php b/includes/set_gedcom_defaults.php index f9f47df1d2..75d4131499 100644 --- a/includes/set_gedcom_defaults.php +++ b/includes/set_gedcom_defaults.php @@ -130,7 +130,7 @@ set_gedcom_setting($ged_id, 'SHOW_PARENTS_AGE', true); set_gedcom_setting($ged_id, 'SHOW_PEDIGREE_PLACES', '9'); set_gedcom_setting($ged_id, 'SHOW_PRIVATE_RELATIONSHIPS', false); set_gedcom_setting($ged_id, 'SHOW_REGISTER_CAUTION', true); -set_gedcom_setting($ged_id, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_GCHI,_BIRT_HSIB,_BIRT_SIBL,_DEAT_CHIL,_DEAT_FATH,_DEAT_GCHI,_DEAT_GPAR,_DEAT_MOTH,_DEAT_SIBL,_DEAT_SPOU,_MARR_CHIL,_MARR_FATH,_MARR_GCHI,_MARR_MOTH'); +set_gedcom_setting($ged_id, 'SHOW_RELATIVES_EVENTS', '_BIRT_CHIL,_BIRT_SIBL,_MARR_CHIL,_MARR_PARE,_DEAT_CHIL,_DEAT_PARE,_DEAT_GPAR,_DEAT_SIBL,_DEAT_SPOU'); set_gedcom_setting($ged_id, 'SHOW_SPIDER_TAGLINE', true); set_gedcom_setting($ged_id, 'SHOW_STATS', false); set_gedcom_setting($ged_id, 'SOURCE_ID_PREFIX', 'S'); diff --git a/pgv_to_wt.php b/pgv_to_wt.php index f1eba2b0ae..1c57084f69 100644 --- a/pgv_to_wt.php +++ b/pgv_to_wt.php @@ -692,6 +692,15 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) { @set_gedcom_setting($ged_id, 'SHOW_PEDIGREE_PLACES', $SHOW_PEDIGREE_PLACES); @set_gedcom_setting($ged_id, 'SHOW_PRIVATE_RELATIONSHIPS', $SHOW_PRIVATE_RELATIONSHIPS); @set_gedcom_setting($ged_id, 'SHOW_REGISTER_CAUTION', $SHOW_REGISTER_CAUTION); + + // Update these - see db_schema_5_6.php + $SHOW_RELATIVES_EVENTS=preg_replace('/_(BIRT|MARR|DEAT)_(COUS|MSIB|FSIB|GGCH|NEPH|GGPA)/', '', $SHOW_RELATIVES_EVENTS); + $SHOW_RELATIVES_EVENTS=preg_replace('/_FAMC_(RESI_EMIG)/', '', $SHOW_RELATIVES_EVENTS); + $SHOW_RELATIVES_EVENTS=preg_replace('/_MARR_(MOTH|FATH|FAMC)/', '_MARR_PARE', $SHOW_RELATIVES_EVENTS); + $SHOW_RELATIVES_EVENTS=preg_replace('/_DEAT_(MOTH|FATH)/', '_DEAT_PARE', $SHOW_RELATIVES_EVENTS); + preg_match_all('/[_A-Z]+/', $setting, $match); + set_gedcom_setting($gedcom_id, 'SHOW_RELATIVES_EVENTS', implode(',', array_unique($match[0]))); + @set_gedcom_setting($ged_id, 'SHOW_RELATIVES_EVENTS', $SHOW_RELATIVES_EVENTS); @set_gedcom_setting($ged_id, 'SHOW_SPIDER_TAGLINE', $SHOW_SPIDER_TAGLINE); @set_gedcom_setting($ged_id, 'SHOW_STATS', $SHOW_STATS); @@ -970,7 +970,7 @@ try { ); $dbh->exec( "INSERT IGNORE INTO `{$TBLPREFIX}site_setting` (setting_name, setting_value) VALUES ". - "('WT_SCHEMA_VERSION', '5'),". + "('WT_SCHEMA_VERSION', '6'),". "('INDEX_DIRECTORY', 'data/'),". "('STORE_MESSAGES', '1'),". "('USE_REGISTRATION_MODULE', '1'),". |
