Do not retrieve the degree program name from studiengang table but directly from the organization unit table

in student sent messages page and student write to organisation unit page
This commit is contained in:
Paolo
2020-02-04 14:42:53 +01:00
parent d496bf5993
commit 53ac4d11ba
3 changed files with 11 additions and 15 deletions
+2 -2
View File
@@ -183,7 +183,7 @@ class Messages_model extends CI_Model
public function prepareAjaxReadSent()
{
// Retrieves sent messages from the logged user
$sentMessagesResult = $this->RecipientModel->getSentMessages(getAuthPersonId(), self::ALT_OE);
$sentMessagesResult = $this->RecipientModel->getSentMessages(getAuthPersonId());
if (isError($sentMessagesResult)) return $sentMessagesResult; // If an error occurred return it
if (hasData($sentMessagesResult))
@@ -205,7 +205,7 @@ class Messages_model extends CI_Model
if ($sentMessage->person_id == $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID))
{
$jsonRecord->to = $sentMessage->sg;
$jsonRecord->to = $sentMessage->oe;
}
else
{
+4 -3
View File
@@ -524,11 +524,12 @@ class Prestudent_model extends DB_Model
/**
* Get organisation units for all the prestudents of a person
* TODO
*/
public function getOrganisationunitsByPersonId($person_id)
{
$query = 'SELECT o.oe_kurzbz,
sg.bezeichnung,
o.bezeichnung,
ps.prestudent_id
FROM public.tbl_prestudent p
JOIN public.tbl_studiengang sg USING(studiengang_kz)
@@ -541,9 +542,9 @@ class Prestudent_model extends DB_Model
) ps USING(prestudent_id)
WHERE p.person_id = ?
GROUP BY o.oe_kurzbz,
sg.bezeichnung,
o.bezeichnung,
ps.prestudent_id
ORDER BY sg.bezeichnung';
ORDER BY o.bezeichnung';
return $this->execQuery($query, array($person_id));
}
+5 -10
View File
@@ -446,7 +446,7 @@ class Recipient_model extends DB_Model
/**
* Gets all the sent message by the given person
*/
public function getSentMessages($person_id, $altOe = '')
public function getSentMessages($person_id)
{
$sql = 'SELECT mm.message_id,
mm.relationmessage_id,
@@ -458,18 +458,13 @@ class Recipient_model extends DB_Model
p.nachname,
MAX(ms.status) AS status,
ms.person_id AS statusPersonId,
sg.bezeichnung AS sg,
oe.bezeichnung AS oe,
mr.token
FROM public.tbl_msg_message mm
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 (
SELECT oe_kurzbz, bezeichnung
FROM public.tbl_studiengang
UNION
SELECT ?, ?
) sg ON (sg.oe_kurzbz = mr.oe_kurzbz)
JOIN public.tbl_organisationseinheit oe ON (oe.oe_kurzbz = mr.oe_kurzbz)
WHERE mm.person_id = ?
AND mr.sent IS NOT NULL
AND mr.sentinfo IS NULL
@@ -482,10 +477,10 @@ class Recipient_model extends DB_Model
p.vorname,
p.nachname,
ms.person_id,
sg.bezeichnung,
oe.bezeichnung,
mr.token
ORDER BY mr.sent DESC';
return $this->execQuery($sql, array($altOe, ucfirst($altOe), $person_id));
return $this->execQuery($sql, array($person_id));
}
}