Commit 3c44a61a40832d2de6e71b9b0a09980c8b92023b

Authored by nbm
1 parent 7d7a7a90

Add searchJoinSQL method, which adds joins to the advanced search query.

Also differentiate joins and searches for each metadata criterion
involved in the search, so one can search for more than one metadata
criterion at a time.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3287 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 10 additions and 1 deletions
lib/browse/Criteria.inc
... ... @@ -172,6 +172,10 @@ class BrowseCriterion {
172 172 return array($this->getSearchTable() . "." . $this->getSearchField() . " = ?", array($aRequest[$this->getWidgetBase()]));
173 173 }
174 174 }
  175 +
  176 + function searchJoinSQL () {
  177 + return null;
  178 + }
175 179 }
176 180  
177 181 class NameCriterion extends BrowseCriterion {
... ... @@ -337,12 +341,12 @@ class GenericMetadataCriterion extends BrowseCriterion {
337 341 "joinColumn" => "document_id",
338 342 );
339 343 var $bString = true;
340   - var $sSearchTable = "DFL";
341 344  
342 345 function GenericMetadataCriterion ($sDisplay, $sDocumentField, $sSortField, $iID) {
343 346 $this->BrowseCriterion($sDisplay, $sDocumentField, $sSortField, $iID);
344 347 $this->aLookup['whereClause'] = 'document_field_id = ' . $iID;
345 348 $this->oField =& DocumentField::get($iID);
  349 + $this->sSearchTable = "DFL" . $iID;
346 350 }
347 351  
348 352 function documentDisplay ($oDocument) {
... ... @@ -387,6 +391,11 @@ class GenericMetadataCriterion extends BrowseCriterion {
387 391 $sRet .= "</select>\n";
388 392 return $sRet;
389 393 }
  394 +
  395 + function searchJoinSQL () {
  396 + global $default;
  397 + return "LEFT JOIN $default->document_fields_link_table AS $this->sSearchTable ON $this->sSearchTable.document_id = D.id";
  398 + }
390 399 }
391 400  
392 401 class DateModifiedCriterion extends DateCreatedCriterion {
... ...