Commit 2371fb386ecfd086275665c30fd169c5fbf86158

Authored by Michael Joseph
1 parent f4e03b42

removed commented out code

only search for live documents


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1961 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/search/advancedSearchBL.php
1 1 <?php
2 2 /**
3   -* Business logic used to perform advanced search. Advanced search allows
4   -* users to search by meta data types
5   -*
6   -* @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd
7   -* @date 26 February 2003
8   -* @package presentation.knowledgeTree.search
9   -*/
  3 + * $Id$
  4 + *
  5 + * Business logic used to perform advanced search. Advanced search allows
  6 + * users to search by meta data types
  7 + *
  8 + * @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd
  9 + * @date 26 February 2003
  10 + * @package presentation.knowledgeTree.search
  11 + */
10 12  
11 13 require_once("../../../../config/dmsDefaults.php");
12 14  
... ... @@ -22,7 +24,6 @@ if (checkSession()) {
22 24  
23 25 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
24 26  
25   - //if (isset($fForSearch)) {
26 27 if (strlen($fSearchString) > 0) {
27 28 if (strlen($fSearchString) > 0) {
28 29 //display search results
... ... @@ -36,15 +37,13 @@ if (checkSession()) {
36 37 $oPatternCustom = & new PatternCustom();
37 38 if (!isset($fStartIndex)) {
38 39 $fStartIndex = 0;
39   - }
40   - //$oPatternCustom->setHtml(getSearchResults($sDocument,$fStartIndex, $fSearchString, $sMetaTagIDs));
  40 + }
41 41 $oPatternCustom->setHtml(getSearchResults($sMetaTagIDs,$sSQLSearchString, $fStartIndex));
42 42 $main->setCentralPayload($oPatternCustom);
43 43 $main->render();
44 44 } else {
45 45 $oPatternCustom = & new PatternCustom();
46 46 $oPatternCustom->setHtml(getSearchPage($fSearchString, explode(",",$sMetaTagIDs)));
47   - //$oPatternCustom->setHtml(getSearchResults($sMetaTagIDs,$sSQLSearchString, $fStartIndex));
48 47 $main->setCentralPayload($oPatternCustom);
49 48 $main->setErrorMessage("No documents matched your search criteria");
50 49 $main->setFormAction("advancedSearchBL.php?fForSearch=1");
... ... @@ -115,17 +114,16 @@ function getApprovedDocumentString($sMetaTagIDs, $sSQLSearchString) {
115 114 $sQuery = "SELECT DISTINCT D.id " .
116 115 "FROM documents AS D INNER JOIN document_fields_link AS DFL ON DFL.document_id = D.id " .
117 116 "INNER JOIN document_fields AS DF ON DF.id = DFL.document_field_id " .
118   - "INNER JOIN search_document_user_link AS SDUL ON SDUL.document_id = D.ID " .
  117 + "INNER JOIN search_document_user_link AS SDUL ON SDUL.document_id = D.ID " .
  118 + "INNER JOIN status_lookup AS SL on D.status_id=SL.id " .
119 119 "WHERE DF.ID IN ($sMetaTagIDs) " .
120 120 "AND " . $sSQLSearchString . " " .
  121 + "AND SL.name='Live' " .
121 122 "AND SDUL.user_id = " . $_SESSION["userID"];
122   -
  123 + $default->log->info("search doc query=$sQuery");
123 124 $sql = $default->db;
124 125 $sql->query($sQuery);
125 126 while ($sql->next_record()) {
126   - /*if (Permission::userHasDocumentReadPermission($sql->f("id"))) {
127   - $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id");
128   - }*/
129 127 $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id");
130 128 }
131 129 if (count($aApprovedDocuments) > 1) {
... ... @@ -147,6 +145,5 @@ function getSQLSearchString($sSearchString) {
147 145 }
148 146 $sSQLSearchString .= "(DFL.value LIKE '%" . $aWords[count($aWords) -1] . "%')";
149 147 return $sSQLSearchString;
150   -}
151   -
152   -?>
  148 +}
  149 +?>
153 150 \ No newline at end of file
... ...