From 9e25c76c37341e3a4d4637e6ad09ad7681a919ec Mon Sep 17 00:00:00 2001 From: Laurent Giovannoni <laurent.giovannoni@maarch.org> Date: Wed, 14 Jun 2017 12:20:57 +0200 Subject: [PATCH] FIX #5628 --- .../indexing_searching/contact_check.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/maarch_entreprise/indexing_searching/contact_check.php b/apps/maarch_entreprise/indexing_searching/contact_check.php index b4590d5308f..49925e83ab6 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){ -- GitLab