diff --git a/apps/maarch_entreprise/indexing_searching/contact_check.php b/apps/maarch_entreprise/indexing_searching/contact_check.php index b4590d5308fff3f3658e5ee836a954a6b13ba6fe..49925e83ab6daac09b049f241bca7404ad9d6487 100644 --- a/apps/maarch_entreprise/indexing_searching/contact_check.php +++ b/apps/maarch_entreprise/indexing_searching/contact_check.php @@ -52,12 +52,12 @@ if(empty($_POST['contact_id']) || $_POST['category'] == 'outgoing'){ $wherePDO = "status <> 'DEL' AND (exp_user_id = ? OR dest_user_id = ?) AND (creation_date >= " . $db->current_datetime() . " - INTERVAL '".$_SESSION['check_days_before']."' DAY)"; $arrayPDO = array($_POST['contact_id'], $_POST['contact_id']); } - echo $wherePDO; + //echo $wherePDO; //MERGE GLOBAL SECURITY WITH QUERY DOC $wherePDO = $wherePDO . ' AND ('.$whereSec.')'; - $query = "SELECT res_id FROM res_view_letterbox WHERE ".$wherePDO; + //$query = "SELECT res_id FROM res_view_letterbox WHERE ".$wherePDO; //EXCLUDE OWN RES_ID if($_POST['res_id'] != "none"){ @@ -67,7 +67,9 @@ if(empty($_POST['contact_id']) || $_POST['category'] == 'outgoing'){ $_SESSION['excludeId'] = $_POST['res_id']; } - $query .= " ORDER by creation_date DESC limit 1"; + $order = " ORDER by creation_date DESC"; + $query = $db->limit_select(0, 1, 'res_id', 'res_view_letterbox', $wherePDO . $order); + $stmt = $db->query($query, $arrayPDO); if ($stmt->rowCount() > 0){