Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-03-04 09:36:00 +01:00
commit 1e8da679b5
13 changed files with 52 additions and 26 deletions

View File

@ -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))

View File

@ -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
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">

View File

@ -41,4 +41,9 @@ require_once('SQLiteFTS/QueryHit.php');
*/
require_once('SQLiteFTS/IndexedDocument.php');
/**
* @uses SeedDMS_SQLiteFTS_Exception
*/
require_once('SQLiteFTS/Exception.php');
?>

View File

@ -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) {

View File

@ -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 .= ')';

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2021-05-10</date>
<date>2022-03-04</date>
<time>08:57:44</time>
<version>
<release>1.0.16</release>
<api>1.0.16</api>
<release>1.0.17</release>
<api>1.0.17</api>
</version>
<stability>
<release>stable</release>
@ -23,9 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- 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
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -336,5 +334,23 @@ add user to list of terms
- add indexing folders
</notes>
</release>
<release>
<date>2021-05-10</date>
<time>08:57:44</time>
<version>
<release>1.0.16</release>
<api>1.0.16</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- close pipes in execWithTimeout(), also return exit code of command
- add support for fts5 (make it the default)
- add class SeedDMS_SQLiteFTS_Field
</notes>
</release>
</changelog>
</package>

View File

@ -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;

View File

@ -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."<p><a href=\"../out/out.Login.php\">" . getMLText("login") . "</a></p>\n");
UI::htmlEndPage();
UI::htmlEndPage();
return;
}

View File

@ -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;
}

View File

@ -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();
}
}
}
}

View File

@ -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;

View File

@ -60,7 +60,7 @@ class SeedDMS_View_Help extends SeedDMS_Theme_Style {
$this->columnEnd();
$this->columnStart(8);
?>
<legend><?php printMLText('help_'.strtolower($context), array(), $context); ?></legend>
<legend><?= htmlspecialchars(getMLText('help_'.strtolower($context), array(), $context)); ?></legend>
<?php
$helpfile = "../languages/".$this->params['session']->getLanguage()."/help/".$context.".html";

View File

@ -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;