- Renamed BenutzerfunktionModel->getByPersonId to getActiveFunctionsByPersonId

- BenutzerfunktionModel->getActiveFunctionsByPersonId changed query to get only active functions
- Removed commented code
This commit is contained in:
Paolo
2020-02-26 17:22:59 +01:00
parent a50cc6cba8
commit 34b6581849
4 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ class MessageLib
$this->_ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
// Retrieves organisation units for a user from database
$benutzer = $this->_ci->BenutzerfunktionModel->getByPersonId($sender_id);
$benutzer = $this->_ci->BenutzerfunktionModel->getActiveFunctionsByPersonId($sender_id);
if (isSuccess($benutzer)) // if everything is ok
{
$ouArray = array();
@@ -11,16 +11,20 @@ class Benutzerfunktion_model extends DB_Model
$this->dbTable = 'public.tbl_benutzerfunktion';
$this->pk = 'benutzerfunktion_id';
}
/**
* Get the Benutzerfunktion using the person_id
*/
public function getByPersonId($person_id)
public function getActiveFunctionsByPersonId($person_id)
{
// Join with the table
$this->addJoin('public.tbl_benutzer', 'uid');
return $this->loadWhere(array('person_id' => $person_id));
$query = 'SELECT bf.*
FROM public.tbl_benutzerfunktion bf
JOIN public.tbl_benutzer b USING (uid)
WHERE b.person_id = ?
AND (bf.datum_von IS NULL OR bf.datum_von <= now())
AND (bf.datum_bis IS NULL OR bf.datum_bis >= now())';
return $this->execQuery($query, array($person_id));
}
/**
@@ -139,7 +139,6 @@
'Dropdown_widget',
array('elements' => success($recipientsArray), 'emptyElement' => ucfirst($this->p->t('global', 'empfaenger')).'...'),
array(
/*'title' => ucfirst($this->p->t('global', 'empfaenger')).':&nbsp;',*/
'name' => 'recipients[]',
'id' => 'recipients'
)
-1
View File
@@ -63,7 +63,6 @@ class Vorlage_widget extends DropdownWidget
FROM tbl_vorlagestudiengang vs INNER JOIN tbl_vorlage v USING(vorlage_kurzbz)
) templates';
$alias = 'templates';
//$fields = array("templates.vorlage_kurzbz AS id", "UPPER(templates.oe_kurzbz) || ' - ' || templates.bezeichnung || ' - V' || templates.version AS description");
$fields = array("templates.vorlage_kurzbz AS id", "templates.bezeichnung AS description");
$where = 'templates.aktiv = TRUE
AND templates.subject IS NOT NULL