- Changed config entry addons_aufnahme_url in fhcomplete.php. Now it's an array having an entry for each organisation unit root

- Changed redirectByToken method in controllers/Redirect, now:
	- Loads the root of the organisation unit tree using the oe_kurzbz present in the message, loaded using a token
	- Redirect to the related aufnahme using the organisation unit previously found
- Changed method send in system/Messages, now retrives the oe_kurzbz of the recipients/prestudents to store these oe_kurzbz in the table tbl_msg_message (used by FAS)
- Added method getRoot to library OrganisationseinheitLib to retrive the root of an organisation unit by the given oe_kurzbz
- Added method getOrganisationunits to model crm/Prestudent_model, retrives the oe_kurzbz using the given prestudent/s id/s
- Added some comments here and there
This commit is contained in:
Paolo
2017-09-19 17:34:00 +02:00
parent 0f68237b9b
commit f7153aa6f5
7 changed files with 209 additions and 103 deletions
+14 -1
View File
@@ -88,7 +88,7 @@ class Prestudent_model extends DB_Model
)
{
if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent;
$this->addSelect(
'p.person_id,
prestudent_id,
@@ -179,4 +179,17 @@ class Prestudent_model extends DB_Model
return $this->loadWhere($parametersArray);
}
/**
* getOrganisationunits
*/
public function getOrganisationunits($prestudent_id)
{
$query = 'SELECT p.prestudent_id, s.oe_kurzbz
FROM public.tbl_prestudent p
INNER JOIN public.tbl_studiengang s USING(studiengang_kz)
WHERE prestudent_id %s ?';
return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id));
}
}
@@ -1,4 +1,5 @@
<?php
class Organisationseinheit_model extends DB_Model
{
/**
@@ -11,6 +12,9 @@ class Organisationseinheit_model extends DB_Model
$this->pk = 'oe_kurzbz';
}
/**
* getRecursiveList
*/
public function getRecursiveList($typ = null)
{
$qry = "WITH RECURSIVE tree (oe_kurzbz, bezeichnung, path, organisationseinheittyp_kurzbz) AS (
@@ -31,17 +35,17 @@ class Organisationseinheit_model extends DB_Model
SELECT oe_kurzbz AS id,
SUBSTRING(REGEXP_REPLACE(path, '[A-z]+\|', '-', 'g') || bezeichnung, 2) AS description
FROM tree";
$parametersArray = array();
if (is_array($typ) && count($typ) > 0)
{
$parametersArray[] = $typ;
$qry .= ' WHERE organisationseinheittyp_kurzbz IN ?';
}
$qry .= ' ORDER BY path';
return $this->execQuery($qry, $parametersArray);
}
@@ -78,12 +82,15 @@ class Organisationseinheit_model extends DB_Model
) _joined_table ON (orgs._pk = _joined_table._pk)
WHERE orgs._pk = ?
ORDER BY %s";
$query = sprintf($query, $table, $fields, $schema, $table, $where, $orderby);
return $this->execQuery($query, array($oe_kurzbz));
}
/**
* getOneLevelAlias
*/
public function getOneLevelAlias($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
{
$query = "WITH RECURSIVE organizations(_pk, _ppk) AS
@@ -103,9 +110,9 @@ class Organisationseinheit_model extends DB_Model
) _joined_table ON (orgs._pk = _joined_table._jtpk)
WHERE orgs._pk = ?
ORDER BY %s";
$query = sprintf($query, $alias, $fields, $table, $where, $orderby);
return $this->execQuery($query, array($oe_kurzbz));
}
}
}