mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
fix getWorkflowState(), can now handle empty state
This commit is contained in:
parent
d5b21e0eca
commit
b624cd0a61
|
@ -4331,11 +4331,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
|
||||
if (!$this->_workflowState) {
|
||||
$queryStr=
|
||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.`id` WHERE `workflow`=". intval($this->_workflow->getID())
|
||||
"SELECT b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflowStates` b ON a.`state` = b.`id` WHERE a.`state` IS NOT NULL AND `workflow`=". intval($this->_workflow->getID())
|
||||
." AND a.`version`='".$this->_version
|
||||
."' AND a.`document` = '". $this->_document->getID() ."' ";
|
||||
$recs = $db->getResultArray($queryStr);
|
||||
if (is_bool($recs) && !$recs)
|
||||
if (!$recs)
|
||||
return false;
|
||||
$this->_workflowState = new SeedDMS_Core_Workflow_State($recs[0]['id'], $recs[0]['name'], $recs[0]['maxtime'], $recs[0]['precondfunc'], $recs[0]['documentstatus']);
|
||||
$this->_workflowState->setDMS($this->_document->getDMS());
|
||||
|
@ -4497,7 +4497,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return true;
|
||||
}
|
||||
|
||||
if(SeedDMS_Core_DMS::checkIfEqual($this->_workflow->getInitState(), $this->getWorkflowState()) || $unlink == true) {
|
||||
/* A workflow should always be in a state, but in case it isn't, the
|
||||
* at least allow to remove the workflow.
|
||||
*/
|
||||
$currentstate = $this->getWorkflowState();
|
||||
if(!$currentstate || SeedDMS_Core_DMS::checkIfEqual($this->_workflow->getInitState(), $currentstate) || $unlink == true) {
|
||||
$db->startTransaction();
|
||||
$queryStr=
|
||||
"DELETE FROM `tblWorkflowDocumentContent` WHERE "
|
||||
|
|
Loading…
Reference in New Issue
Block a user