diff options
| author | fisharebest <fisharebest@gmail.com> | 2010-12-31 11:28:10 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2010-12-31 11:28:10 +0000 |
| commit | 941901536e305480a12196aad94ea90c5fb00cee (patch) | |
| tree | 2b7cbee092270dd0e6a371d4e5a08ce25fa64628 /includes/controllers | |
| parent | e1f47ec49abf8b33dccc315555ebe52694d6e6d5 (diff) | |
| download | webtrees-941901536e305480a12196aad94ea90c5fb00cee.tar.gz webtrees-941901536e305480a12196aad94ea90c5fb00cee.tar.bz2 webtrees-941901536e305480a12196aad94ea90c5fb00cee.zip | |
Fix: pending changes to repository facts cause all other facts to show as new.
Diffstat (limited to 'includes/controllers')
| -rw-r--r-- | includes/controllers/repository_ctrl.php | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/includes/controllers/repository_ctrl.php b/includes/controllers/repository_ctrl.php index 6f0ece4e4a..1a535fbfce 100644 --- a/includes/controllers/repository_ctrl.php +++ b/includes/controllers/repository_ctrl.php @@ -39,7 +39,6 @@ require_once WT_ROOT.'includes/functions/functions_import.php'; class RepositoryController extends BaseController { var $rid; var $repository = null; - var $uname = ""; var $diffrepository = null; var $accept_success = false; var $canedit = false; @@ -47,16 +46,16 @@ class RepositoryController extends BaseController { function init() { $this->rid = safe_GET_xref('rid'); - $repositoryrec = find_other_record($this->rid, WT_GED_ID); + $gedrec = find_other_record($this->rid, WT_GED_ID); - if (find_updated_record($this->rid, WT_GED_ID)!==null) { - $repositoryrec = "0 @".$this->rid."@ REPO\n"; - } else if (!$repositoryrec) { + if (find_other_record($this->rid, WT_GED_ID) || find_updated_record($this->rid, WT_GED_ID)!==null) { + $this->repository = new Repository($gedrec); + $this->repository->ged_id=WT_GED_ID; // This record is from a file + } else if (!$gedrec) { return false; } - $this->repository = new Repository($repositoryrec); - $this->repository->ged_id=WT_GED_ID; // This record is from a file + $this->rid=$this->repository->getXref(); // Correct upper/lower case mismatch if (!$this->repository->canDisplayDetails()) { print_header(i18n::translate('Repository')); @@ -65,10 +64,6 @@ class RepositoryController extends BaseController { exit; } - $this->uname = WT_USER_NAME; - - $this->rid=$this->repository->getXref(); // Correct upper/lower case mismatch - //-- perform the desired action switch($this->action) { case 'addfav': @@ -118,19 +113,16 @@ class RepositoryController extends BaseController { break; } - //-- check for the user //-- if the user can edit and there are changes then get the new changes - if ($this->show_changes && WT_USER_CAN_EDIT && ($newrec = find_updated_record($this->rid, WT_GED_ID))!==null) { - $this->diffrepository = new Repository($newrec); - $this->diffrepository->setChanged(true); - $repositoryrec = $newrec; - } - - if ($this->repository->canDisplayDetails()) { - $this->canedit = WT_USER_CAN_EDIT; + if ($this->show_changes && WT_USER_CAN_EDIT) { + $newrec = find_updated_record($this->rid, WT_GED_ID); + if (!empty($newrec)) { + $this->diffrepository = new Repository($newrec); + $this->diffrepository->setChanged(true); + } } - if ($this->show_changes && $this->canedit) { + if ($this->show_changes) { $this->repository->diffMerge($this->diffrepository); } } @@ -146,13 +138,6 @@ class RepositoryController extends BaseController { return i18n::translate('Unable to find record with ID'); } } - /** - * check if use can edit this person - * @return boolean - */ - function userCanEdit() { - return $this->canedit; - } /** * get edit menu |
