Commit c255f68934855e1b39c6fc6715486899fc4edb63

Authored by Neil Blakey-Milner
1 parent 4e113591

KTS220 - fix metadata search to use metadata version ID instead of

document ID.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4686 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 3 additions and 3 deletions
lib/browse/Criteria.inc
@@ -396,9 +396,9 @@ class GenericMetadataCriterion extends BrowseCriterion { @@ -396,9 +396,9 @@ class GenericMetadataCriterion extends BrowseCriterion {
396 global $default; 396 global $default;
397 $sQuery = "SELECT DFL.value as value " . 397 $sQuery = "SELECT DFL.value as value " .
398 "FROM $default->document_fields_link_table AS DFL " . 398 "FROM $default->document_fields_link_table AS DFL " .
399 - "WHERE DFL.document_id = ? " . 399 + "WHERE DFL.metadata_version_id = ? " .
400 "AND DFL.document_field_id = ?"; 400 "AND DFL.document_field_id = ?";
401 - $aParams = array($oDocument->getID(), $this->getID()); 401 + $aParams = array($oDocument->getMetadataVersionId(), $this->getID());
402 402
403 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'value'); 403 $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'value');
404 if (PEAR::isError($res)) { 404 if (PEAR::isError($res)) {
@@ -453,7 +453,7 @@ class GenericMetadataCriterion extends BrowseCriterion { @@ -453,7 +453,7 @@ class GenericMetadataCriterion extends BrowseCriterion {
453 453
454 function searchJoinSQL () { 454 function searchJoinSQL () {
455 global $default; 455 global $default;
456 - return "LEFT JOIN $default->document_fields_link_table AS $this->sSearchTable ON $this->sSearchTable.document_id = D.id"; 456 + return "LEFT JOIN $default->document_fields_link_table AS $this->sSearchTable ON $this->sSearchTable.metadata_version_id = D.metadata_version_id";
457 } 457 }
458 } 458 }
459 459