mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	get[Review|Approval]Status takes ttreviewid|ttapproveid into account
This commit is contained in:
		
							parent
							
								
									007e3faa0a
								
							
						
					
					
						commit
						dc48e5da2c
					
				|  | @ -1329,22 +1329,33 @@ class SeedDMS_Core_User { /* {{{ */ | |||
| 	function getReviewStatus($documentID=null, $version=null) { /* {{{ */ | ||||
| 		$db = $this->_dms->getDB(); | ||||
| 
 | ||||
| 		if (!$db->createTemporaryTable("ttreviewid", true)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 
 | ||||
| 		$status = array("indstatus"=>array(), "grpstatus"=>array()); | ||||
| 
 | ||||
| 		// See if the user is assigned as an individual reviewer.
 | ||||
|         // See if the user is assigned as an individual reviewer.
 | ||||
|         // Attention: this method didn't use ttreviewid to filter out the latest
 | ||||
|         // log entry. This was added 2021-09-29 because $group->getReviewStatus()
 | ||||
|         // does it as well. The check below if the date is larger than the date
 | ||||
|         // of a previos entry is still required to just take the latest version
 | ||||
|         // of a document into account.
 | ||||
| 		$queryStr = "SELECT `tblDocumentReviewers`.*, `tblDocumentReviewLog`.`status`, ". | ||||
| 			"`tblDocumentReviewLog`.`comment`, `tblDocumentReviewLog`.`date`, ". | ||||
| 			"`tblDocumentReviewLog`.`userID` ". | ||||
| 			"FROM `tblDocumentReviewers` ". | ||||
| 			"LEFT JOIN `tblDocumentReviewLog` USING (`reviewID`) ". | ||||
| 			"WHERE `tblDocumentReviewers`.`type`='0' ". | ||||
| 			"LEFT JOIN `ttreviewid` on `ttreviewid`.`maxLogID` = `tblDocumentReviewLog`.`reviewLogID` ". | ||||
| 			"WHERE `ttreviewid`.`maxLogID`=`tblDocumentReviewLog`.`reviewLogID` ". | ||||
| 			($documentID==null ? "" : "AND `tblDocumentReviewers`.`documentID` = '". (int) $documentID ."' "). | ||||
| 			($version==null ? "" : "AND `tblDocumentReviewers`.`version` = '". (int) $version ."' "). | ||||
| 			"AND `tblDocumentReviewers`.`type`='0' ". | ||||
| 			"AND `tblDocumentReviewers`.`required`='". $this->_id ."' ". | ||||
| 			"ORDER BY `tblDocumentReviewLog`.`reviewLogID` DESC"; | ||||
| 		$resArr = $db->getResultArray($queryStr); | ||||
|         $resArr = $db->getResultArray($queryStr); | ||||
| 		if (is_bool($resArr) && $resArr === false) | ||||
| 			return false; | ||||
|             return false; | ||||
| 		if (count($resArr)>0) { | ||||
| 			foreach ($resArr as $res) { | ||||
| 				if(isset($status["indstatus"][$res['documentID']])) { | ||||
|  | @ -1355,7 +1366,7 @@ class SeedDMS_Core_User { /* {{{ */ | |||
| 					$status["indstatus"][$res['documentID']] = $res; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|         } | ||||
| 
 | ||||
| 		// See if the user is the member of a group that has been assigned to
 | ||||
| 		// review the document version.
 | ||||
|  | @ -1364,10 +1375,12 @@ class SeedDMS_Core_User { /* {{{ */ | |||
| 			"`tblDocumentReviewLog`.`userID` ". | ||||
| 			"FROM `tblDocumentReviewers` ". | ||||
| 			"LEFT JOIN `tblDocumentReviewLog` USING (`reviewID`) ". | ||||
| 			"LEFT JOIN `ttreviewid` on `ttreviewid`.`maxLogID` = `tblDocumentReviewLog`.`reviewLogID` ". | ||||
| 			"LEFT JOIN `tblGroupMembers` ON `tblGroupMembers`.`groupID` = `tblDocumentReviewers`.`required` ". | ||||
| 			"WHERE `tblDocumentReviewers`.`type`='1' ". | ||||
| 			"WHERE `ttreviewid`.`maxLogID`=`tblDocumentReviewLog`.`reviewLogID` ". | ||||
| 			($documentID==null ? "" : "AND `tblDocumentReviewers`.`documentID` = '". (int) $documentID ."' "). | ||||
| 			($version==null ? "" : "AND `tblDocumentReviewers`.`version` = '". (int) $version ."' "). | ||||
| 			"AND `tblDocumentReviewers`.`type`='1' ". | ||||
| 			"AND `tblGroupMembers`.`userID`='". $this->_id ."' ". | ||||
| 			"ORDER BY `tblDocumentReviewLog`.`reviewLogID` DESC"; | ||||
| 		$resArr = $db->getResultArray($queryStr); | ||||
|  | @ -1422,16 +1435,29 @@ class SeedDMS_Core_User { /* {{{ */ | |||
| 	function getApprovalStatus($documentID=null, $version=null) { /* {{{ */ | ||||
| 		$db = $this->_dms->getDB(); | ||||
| 
 | ||||
| 		$status = array("indstatus"=>array(), "grpstatus"=>array()); | ||||
| 		if (!$db->createTemporaryTable("ttapproveid")) { | ||||
| 			return false; | ||||
| 		} | ||||
| 
 | ||||
|         $status = array("indstatus"=>array(), "grpstatus"=>array()); | ||||
| 
 | ||||
|         // See if the user is assigned as an individual approver.
 | ||||
|         // Attention: this method didn't use ttapproveid to filter out the latest
 | ||||
|         // log entry. This was added 2021-09-29 because $group->getApprovalStatus()
 | ||||
|         // does it as well. The check below if the date is larger than the date
 | ||||
|         // of a previos entry is still required to just take the latest version
 | ||||
|         // of a document into account.
 | ||||
| 		$queryStr = | ||||
| 			"SELECT `tblDocumentApprovers`.*, `tblDocumentApproveLog`.`status`, ". | ||||
| 			"`tblDocumentApproveLog`.`comment`, `tblDocumentApproveLog`.`date`, ". | ||||
| 			"`tblDocumentApproveLog`.`userID` ". | ||||
| 			"FROM `tblDocumentApprovers` ". | ||||
| 			"LEFT JOIN `tblDocumentApproveLog` USING (`approveID`) ". | ||||
| 			"WHERE `tblDocumentApprovers`.`type`='0' ". | ||||
| 			"LEFT JOIN `ttapproveid` on `ttapproveid`.`maxLogID` = `tblDocumentApproveLog`.`approveLogID` ". | ||||
| 			"WHERE `ttapproveid`.`maxLogID`=`tblDocumentApproveLog`.`approveLogID` ". | ||||
| 			($documentID==null ? "" : "AND `tblDocumentApprovers`.`documentID` = '". (int) $documentID ."' "). | ||||
| 			($version==null ? "" : "AND `tblDocumentApprovers`.`version` = '". (int) $version ."' "). | ||||
| 			"AND `tblDocumentApprovers`.`type`='0' ". | ||||
| 			"AND `tblDocumentApprovers`.`required`='". $this->_id ."' ". | ||||
| 			"ORDER BY `tblDocumentApproveLog`.`approveLogID` DESC"; | ||||
| 
 | ||||
|  | @ -1458,10 +1484,12 @@ class SeedDMS_Core_User { /* {{{ */ | |||
| 			"`tblDocumentApproveLog`.`userID` ". | ||||
| 			"FROM `tblDocumentApprovers` ". | ||||
| 			"LEFT JOIN `tblDocumentApproveLog` USING (`approveID`) ". | ||||
| 			"LEFT JOIN `ttapproveid` on `ttapproveid`.`maxLogID` = `tblDocumentApproveLog`.`approveLogID` ". | ||||
| 			"LEFT JOIN `tblGroupMembers` ON `tblGroupMembers`.`groupID` = `tblDocumentApprovers`.`required` ". | ||||
| 			"WHERE `tblDocumentApprovers`.`type`='1' ". | ||||
| 			"WHERE `ttapproveid`.`maxLogID`=`tblDocumentApproveLog`.`approveLogID` ". | ||||
| 			($documentID==null ? "" : "AND `tblDocumentApprovers`.`documentID` = '". (int) $documentID ."' "). | ||||
| 			($version==null ? "" : "AND `tblDocumentApprovers`.`version` = '". (int) $version ."' "). | ||||
| 			"AND `tblDocumentApprovers`.`type`='1' ". | ||||
| 			"AND `tblGroupMembers`.`userID`='". $this->_id ."' ". | ||||
| 			"ORDER BY `tblDocumentApproveLog`.`approveLogID` DESC"; | ||||
| 		$resArr = $db->getResultArray($queryStr); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann