From 0a6630cb2bb63254bc413baa96d192090fff1675 Mon Sep 17 00:00:00 2001
From: Pierre-Lin Bonnemaison <pierre.lin@free.fr>
Date: Mon, 21 Sep 2015 22:02:50 +0200
Subject: [PATCH] =?UTF-8?q?Ajout=20du=20nom=20du=20contact=20sur=20les=20S?=
 =?UTF-8?q?MS=20re=C3=A7us?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 controllers/receiveds.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/controllers/receiveds.php b/controllers/receiveds.php
index 517ba50..a50d0c6 100755
--- a/controllers/receiveds.php
+++ b/controllers/receiveds.php
@@ -40,6 +40,16 @@
 			//Récupération des SMS envoyés triés par date, du plus récent au plus ancien, par paquets de $limit, en ignorant les $offset premiers
 			$receiveds = $db->getFromTableWhere('receiveds', [], 'at', true, $limit, $offset);
 
+			foreach ($receiveds as $key => $received)
+			{
+				if (!$contacts = $db->getFromTableWhere('contacts', ['number' => $received['send_by']]))
+				{
+					continue;
+				}	
+
+				$receiveds[$key]['send_by'] = $contacts[0]['name'] . ' (' . $received['send_by'] . ')';
+			}
+
 			return $this->render('receiveds/showAll', array(
 				'receiveds' => $receiveds,
 				'page' => $page,