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

This commit is contained in:
Uwe Steinmann 2021-03-17 08:09:13 +01:00
commit 64e6e8f1c4
3 changed files with 12 additions and 10 deletions

View File

@ -212,6 +212,8 @@
- use mandatory reviewers/approvers when adding files by webdav
- set some http security headers in .htaccess
- add searching for last date of a document status change
- fix a potential problem when remove a document with files attached to
previous versions
--------------------------------------------------------------------------------
Changes in version 5.1.21

View File

@ -2646,7 +2646,11 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* @return array list of files, false in case of an sql error
*/
function getDocumentFiles($version=0, $incnoversion=true) { /* {{{ */
if (!isset($this->_documentFiles)) {
/* use a smarter caching because removing a document will call this function
* for each version and the document itself.
*/
$hash = substr(md5($version.$incnoversion), 0, 4);
if (!isset($this->_documentFiles[$hash])) {
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblDocumentFiles` WHERE `document` = " . $this->_id;
@ -2664,16 +2668,16 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr) return false;
$this->_documentFiles = array();
$this->_documentFiles = array($hash=>array());
$user = $this->_dms->getLoggedInUser();
foreach ($resArr as $row) {
$file = new SeedDMS_Core_DocumentFile($row["id"], $this, $row["userID"], $row["comment"], $row["date"], $row["dir"], $row["fileType"], $row["mimeType"], $row["orgFileName"], $row["name"], $row["version"], $row["public"]);
if($file->getAccessMode($user) >= M_READ)
array_push($this->_documentFiles, $file);
array_push($this->_documentFiles[$hash], $file);
}
}
return $this->_documentFiles;
return $this->_documentFiles[$hash];
} /* }}} */
function addDocumentFile($name, $comment, $user, $tmpFile, $orgFileName,$fileType, $mimeType,$version=0,$public=1) { /* {{{ */
@ -2777,11 +2781,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
}
// remove all document files
/* make sure to get all attachments because _removeContent() did remove
* the attachments of a version already and the list of attachments
* is still stored in _documentFiles
* */
unset($this->_documentFiles);
$res = $this->getDocumentFiles();
if (is_bool($res) && !$res) {
$db->rollbackTransaction();

View File

@ -1885,7 +1885,8 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
- add parameter $incdisabled to SeedDMS_Core_Folder::getNotifyList()
- do not validate value in SeedDMS_Core_Attribute::setValue(), it should have been done before
- SeedDMS_Core_DMS::search() can search for last date of document status change
- fix SeedDMS_Core_Document::remove when version had its own attachments
- smarter caching in SeedDMS_Core_Document::getDocumentFiles() which fixes a potential
problem when removing a document
</notes>
</release>
<release>