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

This commit is contained in:
Uwe Steinmann 2021-07-11 20:42:56 +02:00
commit 0bd2e2d83d
3 changed files with 26 additions and 2 deletions

View File

@ -229,6 +229,9 @@
- links are all created absolute based on _httpRoot instead of relative to
the current page. This fixes a potential security hole cased by malformed
links.
- add chart with number of folders per document
- add number of links, attachments, versions of a selected user in the user
manager
--------------------------------------------------------------------------------
Changes in version 5.1.22

View File

@ -4012,14 +4012,14 @@ class SeedDMS_Core_DMS {
function getStatisticalData($type='') { /* {{{ */
switch($type) {
case 'docsperuser':
$queryStr = "select concat(b.`fullName`, ' (', b.`login`, ')') as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`";
$queryStr = "select ".$this->db->concat(array('b.`fullName`', "' ('", 'b.`login`', "')'"))." as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`";
$resArr = $this->db->getResultArray($queryStr);
if (!$resArr)
return false;
return $resArr;
case 'foldersperuser':
$queryStr = "select concat(b.`fullName`, ' (', b.`login`, ')') as `key`, count(`owner`) as total from `tblFolders` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`";
$queryStr = "select ".$this->db->concat(array('b.`fullName`', "' ('", 'b.`login`', "')'"))." as `key`, count(`owner`) as total from `tblFolders` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`";
$resArr = $this->db->getResultArray($queryStr);
if (!$resArr)
return false;

View File

@ -358,6 +358,27 @@ class SeedDMS_Core_DatabaseAccess {
return str_replace('`', '"', $text);
} /* }}} */
/**
* Return sql to concat strings or fields
*
* @param array $arr list of field names or strings
* @return string concated string
*/
function concat($arr) { /* {{{ */
switch($this->_driver) {
case 'mysql':
return 'concat('.implode(',', $arr).')';
break;
case 'pgsql':
return implode(' || ', $arr);
break;
case 'sqlite':
return implode(' || ', $arr);
break;
}
return '';
} /* }}} */
/**
* Execute SQL query and return result
*