From c7b33fe160b67202d359f1b400238da918c8c291 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 11 Feb 2020 16:04:08 +0100 Subject: [PATCH] Bugfix: FAS write page person id and prestudent id are swapped --- application/models/CL/Messages_model.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 87eff0f99..3c8217e73 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -687,9 +687,18 @@ class Messages_model extends CI_Model foreach (getData($info) as $receiver) { $recipient = new stdClass(); - $recipient->id = $receiver->person_id; $recipient->description = $receiver->Vorname.' '.$receiver->Nachname; + // If it is a prestudent then + if (isset($receiver->prestudent_id) && is_numeric($receiver->prestudent_id)) + { + $recipient->id = $receiver->prestudent_id; + } + else // otherwise it is a person + { + $recipient->id = $receiver->person_id; + } + $recipientsArray[] = $recipient; $recipientsList .= $receiver->Vorname.' '.$receiver->Nachname.'; '; $persons .= ''."\n"; @@ -723,7 +732,7 @@ class Messages_model extends CI_Model // If data contains a prestudent id // NOTE: // - info is checked at the beginning of this method so it is safe to use getData($info)[0] - // - the provided data inside info are all persons or prestudents, so it is safe to check only the first one + // - the provided data inside info are all persons or all prestudents, so it is safe to check only the first one if (isset(getData($info)[0]->prestudent_id) && is_numeric(getData($info)[0]->prestudent_id)) { $variablesResult = $this->messagelib->getMessageVarsPrestudent();