mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 05:11:27 +00:00 
			
		
		
		
	fix search for documents with reception acknowledgement
This commit is contained in:
		
							parent
							
								
									662d9d0d85
								
							
						
					
					
						commit
						6cb5dec1a9
					
				|  | @ -1422,9 +1422,14 @@ class SeedDMS_Core_DMS { | |||
| 			// Construct the SQL query that will be used to search the database.
 | ||||
| 			//
 | ||||
| 
 | ||||
| 			if (!$this->db->createTemporaryTable("ttcontentid") || !$this->db->createTemporaryTable("ttstatid") || !$this->db->createTemporaryTable("ttreceiptid")) { | ||||
| 			if (!$this->db->createTemporaryTable("ttcontentid") || !$this->db->createTemporaryTable("ttstatid")) { | ||||
| 				return false; | ||||
| 			} | ||||
| 			if($reception) { | ||||
| 				if (!$this->db->createTemporaryTable("ttreceiptid")) { | ||||
| 					return false; | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			$searchQuery = "FROM `tblDocumentContent` ". | ||||
| 				"LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `tblDocumentContent`.`document` ". | ||||
|  | @ -1470,8 +1475,26 @@ class SeedDMS_Core_DMS { | |||
| 				$searchQuery .= " AND `tblDocumentStatusLog`.`status` IN (".implode(',', $status).")"; | ||||
| 			} | ||||
| 
 | ||||
| 			if($reception) | ||||
| 				$searchQuery .= " AND `tblDocumentReceiptLog`.`status` IN (".implode(',', $reception).")"; | ||||
| 			if($reception) { | ||||
| 				$searchReception = array(); | ||||
| 				/* still waiting for users/groups to acknownledge reception */ | ||||
| 				if(in_array("missingaction", $reception)) | ||||
| 					$searchReception[] = "b.`status` IN (0)"; | ||||
| 				/* document has not been acknowledeged by at least one user/group */ | ||||
| 				if(in_array("hasrejection", $reception)) | ||||
| 					$searchReception[] = "b.`status` IN (-1)"; | ||||
| 				/* document has been acknowledeged by at least one user/group */ | ||||
| 				if(in_array("hasacknowledge", $reception)) | ||||
| 					$searchReception[] = "b.`status` IN (1)"; | ||||
| 				/* document has been acknowledeged by all users/groups !!! not working !!! */ | ||||
| 				if(in_array("completeacknowledge", $reception)) | ||||
| 					$searchReception[] = "b.`status` NOT IN (-1, 0)"; | ||||
| 				if($searchReception) { | ||||
| 					$searchQuery .= " AND EXISTS (SELECT NULL FROM `tblDocumentRecipients` a LEFT JOIN `tblDocumentReceiptLog` b ON a.`receiptID`=b.`receiptID` LEFT JOIN `ttreceiptid` c ON c.`maxLogID` = b.`receiptLogID` WHERE "; | ||||
| 					$searchQuery .= "c.`maxLogID`=b.`receiptLogID` AND `tblDocuments`.`id` = a.`documentID` "; | ||||
| 					$searchQuery .= "AND (".implode(' OR ', $searchReception)."))"; | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			if($searchKey || $searchOwner || $searchCategories || $searchCreateDate || $searchExpirationDate || $searchAttributes || $status || $reception) { | ||||
| 				// Count the number of rows that the search will produce.
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann