diff options
| author | fisharebest <fisharebest@gmail.com> | 2010-12-30 20:46:30 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2010-12-30 20:46:30 +0000 |
| commit | a446c1db652269a63c279dcf49182f68f950aa82 (patch) | |
| tree | 0069384cbf932af208fba3492a8aaf5d1367f859 | |
| parent | 82e0f870dcce85221ca71cbd70a973097242aafa (diff) | |
| download | webtrees-a446c1db652269a63c279dcf49182f68f950aa82.tar.gz webtrees-a446c1db652269a63c279dcf49182f68f950aa82.tar.bz2 webtrees-a446c1db652269a63c279dcf49182f68f950aa82.zip | |
Fix: pending changes to family facts cause all other facts to show as new.
| -rw-r--r-- | includes/controllers/family_ctrl.php | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/includes/controllers/family_ctrl.php b/includes/controllers/family_ctrl.php index 217af93a81..7a9a9e06fb 100644 --- a/includes/controllers/family_ctrl.php +++ b/includes/controllers/family_ctrl.php @@ -60,20 +60,18 @@ class FamilyController extends BaseController { $this->famid = safe_GET_xref('famid'); - $this->family = Family::getInstance($this->famid); + $gedrec = find_family_record($this->famid, WT_GED_ID); - if (empty($this->famrec)) { - //-- if no record was found create a default empty one - if (find_updated_record($this->famid, WT_GED_ID)!==null) { - $this->famrec = "0 @".$this->famid."@ FAM\n"; - $this->family = new Family($this->famrec); - } else if (!$this->family) { - return false; - } + if (empty($gedrec)) { + $gedrec = "0 @".$this->famid."@ FAM\n"; } - $this->famrec = $this->family->getGedcomRecord(); - $this->display = $this->family->canDisplayName(); + if (find_family_record($this->famid, WT_GED_ID) || find_updated_record($this->famid, WT_GED_ID)!==null) { + $this->family = new Family($gedrec); + $this->family->ged_id=WT_GED_ID; // This record is from a file + } else if (!$this->family) { + return false; + } $this->famid=$this->family->getXref(); // Correct upper/lower case mismatch @@ -127,12 +125,18 @@ class FamilyController extends BaseController { } //-- if the user can edit and there are changes then get the new changes - if ($this->show_changes && WT_USER_CAN_EDIT && find_updated_record($this->famid, WT_GED_ID)!==null) { - $newrec = find_gedcom_record($this->famid, WT_GED_ID, true); - $this->difffam = new Family($newrec); - $this->difffam->setChanged(true); + if ($this->show_changes && WT_USER_CAN_EDIT) { + $newrec = find_updated_record($this->famid, WT_GED_ID); + if (!empty($newrec)) { + $this->difffam = new Family($newrec); + $this->difffam->setChanged(true); + } + } + + if ($this->show_changes) { $this->family->diffMerge($this->difffam); } + $this->parents = array('HUSB'=>$this->family->getHusbId(), 'WIFE'=>$this->family->getWifeId()); //-- check if we can display both parents @@ -141,12 +145,6 @@ class FamilyController extends BaseController { $this->showLivingWife = showLivingNameById($this->parents['WIFE']); } - //-- make sure we have the true id from the record - $ct = preg_match("/0 @(.*)@/", $this->famrec, $match); - if ($ct > 0) { - $this->famid = trim($match[1]); - } - if ($this->showLivingHusb == false && $this->showLivingWife == false) { print_header(i18n::translate('Family')); print_privacy_error(); @@ -165,10 +163,6 @@ class FamilyController extends BaseController { return $this->famid; } - function getFamilyRecord() { - return $this->famrec; - } - function getHusband() { if (!is_null($this->difffam)) return $this->difffam->getHusbId(); if ($this->family) return $this->parents['HUSB']; |
