mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
add new method SeedDMS_Core_DocumentContent::removeReview()
This commit is contained in:
parent
189f962012
commit
0cd9910c25
|
@ -3925,6 +3925,53 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
return $reviewLogID;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Add another entry to review 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 removeReview($reviewid, $requestUser, $comment='') { /* {{{ */
|
||||
$db = $this->_document->getDMS()->getDB();
|
||||
|
||||
// Check to see if the user can be removed from the review list.
|
||||
$reviews = $this->getReviewStatus();
|
||||
if (is_bool($reviews) && !$reviews) {
|
||||
return -1;
|
||||
}
|
||||
$reviewStatus = null;
|
||||
foreach($reviews as $review) {
|
||||
if($review['reviewID'] == $reviewid) {
|
||||
$reviewStatus = $review;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$reviewStatus)
|
||||
return -2;
|
||||
|
||||
// The review log entry may only be removed if the status is 1 or -1
|
||||
if ($reviewStatus["status"] != 1 && $reviewStatus["status"] != -1)
|
||||
return -3;
|
||||
|
||||
$queryStr = "INSERT INTO `tblDocumentReviewLog` (`reviewID`, `status`,
|
||||
`comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $reviewStatus["reviewID"] ."', '0', ".$db->qstr($comment).", ".$db->getCurrentDatetime().", '".
|
||||
$requestUser->getID() ."')";
|
||||
//$queryStr = "DELETE FROM `tblDocumentReviewLog` WHERE `reviewLogID` = ".$reviewStatus['reviewLogID'];
|
||||
$res=$db->getResult($queryStr);
|
||||
if (is_bool($res) && !$res)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Add a review to the document content
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
- better handling of document with an empty workflow state
|
||||
- fix checking of email addresses by using filter_var instead of regex
|
||||
- add new method SeedDMS_Core_Document::hasCategory()
|
||||
- add new method SeedDMS_Core_DocumentContent::removeReview()
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
Loading…
Reference in New Issue
Block a user