diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 2e3e309e5..6231a5fb5 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2129,7 +2129,7 @@ class SeedDMS_Core_DMS { if(is_string($attribute)) $attribute = array($attribute); $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; - } else { + } elseif(is_string($attribute)) { $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; } } else { @@ -2141,7 +2141,7 @@ class SeedDMS_Core_DMS { $kkll[] = "`tblFolderAttributes`.`value`<='".$attribute['to']."'"; if($kkll) $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND ".implode(' AND ', $kkll)." AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; - } else { + } elseif(is_string($attribute)) { $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value` like '%".$attribute."%' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; } } @@ -2342,7 +2342,7 @@ class SeedDMS_Core_DMS { } } if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { - if($attrdef->getValueSet()) { + if($valueset = $attrdef->getValueSet()) { if($attrdef->getMultipleValues()) { /** @noinspection PhpUndefinedVariableInspection */ if(is_string($attribute)) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index ab6600011..d1de912fa 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -29,6 +29,7 @@ - backport setFileType() from 6.0.x - add SeedDMS_Core_File::fileExtension() - add callbacks on onPostUpdateAttribute, onPostRemoveAttribute, onPostAddAttribute +- fix searching for document content with a custom attribute having a value set diff --git a/SeedDMS_SQLiteFTS/SQLiteFTS.php b/SeedDMS_SQLiteFTS/SQLiteFTS.php index 0a3b710e8..338a79e1c 100644 --- a/SeedDMS_SQLiteFTS/SQLiteFTS.php +++ b/SeedDMS_SQLiteFTS/SQLiteFTS.php @@ -41,4 +41,9 @@ require_once('SQLiteFTS/QueryHit.php'); */ require_once('SQLiteFTS/IndexedDocument.php'); +/** + * @uses SeedDMS_SQLiteFTS_Exception + */ +require_once('SQLiteFTS/Exception.php'); + ?> diff --git a/SeedDMS_SQLiteFTS/SQLiteFTS/Indexer.php b/SeedDMS_SQLiteFTS/SQLiteFTS/Indexer.php index 71de007e8..fd2ec197c 100644 --- a/SeedDMS_SQLiteFTS/SQLiteFTS/Indexer.php +++ b/SeedDMS_SQLiteFTS/SQLiteFTS/Indexer.php @@ -190,7 +190,8 @@ class SeedDMS_SQLiteFTS_Indexer { $sql .= " WHERE docs MATCH ".$this->_conn->quote($query); $res = $this->_conn->query($sql." GROUP BY `".$facetname."`"); if(!$res) - return false; + throw new SeedDMS_SQLiteFTS_Exception("Counting records in facet \"$facetname\" failed."); +// return false; $facets[$facetname] = array(); foreach($res as $row) { if($row[$facetname] && $row['c']) { @@ -220,7 +221,8 @@ class SeedDMS_SQLiteFTS_Indexer { $sql .= " WHERE docs MATCH ".$this->_conn->quote($query); $res = $this->_conn->query($sql." GROUP BY `record_type`"); if(!$res) - return false; + throw new SeedDMS_SQLiteFTS_Exception("Counting records in facet \"record_type\" failed."); +// return false; $facets['record_type'] = array('document'=>0, 'folder'=>0); foreach($res as $row) { $facets['record_type'][$row['record_type']] = $row['c']; @@ -239,6 +241,8 @@ class SeedDMS_SQLiteFTS_Indexer { if(!empty($limit['offset'])) $sql .= " OFFSET ".(int) $limit['offset']; $res = $this->_conn->query($sql); + if(!$res) + throw new SeedDMS_SQLiteFTS_Exception("Searching for documents failed."); $hits = array(); if($res) { foreach($res as $rec) { diff --git a/SeedDMS_SQLiteFTS/SQLiteFTS/Search.php b/SeedDMS_SQLiteFTS/SQLiteFTS/Search.php index a227b24e1..d9a793974 100644 --- a/SeedDMS_SQLiteFTS/SQLiteFTS/Search.php +++ b/SeedDMS_SQLiteFTS/SQLiteFTS/Search.php @@ -113,7 +113,7 @@ class SeedDMS_SQliteFTS_Search { if(!empty($fields['status'])) { if($querystr) $querystr .= ' AND '; - $status = array_map(function($v){return $v+10;}, $fields['status']); + $status = array_map(function($v){return (int)$v+10;}, $fields['status']); $querystr .= '(status:'; $querystr .= implode(' OR status:', $status); $querystr .= ')'; diff --git a/SeedDMS_SQLiteFTS/package.xml b/SeedDMS_SQLiteFTS/package.xml index a550a95b0..a0d990920 100644 --- a/SeedDMS_SQLiteFTS/package.xml +++ b/SeedDMS_SQLiteFTS/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2021-05-10 + 2022-03-04 - 1.0.16 - 1.0.16 + 1.0.17 + 1.0.17 stable @@ -23,9 +23,7 @@ GPL License -- close pipes in execWithTimeout(), also return exit code of command -- add support for fts5 (make it the default) -- add class SeedDMS_SQLiteFTS_Field +- throw exeption in find() instead of returning false @@ -336,5 +334,23 @@ add user to list of terms - add indexing folders + + 2021-05-10 + + + 1.0.16 + 1.0.16 + + + stable + stable + + GPL License + +- close pipes in execWithTimeout(), also return exit code of command +- add support for fts5 (make it the default) +- add class SeedDMS_SQLiteFTS_Field + + diff --git a/op/op.Login.php b/op/op.Login.php index 541ccb936..e9763ff97 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -89,6 +89,7 @@ $controller->setParam('sesstheme', $sesstheme); $controller->setParam('referuri', $referuri); $controller->setParam('session', $session); if(!$controller->run()) { + $session = null; add_log_line("login failed", PEAR_LOG_ERR); _printMessage(getMLText($controller->getErrorMsg()), getMLText($controller->getErrorMsg())."\n"); exit; diff --git a/op/op.PasswordForgotten.php b/op/op.PasswordForgotten.php index c51794fc1..bfe719972 100644 --- a/op/op.PasswordForgotten.php +++ b/op/op.PasswordForgotten.php @@ -27,17 +27,16 @@ include("../inc/inc.Extension.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.ClassSession.php"); include("../inc/inc.ClassUI.php"); -include("../inc/inc.ClassEmailNotify.php"); +//include("../inc/inc.ClassEmailNotify.php"); include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; function _printMessage($heading, $message) { - UI::htmlStartPage($heading, "password"); UI::globalBanner(); UI::pageNavigation($heading); UI::contentContainer($message."

" . getMLText("login") . "

\n"); - UI::htmlEndPage(); + UI::htmlEndPage(); return; } diff --git a/out/out.PasswordForgotten.php b/out/out.PasswordForgotten.php index 3e0e346f1..deadffb54 100644 --- a/out/out.PasswordForgotten.php +++ b/out/out.PasswordForgotten.php @@ -32,7 +32,7 @@ include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms)); -$accessop = new SeedDMS_AccessOperation($dms, $user, $settings); +//$accessop = new SeedDMS_AccessOperation($dms, $user, $settings); if (isset($_REQUEST["referuri"]) && strlen($_REQUEST["referuri"])>0) { $referrer = $_REQUEST["referuri"]; @@ -40,9 +40,8 @@ if (isset($_REQUEST["referuri"]) && strlen($_REQUEST["referuri"])>0) { $referrer = ''; } if($view) { - $view->setParam('accessobject', $accessop); $view->setParam('referrer', $referrer); - $view->setParam('accessobject', $accessop); +// $view->setParam('accessobject', $accessop); $view($_GET); exit; } diff --git a/out/out.Search.php b/out/out.Search.php index 88bd59adc..51c7d5967 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -73,9 +73,10 @@ if($fullsearch) { $category = $_GET['category']; foreach($_GET['category'] as $catid) { if($catid) { - $cat = $dms->getDocumentCategory($catid); - $categories[] = $cat; - $categorynames[] = $cat->getName(); + if($cat = $dms->getDocumentCategory($catid)) { + $categories[] = $cat; + $categorynames[] = $cat->getName(); + } } } } diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index d31f00041..781b2d39c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1928,7 +1928,7 @@ $(document).ready(function() { $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), M_READ, -1, $target, $fieldname."[".$attrdef->getId()."]"); break; case SeedDMS_Core_AttributeDefinition::type_user: - $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); + $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); $users = $dms->getAllUsers(); if($users) { $allowempty = $attrdef->getMinValues() == 0; @@ -1948,7 +1948,7 @@ $(document).ready(function() { } break; case SeedDMS_Core_AttributeDefinition::type_group: - $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); + $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); $groups = $dms->getAllGroups(); if($groups) { $allowempty = $attrdef->getMinValues() == 0; diff --git a/views/bootstrap/class.Help.php b/views/bootstrap/class.Help.php index 39283c9fa..610de136a 100644 --- a/views/bootstrap/class.Help.php +++ b/views/bootstrap/class.Help.php @@ -60,7 +60,7 @@ class SeedDMS_View_Help extends SeedDMS_Theme_Style { $this->columnEnd(); $this->columnStart(8); ?> - + params['session']->getLanguage()."/help/".$context.".html"; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 590a25e20..4a32d7efb 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1892,7 +1892,7 @@ $(document).ready(function() { $content .= $this->getDocumentChooserHtml("attr".$attrdef->getId(), M_READ, -1, $target, $fieldname."[".$attrdef->getId()."]"); break; case SeedDMS_Core_AttributeDefinition::type_user: - $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); + $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); $users = $dms->getAllUsers(); if($users) { $allowempty = $attrdef->getMinValues() == 0; @@ -1912,7 +1912,7 @@ $(document).ready(function() { } break; case SeedDMS_Core_AttributeDefinition::type_group: - $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); + $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : (is_string($attribute) ? [$attribute] : $attribute)) : array(); $groups = $dms->getAllGroups(); if($groups) { $allowempty = $attrdef->getMinValues() == 0;