Commit f3b480c1f1c13e8b38d4e3d4c5b3cb86d3cffce9

Authored by rob
1 parent e84609a2

Updated queries to take advantage of new db search tables


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1738 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/search/advancedSearchBL.php
... ... @@ -111,16 +111,19 @@ function getApprovedDocumentString($sMetaTagIDs, $sSQLSearchString) {
111 111 $aApprovedDocumentIDs = array();
112 112 $sQuery = "SELECT DISTINCT D.id " .
113 113 "FROM documents AS D INNER JOIN document_fields_link AS DFL ON DFL.document_id = D.id " .
114   - "INNER JOIN document_fields AS DF ON DF.id = DFL.document_field_id " .
  114 + "INNER JOIN document_fields AS DF ON DF.id = DFL.document_field_id " .
  115 + "INNER JOIN search_document_user_link AS SDUL ON SDUL.document_id = D.ID " .
115 116 "WHERE DF.ID IN ($sMetaTagIDs) " .
116   - "AND " . $sSQLSearchString;
117   -
  117 + "AND " . $sSQLSearchString . " " .
  118 + "AND SDUL.user_id = " . $_SESSION["userID"];
  119 +
118 120 $sql = $default->db;
119 121 $sql->query($sQuery);
120 122 while ($sql->next_record()) {
121   - if (Permission::userHasDocumentReadPermission($sql->f("id"))) {
  123 + /*if (Permission::userHasDocumentReadPermission($sql->f("id"))) {
122 124 $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id");
123   - }
  125 + }*/
  126 + $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id");
124 127 }
125 128 if (count($aApprovedDocuments) > 1) {
126 129 return implode(",",$aApprovedDocuments);
... ...