From 26b0ce47a7c4a152be6dcf6d46c5de931e7098e1 Mon Sep 17 00:00:00 2001 From: osaajani <> Date: Fri, 3 Apr 2020 17:09:48 +0200 Subject: [PATCH] fix discussion to use last number --- controllers/publics/Discussion.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/controllers/publics/Discussion.php b/controllers/publics/Discussion.php index 2789920..784013e 100644 --- a/controllers/publics/Discussion.php +++ b/controllers/publics/Discussion.php @@ -75,17 +75,16 @@ namespace controllers\publics; $last_sended = $this->internal_sended->get_last_for_destination_and_user($_SESSION['user']['id'], $number); $last_received = $this->internal_received->get_last_for_origin_and_user($_SESSION['user']['id'], $number); - $response_number = ($last_received['destination'] ?? $last_sended['origin'] ?? false); - $response_phone = false; - if ($response_number) + $response_phone_id = ($last_received['id_phone'] ?? $last_sended['id_phone'] ?? false); + if ($response_phone_id) { - $response_phone = $this->internal_phone->get_by_number_and_user($_SESSION['user']['id'], $response_number); + $response_phone = $this->internal_phone->get_for_user($_SESSION['user']['id'], $response_phone_id); } $this->render('discussion/show', [ 'number' => $number, 'contact' => $contact, - 'response_phone' => $response_phone, + 'response_phone' => $response_phone ?? false, ]); }