- 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
@@ -10,14 +10,14 @@ class OrganisationseinheitLib
public function __construct()
{
$this->ci =& get_instance();
// Loads model Organisationseinheit_model
$this->ci->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
// Loads helper message to manage returning messages
$this->ci->load->helper('Message');
}
/**
* treeSearch
*
@@ -54,7 +54,7 @@ class OrganisationseinheitLib
}
$result = $this->ci->OrganisationseinheitModel->getOneLevel($schema, $table, $select, $where, $orderby, $oe_kurzbz);
if (hasData($result))
{
if ($result->retval[0]->_ppk != null && $result->retval[0]->oe_kurzbz == null)
@@ -62,12 +62,14 @@ class OrganisationseinheitLib
return $this->treeSearch($schema, $table, $select, $where, $orderby, $result->retval[0]->_ppk);
}
}
return $result;
}
/**
* treeSearchEntire
*
* Like tree search, but it returns all the results found while travelling through the tree structure
*/
public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz)
{
@@ -89,13 +91,13 @@ class OrganisationseinheitLib
}
$result = $this->ci->OrganisationseinheitModel->getOneLevelAlias($table, $alias, $select, $where, $orderby, $oe_kurzbz);
if (hasData($result))
{
if ($result->retval[0]->_pk != null && $result->retval[0]->_ppk != null && $result->retval[0]->_jtpk != null)
{
$tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
if (hasData($tmpResult)
&& $tmpResult->retval[0]->_pk != null
&& $tmpResult->retval[0]->_ppk != null
@@ -109,7 +111,25 @@ class OrganisationseinheitLib
$result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk);
}
}
return $result;
}
/**
* getRoot - Get the root of the organisation unit tree which belongs the given organisation unit parameter
*/
public function getRoot($oe_kurzbz)
{
$result = $this->ci->OrganisationseinheitModel->load($oe_kurzbz);
if (hasData($result))
{
if ($result->retval[0]->oe_parent_kurzbz != null)
{
$result = $this->getRoot($result->retval[0]->oe_parent_kurzbz);
}
}
return $result;
}
}