Infocenter is now hardcoded in recipient messages to avoid to display an empty "message to"

This commit is contained in:
Paolo
2020-01-22 15:04:07 +01:00
parent 0244caaa70
commit 3e72f399be
2 changed files with 11 additions and 5 deletions
+3 -2
View File
@@ -21,6 +21,7 @@ class Messages_model extends CI_Model
</blockquote>';
const NO_AUTH_UID = 'online'; // hard coded uid if no authentication is performed
const ALT_OE = 'infocenter'; // alternative organisation unit when no one is found for a presetudent
/**
* Constructor
@@ -86,7 +87,7 @@ class Messages_model extends CI_Model
{
$ouOptions .= sprintf(
"\n".'<option value="%s">%s</option>',
is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : 'infocenter',
is_numeric($ou->prestudent_id) ? $ou->oe_kurzbz : self::ALT_OE,
$ou->bezeichnung
);
}
@@ -182,7 +183,7 @@ class Messages_model extends CI_Model
public function prepareAjaxReadSent()
{
// Retrieves sent messages from the logged user
$sentMessagesResult = $this->RecipientModel->getSentMessages(getAuthPersonId());
$sentMessagesResult = $this->RecipientModel->getSentMessages(getAuthPersonId(), self::ALT_OE);
if (isError($sentMessagesResult)) return $sentMessagesResult; // If an error occurred return it
if (hasData($sentMessagesResult))
@@ -446,7 +446,7 @@ class Recipient_model extends DB_Model
/**
* Gets all the sent message by the given person
*/
public function getSentMessages($person_id)
public function getSentMessages($person_id, $altOe = '')
{
$sql = 'SELECT mm.message_id,
mm.relationmessage_id,
@@ -464,7 +464,12 @@ class Recipient_model extends DB_Model
JOIN public.tbl_msg_recipient mr ON (mr.message_id = mm.message_id)
JOIN public.tbl_msg_status ms ON (ms.message_id = mm.message_id AND mr.person_id = mr.person_id)
JOIN public.tbl_person p ON (p.person_id = mr.person_id)
LEFT JOIN public.tbl_studiengang sg ON (sg.oe_kurzbz = mr.oe_kurzbz)
LEFT JOIN (
SELECT oe_kurzbz, bezeichnung
FROM public.tbl_studiengang
UNION
SELECT ?, ?
) sg ON (sg.oe_kurzbz = mr.oe_kurzbz)
WHERE mm.person_id = ?
AND mr.sent IS NOT NULL
AND mr.sentinfo IS NULL
@@ -481,6 +486,6 @@ class Recipient_model extends DB_Model
mr.token
ORDER BY mr.sent DESC';
return $this->execQuery($sql, array($person_id));
return $this->execQuery($sql, array($altOe, ucfirst($altOe), $person_id));
}
}