diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index 3035e532d..77b46f97b 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -42,14 +42,22 @@ class Messages extends FHCAPI_Controller ]); } - public function getMessages($id, $type_id, $size, $page) + public function getMessages($id, $type_id, $size=null, $page=null) { if($type_id != 'person_id'){ $id = $this->_getPersonId($id, $type_id); } - $offset = $size * ($page - 1); - $limit = $size; + if(!(is_null($size) && is_null($page))) + { + $offset = $size * ($page - 1); + $limit = $size; + } + else + { + $offset = null; + $limit = null; + } $result = $this->MessageModel->getMessagesForTable($id, $offset, $limit); diff --git a/application/controllers/api/frontend/v1/stv/Students.php b/application/controllers/api/frontend/v1/stv/Students.php index 55f4b8976..f87e527e0 100644 --- a/application/controllers/api/frontend/v1/stv/Students.php +++ b/application/controllers/api/frontend/v1/stv/Students.php @@ -626,7 +626,7 @@ class Students extends FHCAPI_Controller $this->addFilter($studiensemester_kurzbz); $result = $this->PrestudentModel->loadWhere($where); - + $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); @@ -851,40 +851,44 @@ class Students extends FHCAPI_Controller $stdsemEsc = $studiensemester_kurzbz ? $this->PrestudentModel->escape($studiensemester_kurzbz) : 'NULL'; $this->load->config('stv'); - $tags = $this->config->item('stv_prestudent_tags'); - $whereTags = ''; - if (is_array($tags) && !isEmptyArray($tags)) { - $tags = array_keys($tags); + if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) + { + $tags = $this->config->item('stv_prestudent_tags'); - foreach ($tags as $key => $tag) { - $tags[$key] = $this->db->escape($tag); + $whereTags = ''; + if (is_array($tags) && !isEmptyArray($tags)) { + $tags = array_keys($tags); + + foreach ($tags as $key => $tag) { + $tags[$key] = $this->db->escape($tag); + } + $whereTags = " AND nt.typ_kurzbz IN (" . implode(",", $tags) . ")"; } - $whereTags = " AND nt.typ_kurzbz IN (" . implode(",", $tags) . ")"; + $subQueryTag = " + ( + SELECT + tag.prestudent_id, + COALESCE(json_agg(tag ORDER BY tag.done), '[]'::json) AS tags + FROM ( + SELECT DISTINCT ON (n.notiz_id) + n.notiz_id AS id, + nt.typ_kurzbz, + array_to_json(nt.bezeichnung_mehrsprachig)->>0 AS beschreibung, + n.text AS notiz, + nt.style, + n.erledigt AS done, + nz.prestudent_id + FROM public.tbl_notizzuordnung AS nz + JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id + JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz " + . $whereTags . + " + ) AS tag + GROUP BY tag.prestudent_id + ) AS tag_data_agg + "; } - $subQueryTag = " - ( - SELECT - tag.prestudent_id, - COALESCE(json_agg(tag ORDER BY tag.done), '[]'::json) AS tags - FROM ( - SELECT DISTINCT ON (n.notiz_id) - n.notiz_id AS id, - nt.typ_kurzbz, - array_to_json(nt.bezeichnung_mehrsprachig)->>0 AS beschreibung, - n.text AS notiz, - nt.style, - n.erledigt AS done, - nz.prestudent_id - FROM public.tbl_notizzuordnung AS nz - JOIN public.tbl_notiz AS n ON nz.notiz_id = n.notiz_id - JOIN public.tbl_notiz_typ AS nt ON n.typ = nt.typ_kurzbz " - . $whereTags . - " - ) AS tag - GROUP BY tag.prestudent_id - ) AS tag_data_agg - "; $this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz', 'LEFT'); $this->PrestudentModel->addJoin('public.tbl_person p', 'person_id'); @@ -907,11 +911,17 @@ class Students extends FHCAPI_Controller AND ps.studiensemester_kurzbz=public.get_stdsem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ') AND ps.ausbildungssemester=public.get_absem_prestudent(tbl_prestudent.prestudent_id, ' . $stdsemEsc . ')', 'LEFT'); - $this->PrestudentModel->addJoin($subQueryTag, 'tag_data_agg.prestudent_id = tbl_prestudent.prestudent_id', 'LEFT'); + if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) + { + $this->PrestudentModel->addJoin($subQueryTag, 'tag_data_agg.prestudent_id = tbl_prestudent.prestudent_id', 'LEFT'); + } $this->PrestudentModel->addSelect("b.uid"); - $this->PrestudentModel->addSelect('tag_data_agg.tags'); + if(defined('STV_TAGS_ENABLED') && STV_TAGS_ENABLED) + { + $this->PrestudentModel->addSelect('tag_data_agg.tags'); + } $this->PrestudentModel->addSelect('titelpre'); $this->PrestudentModel->addSelect('nachname'); $this->PrestudentModel->addSelect('vorname'); diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php b/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php index 6e7b0af06..50504099a 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilFactory.php @@ -3,6 +3,7 @@ namespace vertragsbestandteil; use Exception; use vertragsbestandteil\VertragsbestandteilStunden; +use vertragsbestandteil\VertragsbestandteilLohnguide; /** * Description of VertragsbestandteilFactory @@ -22,6 +23,7 @@ class VertragsbestandteilFactory const VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH = 'urlaubsanspruch'; const VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG = 'zeitaufzeichnung'; const VERTRAGSBESTANDTEIL_LEHRE = 'lehre'; + const VERTRAGSBESTANDTEIL_LOHNGUIDE = 'lohnguide'; public static function getVertragsbestandteil($data, $fromdb=false) { @@ -69,6 +71,11 @@ class VertragsbestandteilFactory $vertragsbestandteil = new VertragsbestandteilZeitaufzeichnung(); $vertragsbestandteil->hydrateByStdClass($data, $fromdb); break; + + case self::VERTRAGSBESTANDTEIL_LOHNGUIDE: + $vertragsbestandteil = new VertragsbestandteilLohnguide(); + $vertragsbestandteil->hydrateByStdClass($data, $fromdb); + break; default: throw new Exception('Unknown vertragsbestandteiltyp_kurzbz ' @@ -127,6 +134,12 @@ class VertragsbestandteilFactory $vertragsbestandteildbmodel = $CI->VertragsbestandteilZeitaufzeichnung_model; break; + case self::VERTRAGSBESTANDTEIL_LOHNGUIDE: + $CI->load->model('vertragsbestandteil/VertragsbestandteilLohnguide_model', + 'VertragsbestandteilLohnguide_model'); + $vertragsbestandteildbmodel = $CI->VertragsbestandteilLohnguide_model; + break; + default: throw new Exception('Unknown vertragsbestandteil_kurzbz ' . $vertragsbestandteil_kurzbz); diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index 1ecb9ac60..61208eda0 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -10,6 +10,7 @@ require_once __DIR__ . '/VertragsbestandteilKuendigungsfrist.php'; require_once __DIR__ . '/VertragsbestandteilUrlaubsanspruch.php'; require_once __DIR__ . '/VertragsbestandteilFreitext.php'; require_once __DIR__ . '/VertragsbestandteilKarenz.php'; +require_once __DIR__ . '/VertragsbestandteilLohnguide.php'; require_once __DIR__ . '/VertragsbestandteilFactory.php'; require_once __DIR__ . '/OverlapChecker.php'; diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php new file mode 100644 index 000000000..0e071f36b --- /dev/null +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLohnguide.php @@ -0,0 +1,155 @@ +setVertragsbestandteiltyp_kurzbz( + VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_LOHNGUIDE); + } + + public function getStellenbezeichnung() + { + return $this->stellenbezeichnung; + } + + public function setStellenbezeichnung($stellenbezeichnung): self + { + $this->markDirty('stellenbezeichnung', $this->stellenbezeichnung, $stellenbezeichnung); + $this->stellenbezeichnung = $stellenbezeichnung; + return $this; + } + + public function getVordienstzeit() + { + return $this->vordienstzeit; + } + + public function setVordienstzeit($vordienstzeit): self + { + $this->markDirty('vordienstzeit', $this->vordienstzeit, $vordienstzeit); + $this->vordienstzeit = $vordienstzeit; + return $this; + } + + public function getFachrichtung_kurzbz() + { + return $this->fachrichtung_kurzbz; + } + + public function setFachrichtung_kurzbz($fachrichtung_kurzbz): self + { + $this->markDirty('fachrichtung_kurzbz', $this->fachrichtung_kurzbz, $fachrichtung_kurzbz); + $this->fachrichtung_kurzbz = $fachrichtung_kurzbz; + return $this; + } + + public function getModellstelle_kurzbz() + { + return $this->modellstelle_kurzbz; + } + + public function setModellstelle_kurzbz($modellstelle_kurzbz): self + { + $this->markDirty('modellstelle_kurzbz', $this->modellstelle_kurzbz, $modellstelle_kurzbz); + $this->modellstelle_kurzbz = $modellstelle_kurzbz; + return $this; + } + + public function getKommentar_person() + { + return $this->kommentar_person; + } + + public function setKommentar_person($kommentar_person): self + { + $this->markDirty('kommentar_person', $this->kommentar_person, $kommentar_person); + $this->kommentar_person = $kommentar_person; + return $this; + } + + public function getKommentar_modellstelle() + { + return $this->kommentar_modellstelle; + } + + public function setKommentar_modellstelle($kommentar_modellstelle): self + { + $this->markDirty('kommentar_modellstelle', $this->kommentar_modellstelle, $kommentar_modellstelle); + $this->kommentar_modellstelle = $kommentar_modellstelle; + return $this; + } + + + + + public function hydrateByStdClass($data, $fromdb=false) + { + parent::hydrateByStdClass($data, $fromdb); + $this->fromdb = $fromdb; + isset($data->fachrichtung_kurzbz) && $this->setFachrichtung_kurzbz($data->fachrichtung_kurzbz); + isset($data->stellenbezeichnung) && $this->setStellenbezeichnung($data->stellenbezeichnung); + isset($data->vordienstzeit) && $this->setVordienstzeit($data->vordienstzeit); + isset($data->modellstelle_kurzbz) && $this->setModellstelle_kurzbz($data->modellstelle_kurzbz); + isset($data->kommentar_person) && $this->setKommentar_person($data->kommentar_person); + isset($data->kommentar_modellstelle) && $this->setKommentar_modellstelle($data->kommentar_modellstelle); + $this->fromdb = false; + } + + public function toStdClass(): \stdClass + { + $tmp = array( + 'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(), + 'stellenbezeichnung' => $this->getStellenbezeichnung(), + 'vordienstzeit' => $this->getVordienstzeit(), + 'fachrichtung_kurzbz' => $this->getFachrichtung_kurzbz(), + 'modellstelle_kurzbz' => $this->getModellstelle_kurzbz(), + 'kommentar_person' => $this->getKommentar_person(), + 'kommentar_modellstelle' => $this->getKommentar_modellstelle(), + ); + + $tmp = array_filter($tmp, function($k) { + return in_array($k, $this->modifiedcolumns); + }, ARRAY_FILTER_USE_KEY); + + return (object) $tmp; + } + + public function __toString() + { + $txt = <<getModellstelle_kurzbz()} + +EOTXT; + return parent::__toString() . $txt; + } + + /* public function validate() + { + if( !(filter_var($this->tage, FILTER_VALIDATE_INT, + array( + 'options' => array( + 'min_range' => 1, + 'max_range' => 50 + ) + ) + )) ) { + $this->validationerrors[] = 'Urlaubsanspruch muss eine Tagesanzahl im Bereich 1 bis 50 sein.'; + } + + return parent::validate(); + } */ +} diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index ccac33bc7..5422c290e 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -402,14 +402,17 @@ class Lehrveranstaltung_model extends DB_Model SELECT vorname, nachname, mitarbeiter_uid, lehrfunktion_kurzbz FROM - lehre.tbl_lehreinheit + lehre.tbl_lehreinheit le JOIN lehre.tbl_lehreinheitmitarbeiter lema USING (lehreinheit_id) JOIN public.tbl_benutzer b ON b.uid = lema.mitarbeiter_uid JOIN public.tbl_person p using (person_id) WHERE - tbl_lehreinheit.lehrveranstaltung_id= ? - AND tbl_lehreinheit.studiensemester_kurzbz = ? + le.lehrveranstaltung_id= ? + AND le.studiensemester_kurzbz = ? AND lehrfunktion_kurzbz = 'LV-Leitung' + AND lema.mitarbeiter_uid NOT like '_Dummy%' + AND b.aktiv = TRUE + AND p.aktiv = TRUE ORDER BY lema.insertamum DESC LIMIT 1 diff --git a/application/models/organisation/Studiengang_model.php b/application/models/organisation/Studiengang_model.php index 131e1deb5..1db658596 100644 --- a/application/models/organisation/Studiengang_model.php +++ b/application/models/organisation/Studiengang_model.php @@ -594,7 +594,10 @@ class Studiengang_model extends DB_Model $this->addSelect('p.prestudent_id'); $this->addSelect('pers.vorname'); $this->addSelect('pers.nachname'); - $this->addSelect("CONCAT(UPPER(pers.nachname), ' ', pers.vorname, ' (', " . $this->dbTable . ".bezeichnung, ')') AS name"); + $this->addSelect("CONCAT(UPPER(pers.nachname), ' ', pers.vorname, ' (', " + . $this->dbTable . ".bezeichnung, ', ', " + . "UPPER(" . $this->dbTable . ".typ), " + . "UPPER(" . $this->dbTable . ".kurzbz),')') AS name"); $this->addJoin('public.tbl_prestudent p', 'studiengang_kz'); $this->addJoin( diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index 8c43e4f84..dff422b7d 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -261,6 +261,42 @@ class Benutzerfunktion_model extends DB_Model } + /** + * Get active Kompetenzfeldleitung bei UID. + * + * @param $uid + * @return array|stdClass|null + */ + public function getKFLByUID($uid) + { + $query = ' + SELECT + bf.uid, + bf.oe_kurzbz, + oe.organisationseinheittyp_kurzbz + FROM + public.tbl_benutzerfunktion bf + JOIN public.tbl_organisationseinheit oe USING (oe_kurzbz) + JOIN public.tbl_benutzer b USING (uid) + WHERE + b.uid = ? + AND b.aktiv = TRUE + AND funktion_kurzbz = \'Leitung\' + AND organisationseinheittyp_kurzbz = \'Kompetenzfeld\' + AND (datum_von IS NULL OR datum_von <= now()) + AND (datum_bis IS NULL OR datum_bis >= now()) + '; + + $parameters_array = array(); + if (is_string($uid)) + { + $parameters_array[] = $uid; + } + + return $this->execQuery($query, $parameters_array); + } + + public function insertBenutzerfunktion($Json) { unset($Json['benutzerfunktion_id']); diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 3e59d7250..ba51e514e 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -242,6 +242,7 @@ class Message_model extends DB_Model */ public function getMessagesForTable($person_id, $offset, $limit) { + $limitoffset = (!is_null($offset) && !is_null($limit)) ? 'limit ? offset ?' : ''; $sql = <<execQuery($sql, $parametersArray); @@ -325,7 +327,7 @@ EOSQL; $data = getData($data); if($data) { - $count = ceil($data[0]->total_msgs / $limit); + $count = is_null($limit) ? 1 : ceil($data[0]->total_msgs / $limit); } return success(['data' => $data, 'count' => $count]); diff --git a/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php b/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php new file mode 100644 index 000000000..6f3f8e47a --- /dev/null +++ b/application/models/vertragsbestandteil/VertragsbestandteilLohnguide_model.php @@ -0,0 +1,11 @@ +dbTable = 'hr.tbl_vertragsbestandteil_lohnguide'; + $this->pk = 'vertragsbestandteil_id'; + } +} diff --git a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php index ce741268d..334a29dfd 100644 --- a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php @@ -37,7 +37,8 @@ class Vertragsbestandteil_model extends DB_Model kf.arbeitgeber_frist, kf.arbeitnehmer_frist, s.wochenstunden, s.teilzeittyp_kurzbz, u.tage, - z.zeitaufzeichnung, z.azgrelevant, z.homeoffice + z.zeitaufzeichnung, z.azgrelevant, z.homeoffice, + lg.stellenbezeichnung, lg.vordienstzeit, lg.fachrichtung_kurzbz, lg.modellstelle_kurzbz, lg.kommentar_person, lg.kommentar_modellstelle FROM hr.tbl_vertragsbestandteil v LEFT JOIN @@ -63,6 +64,8 @@ class Vertragsbestandteil_model extends DB_Model hr.tbl_vertragsbestandteil_urlaubsanspruch u USING(vertragsbestandteil_id) LEFT JOIN hr.tbl_vertragsbestandteil_zeitaufzeichnung z USING(vertragsbestandteil_id) + LEFT JOIN + hr.tbl_vertragsbestandteil_lohnguide lg USING(vertragsbestandteil_id) EOSQL; return $sql; } diff --git a/content/student/studentdetailoverlay.xul.php b/content/student/studentdetailoverlay.xul.php index c3bf8c191..63e26d011 100644 --- a/content/student/studentdetailoverlay.xul.php +++ b/content/student/studentdetailoverlay.xul.php @@ -802,6 +802,10 @@ echo ''; class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/prestudentrolle/rdf#fgm" /> +