SeedDMS_Core_Document::checkForDueRevisionWorkflow() also checks if there are any waiting or pending revisions at all

This commit is contained in:
Uwe Steinmann 2017-07-21 11:48:01 +02:00
parent 6aee48fc08
commit 37e03e2e9e

View File

@ -706,6 +706,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* The method will update the document status log database table
* if needed.
*
* FIXME: This method does not check if there are any revisors left. Even
* if all revisors have been removed, it will still start the revision workflow!
*
* @param object $user user requesting the possible automatic change
* @param string $next next date for review
* @return boolean true if status has changed
@ -716,6 +719,22 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$st=$lc->getStatus();
if($st["status"] == S_RELEASED) {
/* First check if there are any revisors left who need to revise */
$pendingRevision=false;
unset($this->_revisionStatus); // force to be reloaded from DB
$revisionStatus=$lc->getRevisionStatus();
if (is_array($revisionStatus) && count($revisionStatus)>0) {
foreach ($revisionStatus as $a){
if ($a["status"]==S_LOG_SLEEPING || $a["status"]==S_LOG_SLEEPING){
$pendingRevision=true;
break;
}
}
}
if(!$pendingRevision)
return false;
/* Second check if revision is already due */
if($lc->getRevisionDate() && $lc->getRevisionDate() <= date('Y-m-d 00:00:00')) {
if($lc->startRevision($user, 'Automatic start of revision workflow')) {
if($next) {