mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
Merge branch 'seeddms-5.0.x' into seeddms-5.1.x
This commit is contained in:
commit
e58f0888b5
|
@ -1386,25 +1386,9 @@ class SeedDMS_Core_DMS {
|
|||
$totalDocs = 0;
|
||||
if($mode & 0x1) {
|
||||
$searchKey = "";
|
||||
$searchFields = array();
|
||||
if (in_array(1, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`keywords`";
|
||||
}
|
||||
if (in_array(2, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`name`";
|
||||
}
|
||||
if (in_array(3, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`comment`";
|
||||
$searchFields[] = "`tblDocumentContent`.`comment`";
|
||||
}
|
||||
if (in_array(4, $searchin)) {
|
||||
$searchFields[] = "`tblDocumentAttributes`.`value`";
|
||||
$searchFields[] = "`tblDocumentContentAttributes`.`value`";
|
||||
}
|
||||
if (in_array(5, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`id`";
|
||||
}
|
||||
|
||||
$classname = $this->classnames['document'];
|
||||
$searchFields = $classname::getSearchFields($searchin);
|
||||
|
||||
if (count($searchFields)>0) {
|
||||
foreach ($tkeys as $key) {
|
||||
|
@ -2878,7 +2862,7 @@ class SeedDMS_Core_DMS {
|
|||
function getStatisticalData($type='') { /* {{{ */
|
||||
switch($type) {
|
||||
case 'docsperuser':
|
||||
$queryStr = "select b.`fullname` as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`";
|
||||
$queryStr = "select b.`fullName` as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`";
|
||||
$resArr = $this->db->getResultArray($queryStr);
|
||||
if (!$resArr)
|
||||
return false;
|
||||
|
@ -2930,7 +2914,7 @@ class SeedDMS_Core_DMS {
|
|||
}
|
||||
return $resArr;
|
||||
case 'sizeperuser':
|
||||
$queryStr = "select c.`fullname` as `key`, sum(`fileSize`) as total from `tblDocuments` a left join `tblDocumentContent` b on a.id=b.`document` left join `tblUsers` c on a.`owner`=c.`id` group by a.`owner`";
|
||||
$queryStr = "select c.`fullName` as `key`, sum(`fileSize`) as total from `tblDocuments` a left join `tblDocumentContent` b on a.id=b.`document` left join `tblUsers` c on a.`owner`=c.`id` group by a.`owner`";
|
||||
$resArr = $this->db->getResultArray($queryStr);
|
||||
if (!$resArr)
|
||||
return false;
|
||||
|
|
|
@ -228,6 +228,37 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
$this->_content = null;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return an array of database fields which used for searching
|
||||
* a term entered in the database search form
|
||||
*
|
||||
* @param array $searchin integer list of search scopes (2=name, 3=comment,
|
||||
* 4=attributes)
|
||||
* @return array list of database fields
|
||||
*/
|
||||
public static function getSearchFields($searchin) { /* {{{ */
|
||||
$searchFields = array();
|
||||
if (in_array(1, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`keywords`";
|
||||
}
|
||||
if (in_array(2, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`name`";
|
||||
}
|
||||
if (in_array(3, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`comment`";
|
||||
$searchFields[] = "`tblDocumentContent`.`comment`";
|
||||
}
|
||||
if (in_array(4, $searchin)) {
|
||||
$searchFields[] = "`tblDocumentAttributes`.`value`";
|
||||
$searchFields[] = "`tblDocumentContentAttributes`.`value`";
|
||||
}
|
||||
if (in_array(5, $searchin)) {
|
||||
$searchFields[] = "`tblDocuments`.`id`";
|
||||
}
|
||||
|
||||
return $searchFields;
|
||||
} /* }}} */
|
||||
|
||||
public static function getInstance($id, $dms) { /* {{{ */
|
||||
$db = $dms->getDB();
|
||||
|
||||
|
@ -257,7 +288,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
return $document;
|
||||
} /* }}} */
|
||||
|
||||
|
||||
/*
|
||||
* Return the directory of the document in the file system relativ
|
||||
* to the contentDir
|
||||
|
@ -1836,7 +1866,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
function __getLatestContent() { /* {{{ */
|
||||
if (!$this->_latestContent) {
|
||||
$db = $this->_dms->getDB();
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC LIMIT 0,1";
|
||||
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC LIMIT 1";
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
return false;
|
||||
|
|
|
@ -426,7 +426,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
elseif (!strcasecmp($tableName, "ttcontentid")) {
|
||||
switch($this->_driver) {
|
||||
case 'sqlite':
|
||||
$queryStr = "CREATE TEMPORARY TABLE `ttcontentid` AS ".
|
||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttcontentid` AS ".
|
||||
"SELECT `tblDocumentContent`.`document` AS `document`, ".
|
||||
"MAX(`tblDocumentContent`.`version`) AS `maxVersion` ".
|
||||
"FROM `tblDocumentContent` ".
|
||||
|
@ -434,7 +434,7 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
"ORDER BY `tblDocumentContent`.`document`";
|
||||
break;
|
||||
default:
|
||||
$queryStr = "CREATE TEMPORARY TABLE `ttcontentid` (PRIMARY KEY (`document`), INDEX (`maxVersion`)) ".
|
||||
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttcontentid` (PRIMARY KEY (`document`), INDEX (`maxVersion`)) ".
|
||||
"SELECT `tblDocumentContent`.`document`, ".
|
||||
"MAX(`tblDocumentContent`.`version`) AS `maxVersion` ".
|
||||
"FROM `tblDocumentContent` ".
|
||||
|
|
Loading…
Reference in New Issue
Block a user