invalidate list of versions after removing a version

This commit is contained in:
Uwe Steinmann 2020-08-21 12:34:35 +02:00
parent 991268a18b
commit 990621ae99
2 changed files with 13 additions and 0 deletions

View File

@ -1745,6 +1745,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
foreach ($resArr as $row) {
/** @var SeedDMS_Core_DocumentContent $content */
$content = new $classname($row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum']);
/* TODO: Better use content id as key in $this->_content. This
* would allow to remove a single content object in removeContent().
* Currently removeContent() must clear $this->_content completely
*/
if($user) {
if($content->getAccessMode($user) >= M_READ)
array_push($this->_content, $content);
@ -2018,6 +2022,13 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
return false;
}
/* Invalidate the content list and the latest content of this document,
* otherwise getContent() and getLatestContent()
* will still return the content just deleted.
*/
$this->_latestContent = null;
$this->_content = null;
/* Check if 'onPostRemoveDocument' callback is set */
if(isset($this->_dms->callbacks['onPostRemoveContent'])) {
foreach($this->_dms->callbacks['onPostRemoveContent'] as $callback) {

View File

@ -25,6 +25,8 @@
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- add method SeedDMS_Core_Document::setParent() as an alias for setFolder()
- clear the save content list and latest content in SeedDMS_Core_Document after
a version has been deleted.
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">