From 99e541d5065fd3623fe5cc4261e827f1725b2d69 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 28 Jun 2019 19:18:18 +0200 Subject: [PATCH] Fixed receiver/sender retrieved from database --- application/models/CL/Messages_model.php | 2 +- application/models/system/Recipient_model.php | 11 ++++++----- public/js/messaging/read.js | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 5810487a9..37b244038 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -124,7 +124,7 @@ class Messages_model extends CI_Model $jsonRecord->message_id = $sentMessage->message_id; $jsonRecord->subject = $sentMessage->subject; $jsonRecord->body = $sentMessage->body; - $jsonRecord->from = $sentMessage->vorname.' '.$sentMessage->nachname; + $jsonRecord->to = $sentMessage->vorname.' '.$sentMessage->nachname; $sentDate = new DateTime($sentMessage->sent); $jsonRecord->sent = $sentDate->format('d/m/Y H:i:s'); $jsonRecord->status = $sentMessage->status; diff --git a/application/models/system/Recipient_model.php b/application/models/system/Recipient_model.php index 39961cdbf..8a3ee1aa6 100644 --- a/application/models/system/Recipient_model.php +++ b/application/models/system/Recipient_model.php @@ -316,7 +316,7 @@ class Recipient_model extends DB_Model FROM public.tbl_msg_recipient mr JOIN public.tbl_msg_message mm ON (mm.message_id = mr.message_id) JOIN public.tbl_msg_status ms ON (ms.message_id = mr.message_id AND ms.person_id = mr.person_id) - JOIN public.tbl_person p ON (p.person_id = mm.person_id) + JOIN public.tbl_person p ON (p.person_id = mr.person_id) WHERE mr.person_id = ? AND mr.sent IS NOT NULL AND mr.sentinfo IS NULL @@ -333,8 +333,8 @@ class Recipient_model extends DB_Model mm.subject, mm.body, mrou.sent AS sent, - p.vorname, - p.nachname, + pr.vorname, + pr.nachname, MAX(ms.status) AS status FROM public.tbl_person p JOIN public.tbl_benutzer b ON (b.person_id = p.person_id) @@ -342,6 +342,7 @@ class Recipient_model extends DB_Model JOIN public.tbl_msg_recipient mrou ON (mrou.oe_kurzbz = bf.oe_kurzbz) JOIN public.tbl_msg_message mm ON (mm.message_id = mrou.message_id) JOIN public.tbl_msg_status ms ON (ms.message_id = mrou.message_id AND ms.person_id = mrou.person_id) + JOIN public.tbl_person pr ON (pr.person_id = mrou.person_id) WHERE p.person_id = ? AND mrou.sent IS NOT NULL AND mrou.sentinfo IS NULL @@ -350,8 +351,8 @@ class Recipient_model extends DB_Model mm.subject, mm.body, mrou.sent, - p.vorname, - p.nachname + pr.vorname, + pr.nachname ORDER BY sent DESC'; return $this->execQuery($sql, array($person_id, $functions, $person_id)); diff --git a/public/js/messaging/read.js b/public/js/messaging/read.js index c4a27edc6..348e6b3ed 100644 --- a/public/js/messaging/read.js +++ b/public/js/messaging/read.js @@ -102,6 +102,7 @@ $(document).ready(function () { columns: [ {title: "Subject", field: "subject", width: 700, responsive: 0}, {title: "From", field: "from", width: 400}, + {title: "To", field: "to", width: 400}, {title: "Date", field: "sent", sorter: "datetime", width: 150} ], rowClick: changeTinyMCE