mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
- Added new config entry ou_function_whitelist in message.php
- Added new constant CFG_OU_FUNCTION_WHITELIST in library MessageLib - MessageLib->getOeKurzbz now filters out organization units based on config entry ou_function_whitelist - Removed redundant templates in Vorlage_widget
This commit is contained in:
@@ -18,6 +18,8 @@ $config['ou_receivers'] = array('ass');
|
||||
$config['ou_receivers_no_notice'] = array('infocenter');
|
||||
// Organization units that will not send the notice email to the internal account, but to the private one
|
||||
$config['ou_receivers_private'] = array('eac', 'ewu', 'scs');
|
||||
//
|
||||
$config['ou_function_whitelist'] = array('ass', 'Leitung');
|
||||
|
||||
$config['message_redirect_url'] = array();
|
||||
$config['message_redirect_url']['fallback'] = site_url('system/messages/ViewMessage/writeReply');
|
||||
|
||||
@@ -15,6 +15,7 @@ class MessageLib
|
||||
const CFG_OU_RECEIVERS = 'ou_receivers';
|
||||
const CFG_OU_RECEIVERS_NO_NOTICE = 'ou_receivers_no_notice';
|
||||
const CFG_OU_RECEIVERS_PRIVATE = 'ou_receivers_private';
|
||||
const CFG_OU_FUNCTION_WHITELIST = 'ou_function_whitelist';
|
||||
const CFG_REDIRECT_VIEW_MESSAGE_URL = 'redirect_view_message_url';
|
||||
|
||||
// Templates names
|
||||
@@ -229,7 +230,14 @@ class MessageLib
|
||||
$ouArray = array();
|
||||
|
||||
// Copies organisation units in $ouArray array
|
||||
foreach (getData($benutzer) as $val) $ouArray[] = $val->oe_kurzbz;
|
||||
foreach (getData($benutzer) as $val)
|
||||
{
|
||||
// If the function is in the white list then get the organisation unit
|
||||
if (in_array($val->funktion_kurzbz, $this->_ci->config->item(self::CFG_OU_FUNCTION_WHITELIST)))
|
||||
{
|
||||
$ouArray[] = $val->oe_kurzbz;
|
||||
}
|
||||
}
|
||||
|
||||
return success($ouArray);
|
||||
}
|
||||
|
||||
@@ -125,12 +125,12 @@ class Organisationseinheit_model extends DB_Model
|
||||
public function getChilds($oe_kurzbz, $includeinactive = false)
|
||||
{
|
||||
$query = "
|
||||
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
(
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz=? %s
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
WHERE o.oe_parent_kurzbz=oes.oe_kurzbz %s
|
||||
)
|
||||
SELECT oe_kurzbz
|
||||
@@ -150,12 +150,12 @@ class Organisationseinheit_model extends DB_Model
|
||||
public function getParents($oe_kurzbz, $includeinactive = false)
|
||||
{
|
||||
$query=
|
||||
"WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
"WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
|
||||
(
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
|
||||
WHERE oe_kurzbz=? %s
|
||||
UNION ALL
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
|
||||
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz %s
|
||||
)
|
||||
SELECT oe_kurzbz
|
||||
@@ -177,7 +177,7 @@ class Organisationseinheit_model extends DB_Model
|
||||
{
|
||||
$condition = '
|
||||
oe_kurzbz = (
|
||||
SELECT
|
||||
SELECT
|
||||
oe_parent_kurzbz
|
||||
FROM
|
||||
public.tbl_organisationseinheit
|
||||
|
||||
@@ -11,9 +11,9 @@ class Vorlage_widget extends DropdownWidget
|
||||
$vorlage = null;
|
||||
|
||||
// If the user is an admin
|
||||
if ($idAdmin === true)
|
||||
if ($idAdmin)
|
||||
{
|
||||
// Get all the vorlage with mimetype = text/html
|
||||
// Get all the vorlage with mimetype = text/html
|
||||
$vorlage = $this->_getAllHTMLVorlage();
|
||||
}
|
||||
else
|
||||
@@ -39,7 +39,7 @@ class Vorlage_widget extends DropdownWidget
|
||||
private function _getAllHTMLVorlage()
|
||||
{
|
||||
$this->load->model('system/Vorlage_model', 'VorlageModel');
|
||||
$this->VorlageModel->addOrder('vorlage_kurzbz');
|
||||
$this->VorlageModel->addOrder('bezeichnung');
|
||||
|
||||
$this->addSelectToModel($this->VorlageModel, 'vorlage_kurzbz', 'bezeichnung');
|
||||
|
||||
@@ -59,15 +59,31 @@ class Vorlage_widget extends DropdownWidget
|
||||
$vorlage = success(array()); // Default value
|
||||
|
||||
$table = '(
|
||||
SELECT v.vorlage_kurzbz, v.bezeichnung, vs.version, vs.oe_kurzbz, vs.aktiv, vs.subject, vs.text, v.mimetype
|
||||
FROM tbl_vorlagestudiengang vs INNER JOIN tbl_vorlage v USING(vorlage_kurzbz)
|
||||
SELECT v.vorlage_kurzbz,
|
||||
v.bezeichnung,
|
||||
vs.version,
|
||||
vs.oe_kurzbz,
|
||||
vs.aktiv,
|
||||
vs.subject,
|
||||
vs.text,
|
||||
v.mimetype
|
||||
FROM tbl_vorlagestudiengang vs
|
||||
JOIN tbl_vorlage v USING(vorlage_kurzbz)
|
||||
) templates';
|
||||
|
||||
$alias = 'templates';
|
||||
$fields = array("templates.vorlage_kurzbz AS id", "templates.bezeichnung AS description");
|
||||
|
||||
$fields = array(
|
||||
'templates.vorlage_kurzbz AS id',
|
||||
'templates.bezeichnung || \' (\' || UPPER(templates.oe_kurzbz) || \')\' AS description'
|
||||
);
|
||||
|
||||
$where = 'templates.aktiv = TRUE
|
||||
AND templates.subject IS NOT NULL
|
||||
AND templates.text IS NOT NULL
|
||||
AND templates.mimetype = \'text/html\'';
|
||||
AND templates.subject IS NOT NULL
|
||||
AND templates.text IS NOT NULL
|
||||
AND templates.mimetype = \'text/html\'
|
||||
GROUP BY 1, 2, 3';
|
||||
|
||||
$order_by = 'description ASC';
|
||||
|
||||
if (!is_array($oe_kurzbz))
|
||||
@@ -99,30 +115,37 @@ class Vorlage_widget extends DropdownWidget
|
||||
if (hasData($tmpVorlage))
|
||||
{
|
||||
// If it's the first vorlage copy it
|
||||
if (count($vorlage->retval) == 0)
|
||||
if (!hasData($vorlage))
|
||||
{
|
||||
for ($j = 0; $j < count($tmpVorlage->retval); $j++)
|
||||
for ($j = 0; $j < count(getData($tmpVorlage)); $j++)
|
||||
{
|
||||
if ($tmpVorlage->retval[$j]->id != '')
|
||||
if (getData($tmpVorlage)[$j]->id != '')
|
||||
{
|
||||
array_push($vorlage->retval, $tmpVorlage->retval[$j]);
|
||||
array_push($vorlage->retval, getData($tmpVorlage)[$j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // checks for duplicates, if it's not already present push it into the array $vorlage->retval
|
||||
else // checks for duplicates, if it's not already present push it into the array getData($vorlage)
|
||||
{
|
||||
for ($i = 0; $i < count($vorlage->retval); $i++)
|
||||
for ($j = 0; $j < count(getData($tmpVorlage)); $j++)
|
||||
{
|
||||
for ($j = 0; $j < count($tmpVorlage->retval); $j++)
|
||||
$found = false;
|
||||
$currentTmpVorlageData = null;
|
||||
|
||||
for ($i = 0; $i < count(getData($vorlage)); $i++)
|
||||
{
|
||||
if ($tmpVorlage->retval[$j]->id != ''
|
||||
&& $vorlage->retval[$i]->_pk != $tmpVorlage->retval[$j]->_pk
|
||||
&& $vorlage->retval[$i]->_ppk != $tmpVorlage->retval[$j]->_ppk
|
||||
&& $vorlage->retval[$i]->_jtpk != $tmpVorlage->retval[$j]->_jtpk)
|
||||
$currentTmpVorlageData = getData($tmpVorlage)[$j];
|
||||
|
||||
if (getData($vorlage)[$i]->_pk == getData($tmpVorlage)[$j]->_pk
|
||||
&& getData($vorlage)[$i]->_ppk == getData($tmpVorlage)[$j]->_ppk
|
||||
&& getData($vorlage)[$i]->_jtpk == getData($tmpVorlage)[$j]->_jtpk)
|
||||
{
|
||||
array_push($vorlage->retval, $tmpVorlage->retval[$j]);
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found && $currentTmpVorlageData->id != '') array_push($vorlage->retval, $currentTmpVorlageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user