mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-09-09 19:38:57 +00:00
removing a document version will not remove attachments of the document anymore
This commit is contained in:
parent
3d5aec62ce
commit
999f4f76c9
|
@ -5,6 +5,7 @@
|
||||||
- major rework of scripts in utils, unify reading of settings, use PHP_EOL
|
- major rework of scripts in utils, unify reading of settings, use PHP_EOL
|
||||||
- allow inline editing of document name
|
- allow inline editing of document name
|
||||||
- import of users does not issue an error if a group column isn't set
|
- import of users does not issue an error if a group column isn't set
|
||||||
|
- removing a document version will not remove attachments of the document anymore
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.19
|
Changes in version 5.1.19
|
||||||
|
|
|
@ -1994,8 +1994,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove document files attached to version
|
// remove only those document files attached to version
|
||||||
$res = $this->getDocumentFiles($version->getVersion());
|
$res = $this->getDocumentFiles($version->getVersion(), false);
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
return false;
|
return false;
|
||||||
|
@ -2217,15 +2217,20 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
/**
|
/**
|
||||||
* Get list of files attached to document
|
* Get list of files attached to document
|
||||||
*
|
*
|
||||||
|
* @param integer $version get only attachments for this version
|
||||||
|
*@param boolean $incnoversion include attachments without a version
|
||||||
* @return array list of files, false in case of an sql error
|
* @return array list of files, false in case of an sql error
|
||||||
*/
|
*/
|
||||||
function getDocumentFiles($version=0) { /* {{{ */
|
function getDocumentFiles($version=0, $incnoversion=true) { /* {{{ */
|
||||||
if (!isset($this->_documentFiles)) {
|
if (!isset($this->_documentFiles)) {
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM `tblDocumentFiles` WHERE `document` = " . $this->_id;
|
$queryStr = "SELECT * FROM `tblDocumentFiles` WHERE `document` = " . $this->_id;
|
||||||
if($version) {
|
if($version) {
|
||||||
|
if($incnoversion)
|
||||||
$queryStr .= " AND (`version`=0 OR `version`=".(int) $version.")";
|
$queryStr .= " AND (`version`=0 OR `version`=".(int) $version.")";
|
||||||
|
else
|
||||||
|
$queryStr .= " AND (`version`=".(int) $version.")";
|
||||||
}
|
}
|
||||||
$queryStr .= " ORDER BY ";
|
$queryStr .= " ORDER BY ";
|
||||||
if($version) {
|
if($version) {
|
||||||
|
@ -2347,7 +2352,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove document file
|
// remove all document files
|
||||||
$res = $this->getDocumentFiles();
|
$res = $this->getDocumentFiles();
|
||||||
if (is_bool($res) && !$res) {
|
if (is_bool($res) && !$res) {
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
- SeedDMS_Core_DMS::getDocumentList() returns false, if an unknown list passed
|
- SeedDMS_Core_DMS::getDocumentList() returns false, if an unknown list passed
|
||||||
|
- SeedDMS_Core_Document::getDocumentFiles() has new parameter to select only those files attached to a specific version of the document
|
||||||
|
- removing a document version will not remove attachments of the document anymore
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user