mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- ViewMessage: checks if the receiver is an employee or not. If an
employee then hides the reply link - Added isEmployee method to MessageToken_model
This commit is contained in:
@@ -153,10 +153,13 @@ class MessageToken_model extends CI_Model
|
||||
p.anrede,
|
||||
p.titelpost,
|
||||
p.titelpre,
|
||||
p.vornamen
|
||||
p.vornamen,
|
||||
m.mitarbeiter_uid
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN public.tbl_benutzer b USING(person_id)
|
||||
LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
WHERE p.person_id = ?';
|
||||
|
||||
|
||||
$result = $this->db->query($sql, array($person_id));
|
||||
|
||||
// If no errors occurred
|
||||
@@ -169,4 +172,41 @@ class MessageToken_model extends CI_Model
|
||||
return error($this->db->error());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function isEmployee($person_id)
|
||||
{
|
||||
$sql = 'SELECT m.mitarbeiter_uid
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN public.tbl_benutzer b USING(person_id)
|
||||
LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
WHERE p.person_id = ?
|
||||
AND b.aktiv = TRUE';
|
||||
|
||||
$result = $this->db->query($sql, array($person_id));
|
||||
|
||||
// If no errors occurred
|
||||
if ($result)
|
||||
{
|
||||
// If data are present
|
||||
if (is_array($result->result()) && count($result->result()) > 0)
|
||||
{
|
||||
$person = $result->result()[0];
|
||||
|
||||
// If it is an employee
|
||||
if ($person->mitarbeiter_uid != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user