Commit d70519d0d5acbaa0d5e8edfe8873ddd616bc52b3
1 parent
e033420b
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
Showing
1 changed file
with
16 additions
and
19 deletions
presentation/lookAndFeel/knowledgeTree/search/advancedSearchBL.php
| 1 | <?php | 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 | require_once("../../../../config/dmsDefaults.php"); | 13 | require_once("../../../../config/dmsDefaults.php"); |
| 12 | 14 | ||
| @@ -22,7 +24,6 @@ if (checkSession()) { | @@ -22,7 +24,6 @@ if (checkSession()) { | ||
| 22 | 24 | ||
| 23 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 25 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 24 | 26 | ||
| 25 | - //if (isset($fForSearch)) { | ||
| 26 | if (strlen($fSearchString) > 0) { | 27 | if (strlen($fSearchString) > 0) { |
| 27 | if (strlen($fSearchString) > 0) { | 28 | if (strlen($fSearchString) > 0) { |
| 28 | //display search results | 29 | //display search results |
| @@ -36,15 +37,13 @@ if (checkSession()) { | @@ -36,15 +37,13 @@ if (checkSession()) { | ||
| 36 | $oPatternCustom = & new PatternCustom(); | 37 | $oPatternCustom = & new PatternCustom(); |
| 37 | if (!isset($fStartIndex)) { | 38 | if (!isset($fStartIndex)) { |
| 38 | $fStartIndex = 0; | 39 | $fStartIndex = 0; |
| 39 | - } | ||
| 40 | - //$oPatternCustom->setHtml(getSearchResults($sDocument,$fStartIndex, $fSearchString, $sMetaTagIDs)); | 40 | + } |
| 41 | $oPatternCustom->setHtml(getSearchResults($sMetaTagIDs,$sSQLSearchString, $fStartIndex)); | 41 | $oPatternCustom->setHtml(getSearchResults($sMetaTagIDs,$sSQLSearchString, $fStartIndex)); |
| 42 | $main->setCentralPayload($oPatternCustom); | 42 | $main->setCentralPayload($oPatternCustom); |
| 43 | $main->render(); | 43 | $main->render(); |
| 44 | } else { | 44 | } else { |
| 45 | $oPatternCustom = & new PatternCustom(); | 45 | $oPatternCustom = & new PatternCustom(); |
| 46 | $oPatternCustom->setHtml(getSearchPage($fSearchString, explode(",",$sMetaTagIDs))); | 46 | $oPatternCustom->setHtml(getSearchPage($fSearchString, explode(",",$sMetaTagIDs))); |
| 47 | - //$oPatternCustom->setHtml(getSearchResults($sMetaTagIDs,$sSQLSearchString, $fStartIndex)); | ||
| 48 | $main->setCentralPayload($oPatternCustom); | 47 | $main->setCentralPayload($oPatternCustom); |
| 49 | $main->setErrorMessage("No documents matched your search criteria"); | 48 | $main->setErrorMessage("No documents matched your search criteria"); |
| 50 | $main->setFormAction("advancedSearchBL.php?fForSearch=1"); | 49 | $main->setFormAction("advancedSearchBL.php?fForSearch=1"); |
| @@ -115,17 +114,16 @@ function getApprovedDocumentString($sMetaTagIDs, $sSQLSearchString) { | @@ -115,17 +114,16 @@ function getApprovedDocumentString($sMetaTagIDs, $sSQLSearchString) { | ||
| 115 | $sQuery = "SELECT DISTINCT D.id " . | 114 | $sQuery = "SELECT DISTINCT D.id " . |
| 116 | "FROM documents AS D INNER JOIN document_fields_link AS DFL ON DFL.document_id = D.id " . | 115 | "FROM documents AS D INNER JOIN document_fields_link AS DFL ON DFL.document_id = D.id " . |
| 117 | "INNER JOIN document_fields AS DF ON DF.id = DFL.document_field_id " . | 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 | "WHERE DF.ID IN ($sMetaTagIDs) " . | 119 | "WHERE DF.ID IN ($sMetaTagIDs) " . |
| 120 | "AND " . $sSQLSearchString . " " . | 120 | "AND " . $sSQLSearchString . " " . |
| 121 | + "AND SL.name='Live' " . | ||
| 121 | "AND SDUL.user_id = " . $_SESSION["userID"]; | 122 | "AND SDUL.user_id = " . $_SESSION["userID"]; |
| 122 | - | 123 | + $default->log->info("search doc query=$sQuery"); |
| 123 | $sql = $default->db; | 124 | $sql = $default->db; |
| 124 | $sql->query($sQuery); | 125 | $sql->query($sQuery); |
| 125 | while ($sql->next_record()) { | 126 | while ($sql->next_record()) { |
| 126 | - /*if (Permission::userHasDocumentReadPermission($sql->f("id"))) { | ||
| 127 | - $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id"); | ||
| 128 | - }*/ | ||
| 129 | $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id"); | 127 | $aApprovedDocuments[count($aApprovedDocuments)] = $sql->f("id"); |
| 130 | } | 128 | } |
| 131 | if (count($aApprovedDocuments) > 1) { | 129 | if (count($aApprovedDocuments) > 1) { |
| @@ -147,6 +145,5 @@ function getSQLSearchString($sSearchString) { | @@ -147,6 +145,5 @@ function getSQLSearchString($sSearchString) { | ||
| 147 | } | 145 | } |
| 148 | $sSQLSearchString .= "(DFL.value LIKE '%" . $aWords[count($aWords) -1] . "%')"; | 146 | $sSQLSearchString .= "(DFL.value LIKE '%" . $aWords[count($aWords) -1] . "%')"; |
| 149 | return $sSQLSearchString; | 147 | return $sSQLSearchString; |
| 150 | -} | ||
| 151 | - | ||
| 152 | -?> | 148 | +} |
| 149 | +?> | ||
| 153 | \ No newline at end of file | 150 | \ No newline at end of file |