Commit f3270f423cddea76121b3f0bb0893527604dab27

Authored by Megan Watson
1 parent ed4d76e5

KTS-2876

"On comparing the metadata history between 2 versions, the selected version is always the current one"
Fixed. When getting the field values it was using the wrong metadata id.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7972 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 8 additions and 6 deletions
view.php
@@ -115,9 +115,9 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -115,9 +115,9 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
115 $oDocument =& Document::get($document_id); 115 $oDocument =& Document::get($document_id);
116 if (PEAR::isError($oDocument)) { 116 if (PEAR::isError($oDocument)) {
117 $this->oPage->addError(sprintf(_kt("The document you attempted to retrieve is invalid. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl())); 117 $this->oPage->addError(sprintf(_kt("The document you attempted to retrieve is invalid. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl()));
118 - 118 +
119 $this->oPage->booleanLink = true; 119 $this->oPage->booleanLink = true;
120 - 120 +
121 return $this->do_error(); 121 return $this->do_error();
122 } 122 }
123 $document_id = $oDocument->getId(); 123 $document_id = $oDocument->getId();
@@ -263,7 +263,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -263,7 +263,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
263 function do_viewComparison() { 263 function do_viewComparison() {
264 264
265 $document_data = array(); 265 $document_data = array();
266 - $document_id = sanitizeForSQL(KTUtil::arrayGet($_REQUEST, 'fDocumentId')); 266 + $document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
267 if ($document_id === null) { 267 if ($document_id === null) {
268 $this->oPage->addError(sprintf(_kt("No document was requested. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl())); 268 $this->oPage->addError(sprintf(_kt("No document was requested. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl()));
269 return $this->do_error(); 269 return $this->do_error();
@@ -271,7 +271,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -271,7 +271,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
271 271
272 $document_data['document_id'] = $document_id; 272 $document_data['document_id'] = $document_id;
273 273
274 - $base_version = sanitizeForSQL(KTUtil::arrayGet($_REQUEST, 'fBaseVersion')); 274 + $base_version = KTUtil::arrayGet($_REQUEST, 'fBaseVersion');
275 275
276 // try get the document. 276 // try get the document.
277 $oDocument =& Document::get($document_id, $base_version); 277 $oDocument =& Document::get($document_id, $base_version);
@@ -296,7 +296,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -296,7 +296,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
296 $this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions)); 296 $this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions));
297 $this->oPage->setBreadcrumbDetails(_kt('compare versions')); 297 $this->oPage->setBreadcrumbDetails(_kt('compare versions'));
298 298
299 - $comparison_version = sanitizeForSQL(KTUtil::arrayGet($_REQUEST, 'fComparisonVersion')); 299 + $comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion');
300 if ($comparison_version=== null) { 300 if ($comparison_version=== null) {
301 $this->oPage->addError(sprintf(_kt("No comparison version was requested. Please <a href=\"%s\">select a version</a>."), KTUtil::addQueryStringSelf('action=history&fDocumentId=' . $document_id))); 301 $this->oPage->addError(sprintf(_kt("No comparison version was requested. Please <a href=\"%s\">select a version</a>."), KTUtil::addQueryStringSelf('action=history&fDocumentId=' . $document_id)));
302 return $this->do_error(); 302 return $this->do_error();
@@ -306,6 +306,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -306,6 +306,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
306 if (PEAR::isError($oComparison)) { 306 if (PEAR::isError($oComparison)) {
307 $this->errorRedirectToMain(_kt('Invalid document to compare against.')); 307 $this->errorRedirectToMain(_kt('Invalid document to compare against.'));
308 } 308 }
  309 +
309 $comparison_data = array(); 310 $comparison_data = array();
310 $comparison_data['document_id'] = $oComparison->getId(); 311 $comparison_data['document_id'] = $oComparison->getId();
311 312
@@ -324,13 +325,14 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -324,13 +325,14 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
324 } 325 }
325 326
326 // we want to grab all the md for this doc, since its faster that way. 327 // we want to grab all the md for this doc, since its faster that way.
327 - $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($oDocument->getMetadataVersionId()))); 328 + $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($base_version)));
328 329
329 $field_values = array(); 330 $field_values = array();
330 foreach ($mdlist as $oFieldLink) { 331 foreach ($mdlist as $oFieldLink) {
331 $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue(); 332 $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue();
332 } 333 }
333 334
  335 +
334 $document_data['field_values'] = $field_values; 336 $document_data['field_values'] = $field_values;
335 $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($comparison_version))); 337 $mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($comparison_version)));
336 338