summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-12-31 11:35:54 +0000
committerfisharebest <fisharebest@gmail.com>2010-12-31 11:35:54 +0000
commit300ad724732c48027bebb79784a768f4fa3c0332 (patch)
tree6cc4fb57d1276d9dbb1f813d5d8163f822c3fd45
parent941901536e305480a12196aad94ea90c5fb00cee (diff)
downloadwebtrees-300ad724732c48027bebb79784a768f4fa3c0332.tar.gz
webtrees-300ad724732c48027bebb79784a768f4fa3c0332.tar.bz2
webtrees-300ad724732c48027bebb79784a768f4fa3c0332.zip
Fix: pending changes to source facts cause all other facts to show as new.
-rw-r--r--includes/controllers/source_ctrl.php41
-rw-r--r--source.php2
2 files changed, 14 insertions, 29 deletions
diff --git a/includes/controllers/source_ctrl.php b/includes/controllers/source_ctrl.php
index 93f32b05fd..961aafd6ba 100644
--- a/includes/controllers/source_ctrl.php
+++ b/includes/controllers/source_ctrl.php
@@ -39,7 +39,6 @@ require_once WT_ROOT.'includes/functions/functions_import.php';
class SourceController extends BaseController {
var $sid;
var $source = null;
- var $uname = "";
var $diffsource = null;
var $accept_success = false;
var $canedit = false;
@@ -47,16 +46,16 @@ class SourceController extends BaseController {
function init() {
$this->sid = safe_GET_xref('sid');
- $sourcerec = find_source_record($this->sid, WT_GED_ID);
+ $gedrec = find_source_record($this->sid, WT_GED_ID);
- if (find_updated_record($this->sid, WT_GED_ID)!==null) {
- $sourcerec = "0 @".$this->sid."@ SOUR\n";
- } else if (!$sourcerec) {
+ if (find_source_record($this->sid, WT_GED_ID) || find_updated_record($this->sid, WT_GED_ID)!==null) {
+ $this->source = new Source($gedrec);
+ $this->source->ged_id=WT_GED_ID; // This record is from a file
+ } else if (!$gedrec) {
return false;
}
- $this->source = new Source($sourcerec);
- $this->source->ged_id=WT_GED_ID; // This record is from a file
+ $this->rid=$this->source->getXref(); // Correct upper/lower case mismatch
if (!$this->source->canDisplayDetails()) {
print_header(i18n::translate('Source'));
@@ -65,10 +64,6 @@ class SourceController extends BaseController {
exit;
}
- $this->uname = WT_USER_NAME;
-
- $this->sid=$this->source->getXref(); // Correct upper/lower case mismatch
-
//-- perform the desired action
switch($this->action) {
case 'addfav':
@@ -118,19 +113,16 @@ class SourceController 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->sid, WT_GED_ID))!==null) {
- $this->diffsource = new Source($newrec);
- $this->diffsource->setChanged(true);
- $sourcerec = $newrec;
- }
-
- if ($this->source->canDisplayDetails()) {
- $this->canedit = WT_USER_CAN_EDIT;
+ if ($this->show_changes && WT_USER_CAN_EDIT) {
+ $newrec = find_updated_record($this->sid, WT_GED_ID);
+ if (!empty($newrec)) {
+ $this->diffsource = new Source($newrec);
+ $this->diffsource->setChanged(true);
+ }
}
- if ($this->show_changes && $this->canedit) {
+ if ($this->show_changes) {
$this->source->diffMerge($this->diffsource);
}
}
@@ -146,13 +138,6 @@ class SourceController 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
diff --git a/source.php b/source.php
index d5388b0f45..7b8c737cca 100644
--- a/source.php
+++ b/source.php
@@ -86,7 +86,7 @@ foreach ($sourcefacts as $fact) {
print_main_media($controller->sid);
// new fact link
-if ($controller->userCanEdit()) {
+if ($controller->source->canEdit()) {
print_add_new_fact($controller->sid, $sourcefacts, 'SOUR');
// new media
echo '<tr><td class="descriptionbox ', $TEXT_DIRECTION, '">';