- Remove global constant OU_SENDER_TEST_REMINDER from application/config/constants.php

- Page for the Infocenter details messages block should use CL/Message_model logic
- Page to read personal messages wrongly displays the sender
- Page to read message with token wrongly displays the sender
- All the pages should display the sender using the following logic:
 	- If the sender id is set and it is not the system sender and the organization unit is not set then display the sender name + surname
 	- If the sender id is set and it is not the system sender and the organization unit is set then display the sender name + surname
 	- If the sender id is set and it is the system sender and the organization unit is set then display the organization unit
 	- If the sender id is set and it is the system sender and the organization unit is not set then display "System sender"
 	- The organization unit should firstly retrieved from the degree programs, if not available then from the organization units, if not available then display "System sender"
- Centralized this logic in the CL/Message_model as much as possible
This commit is contained in:
Paolo
2023-04-19 13:51:53 +02:00
parent 932f5efb5c
commit a0b368683e
8 changed files with 398 additions and 318 deletions
@@ -77,69 +77,6 @@ class Message_model extends DB_Model
return $this->execQuery($sql, $parametersArray);
}
/**
* Gets massages with a person being sender OR receiver.
* @param $person_id
* @param null $status message status. by default, latest status is returned
* @return array|null
*/
public function getMessagesOfPerson($person_id, $status = null)
{
$sql = 'SELECT m.message_id,
m.person_id,
m.subject,
m.body,
m.priority,
m.insertamum,
m.relationmessage_id,
m.oe_kurzbz,
oe.bezeichnung AS oebezeichnung,
se.person_id AS sepersonid,
se.anrede AS seanrede,
se.titelpost AS setitelpost,
se.titelpre AS setitelpre,
se.nachname AS senachname,
se.vorname AS sevorname,
se.vornamen AS sevornamen,
re.person_id AS repersonid,
re.anrede AS reanrede,
re.titelpost AS retitelpost,
re.titelpre AS retitelpre,
re.nachname AS renachname,
re.vorname AS revorname,
re.vornamen AS revornamen,
s.status,
s.statusinfo,
s.insertamum AS statusamum
FROM public.tbl_msg_message m
JOIN public.tbl_msg_recipient r ON m.message_id = r.message_id
JOIN public.tbl_person se ON (m.person_id = se.person_id)
JOIN public.tbl_person re ON (r.person_id = re.person_id)
JOIN public.tbl_organisationseinheit oe ON (m.oe_kurzbz = oe.oe_kurzbz)
LEFT JOIN (
SELECT message_id, person_id, status, statusinfo, insertamum
FROM public.tbl_msg_status
%s
ORDER BY insertamum DESC
) s ON (m.message_id = s.message_id AND re.person_id = s.person_id)
WHERE se.person_id = ?
OR re.person_id = ?
';
if (is_numeric($status))
{
$sql = sprintf($sql, 'WHERE status = '.$status);
}
else
{
$sql = sprintf($sql, '');
}
$parametersArray = array($person_id, $person_id);
return $this->execQuery($sql, $parametersArray);
}
/**
* getMessageVars
*/