in removeWorkflow() remove records from tblWorkflowLog before tblWorkflowDocumentContent

This commit is contained in:
Uwe Steinmann 2021-08-20 10:38:33 +02:00
parent 3a26fc3e2a
commit fa8356d729

View File

@ -4617,15 +4617,6 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$currentstate = $this->getWorkflowState(); $currentstate = $this->getWorkflowState();
if(!$currentstate || SeedDMS_Core_DMS::checkIfEqual($this->_workflow->getInitState(), $currentstate) || $unlink == true) { if(!$currentstate || SeedDMS_Core_DMS::checkIfEqual($this->_workflow->getInitState(), $currentstate) || $unlink == true) {
$db->startTransaction(); $db->startTransaction();
$queryStr=
"DELETE FROM `tblWorkflowDocumentContent` WHERE "
."`version`='".$this->_version."' "
." AND `document` = '". $this->_document->getID() ."' "
." AND `workflow` = '". $this->_workflow->getID() ."' ";
if (!$db->getResult($queryStr)) {
$db->rollbackTransaction();
return false;
}
if(!$unlink) { if(!$unlink) {
$queryStr= $queryStr=
"DELETE FROM `tblWorkflowLog` WHERE " "DELETE FROM `tblWorkflowLog` WHERE "
@ -4637,6 +4628,15 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false; return false;
} }
} }
$queryStr=
"DELETE FROM `tblWorkflowDocumentContent` WHERE "
."`version`='".$this->_version."' "
." AND `document` = '". $this->_document->getID() ."' "
." AND `workflow` = '". $this->_workflow->getID() ."' ";
if (!$db->getResult($queryStr)) {
$db->rollbackTransaction();
return false;
}
$this->_workflow = null; $this->_workflow = null;
$this->_workflowState = null; $this->_workflowState = null;
$this->verifyStatus(false, $user, 'Workflow removed'); $this->verifyStatus(false, $user, 'Workflow removed');