mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
add new method removeApproval()
This commit is contained in:
parent
f28153497e
commit
2c4dc73be3
|
@ -4194,6 +4194,53 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return $approveLogID;
|
return $approveLogID;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add another entry to approval log which resets the status
|
||||||
|
*
|
||||||
|
* This method will not delete anything from the database, but will add
|
||||||
|
* a new review log entry which sets the status to 0. This is only allowed
|
||||||
|
* if the current status is either 1 or -1.
|
||||||
|
*
|
||||||
|
* After calling this method SeedDMS_Core_DocumentCategory::verifyStatus()
|
||||||
|
* should be called to recalculate the document status.
|
||||||
|
*
|
||||||
|
* @param SeedDMS_Core_User $user
|
||||||
|
* @return int 0 if successful
|
||||||
|
*/
|
||||||
|
public function removeApproval($approveid, $requestUser, $comment='') { /* {{{ */
|
||||||
|
$db = $this->_document->getDMS()->getDB();
|
||||||
|
|
||||||
|
// Check to see if the user can be removed from the approval list.
|
||||||
|
$approvals = $this->getApprovalStatus();
|
||||||
|
if (is_bool($approvals) && !$approvals) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
$approvalStatus = null;
|
||||||
|
foreach($approvals as $approval) {
|
||||||
|
if($approval['approveID'] == $approveid) {
|
||||||
|
$approvalStatus = $approval;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!$approvalStatus)
|
||||||
|
return -2;
|
||||||
|
|
||||||
|
// The approval log entry may only be removed if the status is 1 or -1
|
||||||
|
if ($approvalStatus["status"] != 1 && $approvalStatus["status"] != -1)
|
||||||
|
return -3;
|
||||||
|
|
||||||
|
$queryStr = "INSERT INTO `tblDocumentApproveLog` (`approveID`, `status`,
|
||||||
|
`comment`, `date`, `userID`) ".
|
||||||
|
"VALUES ('". $approvalStatus["approveID"] ."', '0', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||||
|
$requestUser->getID() ."')";
|
||||||
|
$res=$db->getResult($queryStr);
|
||||||
|
if (is_bool($res) && !$res)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets approval status of a document content for a group
|
* Sets approval status of a document content for a group
|
||||||
* The functions behaves like
|
* The functions behaves like
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
- fix checking of email addresses by using filter_var instead of regex
|
- fix checking of email addresses by using filter_var instead of regex
|
||||||
- add new method SeedDMS_Core_Document::hasCategory()
|
- add new method SeedDMS_Core_Document::hasCategory()
|
||||||
- add new method SeedDMS_Core_DocumentContent::removeReview()
|
- add new method SeedDMS_Core_DocumentContent::removeReview()
|
||||||
|
- add new method SeedDMS_Core_DocumentContent::removeApproval()
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user