mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
removing a version will also remove all references
references in tblTransmittalItems, tblDocumentRevisions and tblDocumentRecievers were not removed
This commit is contained in:
parent
370bef25ff
commit
401e995df6
|
@ -1770,9 +1770,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
function removeContent($version) { /* {{{ */
|
function removeContent($version) { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
$emailList = array();
|
|
||||||
$emailList[] = $version->_userID;
|
|
||||||
|
|
||||||
if (file_exists( $this->_dms->contentDir.$version->getPath() ))
|
if (file_exists( $this->_dms->contentDir.$version->getPath() ))
|
||||||
if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() ))
|
if (!SeedDMS_Core_File::removeFile( $this->_dms->contentDir.$version->getPath() ))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1794,6 +1791,12 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$queryStr = "DELETE FROM `tblTransmittalItems` WHERE `document` = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$queryStr = "DELETE FROM `tblDocumentStatusLog` WHERE `statusID` = '".$stID."'";
|
$queryStr = "DELETE FROM `tblDocumentStatusLog` WHERE `statusID` = '".$stID."'";
|
||||||
if (!$db->getResult($queryStr)) {
|
if (!$db->getResult($queryStr)) {
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
|
@ -1821,9 +1824,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if(file_exists($file))
|
if(file_exists($file))
|
||||||
SeedDMS_Core_File::removeFile($file);
|
SeedDMS_Core_File::removeFile($file);
|
||||||
}
|
}
|
||||||
if ($st["status"]==0 && !in_array($st["required"], $emailList)) {
|
|
||||||
$emailList[] = $st["required"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($stList)>0) {
|
if (strlen($stList)>0) {
|
||||||
|
@ -1853,9 +1853,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if(file_exists($file))
|
if(file_exists($file))
|
||||||
SeedDMS_Core_File::removeFile($file);
|
SeedDMS_Core_File::removeFile($file);
|
||||||
}
|
}
|
||||||
if ($st["status"]==0 && !in_array($st["required"], $emailList)) {
|
|
||||||
$emailList[] = $st["required"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($stList)>0) {
|
if (strlen($stList)>0) {
|
||||||
|
@ -1871,6 +1868,64 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove all receipts of document version.
|
||||||
|
* This implmentation is different from the above for removing approvals
|
||||||
|
* and reviews. It doesn't use getReceiptStatus() but reads the database
|
||||||
|
*/
|
||||||
|
$queryStr = "SELECT * FROM tblDocumentRecipients WHERE documentID = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
if ((is_bool($resArr) && !$resArr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stList = array();
|
||||||
|
foreach($resArr as $res) {
|
||||||
|
$stList[] = $res['receiptID'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stList) {
|
||||||
|
$queryStr = "DELETE FROM `tblDocumentReceiptLog` WHERE `receiptID` IN (".implode(',', $stList).")";
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$queryStr = "DELETE FROM `tblDocumentRecipients` WHERE `receiptID` IN (".implode(',', $stList).")";
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove all revisions of document version.
|
||||||
|
* This implmentation is different from the above for removing approvals
|
||||||
|
* and reviews. It doesn't use getRevisionStatus() but reads the database
|
||||||
|
*/
|
||||||
|
$queryStr = "SELECT * FROM tblDocumentRevisors WHERE documentID = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
if ((is_bool($resArr) && !$resArr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stList = array();
|
||||||
|
foreach($resArr as $res) {
|
||||||
|
$stList[] = $res['revisionID'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stList) {
|
||||||
|
$queryStr = "DELETE FROM `tblDocumentRevisionLog` WHERE `revisionID` IN (".implode(',', $stList).")";
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$queryStr = "DELETE FROM `tblDocumentRevisors` WHERE `revisionID` IN (".implode(',', $stList).")";
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$queryStr = "DELETE FROM `tblWorkflowDocumentContent` WHERE `document` = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
|
$queryStr = "DELETE FROM `tblWorkflowDocumentContent` WHERE `document` = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
|
||||||
if (!$db->getResult($queryStr)) {
|
if (!$db->getResult($queryStr)) {
|
||||||
$db->rollbackTransaction();
|
$db->rollbackTransaction();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user