diff --git a/application/config/lvverwaltung.php b/application/config/lvverwaltung.php new file mode 100644 index 000000000..4fe09bff3 --- /dev/null +++ b/application/config/lvverwaltung.php @@ -0,0 +1,11 @@ + ['readonly' => false], + 'tag_1' => ['readonly' => true] +]; +*/ + +$config['lvverwaltung_tags'] = []; \ No newline at end of file diff --git a/application/config/navigation.php b/application/config/navigation.php index 5cbb6512c..11fd1a3a6 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -64,7 +64,7 @@ $config['navigation_header'] = array( 'lehrveranstaltungen' => array( 'link' => site_url('lehre/lvplanung/LvTemplateUebersicht'), 'icon' => '', - 'description' => 'Lehrveranstaltungen', + 'description' => 'Lehrveranstaltungen Templates', 'sort' => 15 ), 'reihungstest' => array( @@ -81,6 +81,16 @@ $config['navigation_header'] = array( 'sort' => 30, 'requiredPermissions' => 'infocenter:r' ), + 'lvverwaltung' => array( + 'link' => site_url('LVVerwaltung'), + 'icon' => '', + 'description' => 'LV Verwaltung', + 'requiredPermissions' => array( + 'admin:r', + 'assistenz:r' + ), + 'sort' => 35 + ), 'lehrauftrag' => array( 'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'), 'description' => 'Lehrauftrag', diff --git a/application/controllers/api/frontend/v1/lv/Gruppe.php b/application/controllers/api/frontend/v1/lv/Gruppe.php index 4a1e68656..83a4fb696 100644 --- a/application/controllers/api/frontend/v1/lv/Gruppe.php +++ b/application/controllers/api/frontend/v1/lv/Gruppe.php @@ -116,7 +116,7 @@ class Gruppe extends FHCAPI_Controller bezeichnung, gid, \'false\' as lehrverband'); - $gruppen_result = $this->_ci->GruppeModel->loadWhere(array('sichtbar' => true, 'aktiv' => true, 'lehre' => true, 'direktinskription' => false)); + $gruppen_result = $this->_ci->GruppeModel->loadWhere(array('sichtbar' => true, 'aktiv' => true, 'lehre' => true, 'direktinskription' => false, 'semester IS NOT NULL' => null)); $gruppen_array = array(); diff --git a/application/controllers/api/frontend/v1/lv/Lehreinheit.php b/application/controllers/api/frontend/v1/lv/Lehreinheit.php index b851f8c22..958007901 100644 --- a/application/controllers/api/frontend/v1/lv/Lehreinheit.php +++ b/application/controllers/api/frontend/v1/lv/Lehreinheit.php @@ -350,7 +350,7 @@ class Lehreinheit extends FHCAPI_Controller $this->form_validation->set_rules($field, 'Start KW', 'integer|greater_than[0]|less_than_equal_to[53]'); break; case 'gewicht': - $this->form_validation->set_rules($field, 'Gewicht', 'numeric'); + $this->form_validation->set_rules($field, 'Gewicht', 'numeric|greater_than_equal_to[0]'); break; case 'raumtyp': $this->form_validation->set_rules($field, 'Raumtyp', 'required|max_length[16]'); @@ -365,7 +365,7 @@ class Lehreinheit extends FHCAPI_Controller $this->form_validation->set_rules($field, 'LVNR', 'integer'); break; case 'unr': - $this->form_validation->set_rules($field, 'UNR', 'integer'); + $this->form_validation->set_rules($field, 'UNR', 'integer|greater_than_equal_to[0]'); break; case 'lehre': $this->form_validation->set_rules($field, 'Lehre', 'trim'); diff --git a/application/controllers/api/frontend/v1/lv/Lektor.php b/application/controllers/api/frontend/v1/lv/Lektor.php index 4a244c1a1..68bec1bc4 100644 --- a/application/controllers/api/frontend/v1/lv/Lektor.php +++ b/application/controllers/api/frontend/v1/lv/Lektor.php @@ -107,7 +107,8 @@ class Lektor extends FHCAPI_Controller $this->form_validation->set_rules($field, 'Planstunden', 'integer|greater_than_equal_to[0]'); break; case 'stundensatz': - $this->form_validation->set_rules($field, 'Stundensatz', 'numeric|greater_than_equal_to[0]'); + $formData['stundensatz'] = str_replace(',', '.', $formData['stundensatz']); + $this->form_validation->set_rules($field, 'Stundensatz', 'callback__check_stundensatz'); break; case 'faktor': $this->form_validation->set_rules($field, 'Faktor', 'numeric|greater_than_equal_to[0]'); @@ -119,6 +120,7 @@ class Lektor extends FHCAPI_Controller $this->form_validation->set_rules($field, 'Bis Melden', 'trim'); break; case 'semesterstunden': + $formData['semesterstunden'] = str_replace(',', '.', $formData['semesterstunden']); $this->form_validation->set_rules($field, 'Semesterstunden', 'callback__check_semesterstunden'); break; case 'mitarbeiter_uid': @@ -129,7 +131,7 @@ class Lektor extends FHCAPI_Controller } if (!$this->form_validation->run()) { - $this->terminateWithError($this->form_validation->error_array()); + $this->terminateWithValidationErrors($this->form_validation->error_array()); } if (isset($formData['semesterstunden']) && (!is_numeric($formData['semesterstunden']) || $formData['semesterstunden'] === '')) @@ -145,9 +147,26 @@ class Lektor extends FHCAPI_Controller $result = $this->_ci->lektorlib->updateLektorFromLehreinheit($lehreinheit_id, $mitarbeiter_uid, $formData); if (isError($result)) $this->terminateWithError(getError($result)); - $this->terminateWithSuccess("Erfolgreich geupdated"); + $this->terminateWithSuccess($result); } + public function _check_stundensatz($value) + { + $value = str_replace(',', '.', $value); + + if (!is_numeric($value)) + { + $this->form_validation->set_message('_check_decimal', 'Das Feld {field} muss eine Zahl sein.'); + return false; + } + + if ($value < 0 || $value >= 10000) { + $this->form_validation->set_message('_check_decimal', 'Das Feld {field} muss zwischen 0 und 10000 liegen.'); + return false; + } + + return true; + } public function _check_semesterstunden($value) { if ($value === null || $value === '') { @@ -171,6 +190,14 @@ class Lektor extends FHCAPI_Controller ); return false; } + if ($value > 999.99) + { + $this->form_validation->set_message( + '_check_semesterstunden', + 'Das Feld {field} darf maximal 999,99 betragen.' + ); + return false; + } return true; } diff --git a/application/controllers/api/frontend/v1/lv/Setup.php b/application/controllers/api/frontend/v1/lv/Setup.php index cf73697a7..a2c167dd6 100644 --- a/application/controllers/api/frontend/v1/lv/Setup.php +++ b/application/controllers/api/frontend/v1/lv/Setup.php @@ -50,6 +50,11 @@ class Setup extends FHCAPI_Controller 'component' => APP_ROOT . 'public/js/components/LVVerwaltung/Tabs/Details.js', 'config' => [] ); + $tabs['gruppen'] = array ( + 'title' => 'Gruppen', + 'component' => APP_ROOT . 'public/js/components/LVVerwaltung/Tabs/Gruppen.js', + 'config' => [] + ); $tabs['lektor'] = array ( 'title' => 'LektorInnenzuteilung', 'component' => APP_ROOT . 'public/js/components/LVVerwaltung/Tabs/Lektor.js', diff --git a/application/controllers/api/frontend/v1/lv/Tags.php b/application/controllers/api/frontend/v1/lv/Tags.php index 234ab3cba..a22a4c82e 100644 --- a/application/controllers/api/frontend/v1/lv/Tags.php +++ b/application/controllers/api/frontend/v1/lv/Tags.php @@ -20,5 +20,31 @@ class Tags extends Tag_Controller 'doneLehre' => self::BERECHTIGUNG_KURZBZ, 'deleteLehre' => self::BERECHTIGUNG_KURZBZ, ]); + + $this->config->load('lvverwaltung'); + } + public function getTag($readonly_tags = null) + { + parent::getTag($this->config->item('lvverwaltung_tags')); + } + public function getTags($tags = null) + { + parent::getTags($this->config->item('lvverwaltung_tags')); + } + public function addTag($withZuordnung = true, $updatable_tags = null) + { + parent::addTag(true, $this->config->item('lvverwaltung_tags')); + } + public function updateTag($updatable_tags = null) + { + parent::updateTag($this->config->item('lvverwaltung_tags')); + } + public function deleteTag($withZuordnung = true, $updatable_tags = null) + { + parent::deleteTag(true, $this->config->item('lvverwaltung_tags')); + } + public function doneTag($updatable_tags = null) + { + parent::doneTag($this->config->item('lvverwaltung_tags')); } } \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/stv/Kontakt.php b/application/controllers/api/frontend/v1/stv/Kontakt.php index 9b713b5f9..3a8268775 100644 --- a/application/controllers/api/frontend/v1/stv/Kontakt.php +++ b/application/controllers/api/frontend/v1/stv/Kontakt.php @@ -434,7 +434,10 @@ class Kontakt extends FHCAPI_Controller $this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT'); $this->KontakttypModel->addJoin('public.tbl_kontakttyp kt', 'ON (public.tbl_kontakt.kontakttyp = kt.kontakttyp)'); $result = $this->KontaktModel->loadWhere( - array('person_id' => $person_id) + array( + 'person_id' => $person_id, + 'public.tbl_kontakt.kontakttyp !=' => 'hidden' + ) ); if (isError($result)) @@ -442,20 +445,18 @@ class Kontakt extends FHCAPI_Controller $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); } $this->terminateWithSuccess((getData($result) ?: [])); + } public function getKontakttypen() { $this->load->model('person/Kontakttyp_model', 'KontakttypModel'); + $this->KontakttypModel->addOrder('beschreibung', 'ASC'); + $result = $this->KontakttypModel->loadWhere(array('kontakttyp !=' => 'hidden')); - $result = $this->KontakttypModel->load(); - if (isError($result)) { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - else - { - $this->terminateWithSuccess(getData($result) ?: []); - } + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); } public function loadContact() diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 5cff2b173..1ae1b1403 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -277,7 +277,17 @@ class Student extends FHCAPI_Controller $update_person = array(); foreach ($array_allowed_props_person as $prop) { $val = $this->input->post($prop); - if ($val !== null) { + if ($val === null) + { + continue; + } + if($prop == 'foto') + { + $fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val); + $update_person[$prop] = $fotoval; + } + else + { $update_person[$prop] = $val; } } diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 1fc49c72f..1a4f566e6 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -362,6 +362,8 @@ class InfoCenter extends Auth_Controller $data[self::ORIGIN_PAGE] = $origin_page; $data[self::PREV_FILTER_ID] = $this->input->get(self::PREV_FILTER_ID); + $data['studiensemester'] = $this->variablelib->getVar('infocenter_studiensemester'); + $this->load->view('system/infocenter/infocenterDetails.php', $data); } diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index c2bb03267..cfc54d5f5 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -393,10 +393,10 @@ abstract class Notiz_Controller extends FHCAPI_Controller foreach ($result as $doc) { $res = $this->dmslib->removeAll($doc->dms_id); - if (isError($result)) + if (isError($res)) { $this->db->trans_rollback(); - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + $this->terminateWithError(getError($res), self::ERROR_TYPE_GENERAL); } } diff --git a/application/core/Tag_Controller.php b/application/core/Tag_Controller.php index 10e54780e..5b9bac6c5 100644 --- a/application/core/Tag_Controller.php +++ b/application/core/Tag_Controller.php @@ -29,13 +29,36 @@ class Tag_Controller extends FHCAPI_Controller $this->load->model('person/Notiz_model', 'NotizModel'); $this->load->model('system/Notiztyp_model', 'NotiztypModel'); $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + $this->loadPhrases([ + 'ui' + ]); } - public function getTag() + public function getTag($readonly_tags = null) { $language = $this->_getLanguageIndex(); $id = $this->input->get('id'); + if (is_array($readonly_tags) && !isEmptyArray($readonly_tags)) + { + $readonly_tags = $this->_filterTag($readonly_tags, true); + + foreach ($readonly_tags as $key => $tag) + { + $readonly_tags[$key] = $this->NotizModel->db->escape($tag); + } + $tags = '(' . implode(',', $readonly_tags) . ')'; + + $this->NotizModel->addSelect(" + CASE + WHEN tbl_notiz_typ.typ_kurzbz IN $tags + THEN TRUE + ELSE FALSE + END as readonly + "); + } + $this->NotizModel->addSelect( "tbl_notiz.titel, tbl_notiz.text, @@ -54,7 +77,7 @@ class Tag_Controller extends FHCAPI_Controller $this->NotizModel->addJoin('public.tbl_benutzer verfasserbenutzer', 'tbl_notiz.verfasser_uid = verfasserbenutzer.uid', 'LEFT'); $this->NotizModel->addJoin('public.tbl_person verfasserperson', 'verfasserbenutzer.person_id = verfasserperson.person_id', 'LEFT'); - $this->NotizModel->addJoin('public.tbl_benutzer bearbeiterbenutzer', 'tbl_notiz.verfasser_uid = bearbeiterbenutzer.uid', 'LEFT'); + $this->NotizModel->addJoin('public.tbl_benutzer bearbeiterbenutzer', 'tbl_notiz.bearbeiter_uid = bearbeiterbenutzer.uid', 'LEFT'); $this->NotizModel->addJoin('public.tbl_person bearbeiterperson', 'bearbeiterbenutzer.person_id = bearbeiterperson.person_id', 'LEFT'); $notiz = $this->NotizModel->loadWhere(array('notiz_id' => $id)); @@ -62,7 +85,7 @@ class Tag_Controller extends FHCAPI_Controller $this->terminateWithSuccess(hasData($notiz) ? getData($notiz)[0] : array()); } - public function getTags() + public function getTags($tags = null) { $this->NotiztypModel->addSelect( 'typ_kurzbz as tag_typ_kurzbz, @@ -73,19 +96,36 @@ class Tag_Controller extends FHCAPI_Controller ' ); $this->NotiztypModel->addOrder('prioritaet'); + + if (is_array($tags) && !isEmptyArray($tags)) + { + $tags = $this->_filterTag($tags, false); + $this->NotiztypModel->db->where_in('typ_kurzbz', $tags); + } + $notiztypen = $this->NotiztypModel->loadWhere(array('aktiv' => true)); $this->terminateWithSuccess(hasData($notiztypen) ? getData($notiztypen) : array()); } - public function addTag($withZuordnung = true) + public function addTag($withZuordnung = true, $updatable_tags = null) { $postData = $this->getPostJson(); $checkTyp = $this->NotiztypModel->loadWhere(array('typ_kurzbz' => $postData->tag_typ_kurzbz)); - if (!hasData($checkTyp)) - $this->terminateWithError('Error occurred', self::ERROR_TYPE_GENERAL); + if (isError($checkTyp)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + if (!hasData($checkTyp)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + if (!in_array($postData->tag_typ_kurzbz, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } if ($withZuordnung) { @@ -125,48 +165,88 @@ class Tag_Controller extends FHCAPI_Controller } } - private function addNotiz($postData) - { - return $this->NotizModel->insert(array( - 'titel' => 'TAG', //TODO klären - 'text' => $postData->notiz, - 'verfasser_uid' => $this->_uid, - 'erledigt' => false, - 'insertamum' => date('Y-m-d H:i:s'), - 'insertvon' => $this->_uid, - 'typ' => $postData->tag_typ_kurzbz - )); - - } - public function updateTag() + public function updateTag($updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), array('text' => $postData->notiz, 'updateamum' => date('Y-m-d H:i:s'), 'updatevon' => $this->_uid, 'bearbeiter_uid' => $this->_uid, - ) + ) ); $this->terminateWithSuccess($updateData); } - public function doneTag() + public function doneTag($updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } + $updateData = $this->NotizModel->update(array('notiz_id' => $postData->id), array('erledigt' => !$postData->done, + 'text' => $postData->notiz, 'updateamum' => date('Y-m-d H:i:s'), 'updatevon' => $this->_uid, 'bearbeiter_uid' => $this->_uid, ) ); - $this->terminateWithSuccess($updateData); } - public function deleteTag($withZuordnung = true) + public function deleteTag($withZuordnung = true, $updatable_tags = null) { $postData = $this->getPostJson(); + $post_tag = $this->NotizModel->loadWhere(array('notiz_id' => $postData->id)); + + if (isError($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (!hasData($post_tag)) + $this->terminateWithError($this->p->t('ui', 'fehlerBeimLesen')); + + if (is_array($updatable_tags) && !isEmptyArray($updatable_tags)) + { + $tags = $this->_filterTag($updatable_tags, false); + + $post_tag_typ = getData($post_tag)[0]->typ; + + if (!in_array($post_tag_typ, $tags)) + $this->terminateWithError($this->p->t('ui', 'keineBerechtigung')); + } $deleteNotiz = ""; if ($withZuordnung) @@ -208,5 +288,27 @@ class Tag_Controller extends FHCAPI_Controller return hasData($result) ? getData($result)[0]->index : 1; } + private function _filterTag($tags, $readonly = true) + { + $filtered_tags = array_filter($tags, function ($tag) use ($readonly) + { + return isset($tag['readonly']) && $tag['readonly'] === $readonly; + }); + + return array_keys($filtered_tags); + } + + private function addNotiz($postData) + { + return $this->NotizModel->insert(array( + 'titel' => 'TAG', //TODO klären + 'text' => $postData->notiz, + 'verfasser_uid' => $this->_uid, + 'erledigt' => false, + 'insertamum' => date('Y-m-d H:i:s'), + 'insertvon' => $this->_uid, + 'typ' => $postData->tag_typ_kurzbz + )); + } } \ No newline at end of file diff --git a/application/libraries/LektorLib.php b/application/libraries/LektorLib.php index 44c71cdaa..e06e2b728 100644 --- a/application/libraries/LektorLib.php +++ b/application/libraries/LektorLib.php @@ -176,11 +176,11 @@ class LektorLib if (!$echter_dv && (!$this->_ci->permissionlib->isBerechtigt('admin'))) { if (!$this->LehrauftragAufFirma(isset($formData['mitarbeiter_uid']) ? $formData['mitarbeiter_uid'] : $mitarbeiter_uid)) - return error("ACHTUNG: Die maximal erlaubte Semesterstundenanzahl des Lektors von $summe Stunden ($stundengrenze->stunden) wurde ueberschritten!\n Daten wurden NICHT gespeichert!\n\n"); + return error("ACHTUNG: Die maximal erlaubte Semesterstundenanzahl des Lektors von $summe Stunden ($stundengrenze->stunden) wurde ueberschritten!\nDaten wurden NICHT gespeichert!\n\n"); } else { - $warning .= "ACHTUNG: Die maximal erlaubte Semesterstundenanzahl des Lektors von $summe Stunden ($stundengrenze->stunden) wurde ueberschritten!\n Daten wurden gespeichert!\n\n"; + $warning .= "ACHTUNG: Die maximal erlaubte Semesterstundenanzahl des Lektors von $summe Stunden ($stundengrenze->stunden) wurde ueberschritten!\nDaten wurden gespeichert!\n\n"; } $stunden_limit_result = $this->getStundenInstitut($mitarbeiter_uid, $lehreinheit->studiensemester_kurzbz, $oe_array); @@ -190,7 +190,7 @@ class LektorLib $stunden_limit_array = getData($stunden_limit_result); foreach ($stunden_limit_array as $stunden_limit) { - $warning .= $stunden_limit->summe . ' Stunden' . $stunden_limit->bezeichnung; + $warning .= $stunden_limit->summe . ' Stunden ' . $stunden_limit->bezeichnung . "\n"; } } } @@ -206,7 +206,7 @@ class LektorLib $benutzer_aktiv = getData($benutzer_result)[0]->aktiv; if (!$benutzer_aktiv) - $warning .= "Achtung: Der/Die Benutzer*in ist inaktiv!\nBitte informieren Sie die Personalbteilung.\n\nDaten wurden gespeichert.\n\n"; + $warning .= "Achtung: Der/Die Benutzer*in ist inaktiv!\nBitte informieren Sie die Personalbteilung.\nDaten wurden gespeichert.\n\n"; $updatableFields = array( 'semesterstunden', @@ -236,9 +236,9 @@ class LektorLib if (isError($result)) return $result; - if ($warning !== '') return error($warning); + if ($warning !== '') return success(['warning' => $warning]); - return success('Successfully updated Lehreinheit'); + return success('Erfolgreich geupdated'); } private function getMaxStunden($mitarbeiter_uid, $studiensemester_kurzbz, $studiengang_kz, $echter_dv) @@ -280,7 +280,7 @@ class LektorLib foreach ($stunden_limit_array as $stunden_limit) { - $error .= $stunden_limit->summe . ' Stunden' . $stunden_limit->bezeichnung; + $error .= $stunden_limit->summe . ' Stunden ' . $stunden_limit->bezeichnung . "\n"; } } return error($error); diff --git a/application/libraries/ProfilLib.php b/application/libraries/ProfilLib.php index 2a130d263..6e93a0943 100644 --- a/application/libraries/ProfilLib.php +++ b/application/libraries/ProfilLib.php @@ -214,7 +214,7 @@ class ProfilLib{ * @param integer $uid the userID used to get the kontakt information * @return array all the kontakt information corresponding to a userID */ - private function getKontaktInfo($pid) + private function getKontaktInfo($pid, $includehidden=false) { $this->ci->load->model("person/Kontakt_model","KontaktModel"); $this->ci->KontaktModel->addSelect(['kontakttyp', 'kontakt_id', 'kontakt', 'tbl_kontakt.anmerkung', 'tbl_kontakt.zustellung']); @@ -222,7 +222,13 @@ class ProfilLib{ $this->ci->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT'); $this->ci->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum'); - $kontakte_res = $this->ci->KontaktModel->loadWhere(['person_id' => $pid]); + $params = array('person_id' => $pid); + if(!$includehidden) + { + $params['kontakttyp <>'] = 'hidden'; + } + + $kontakte_res = $this->ci->KontaktModel->loadWhere($params); if(isError($kontakte_res)){ return error(getData($kontakte_res)); } @@ -303,10 +309,22 @@ class ProfilLib{ private function getBenutzerFunktion($uid) { $this->ci->load->model("person/Benutzerfunktion_model","BenutzerfunktionModel"); - $this->ci->BenutzerfunktionModel->addSelect(["tbl_benutzerfunktion.bezeichnung as Bezeichnung", "tbl_organisationseinheit.bezeichnung as Organisationseinheit", "datum_von as Gültig_von", "datum_bis as Gültig_bis", "wochenstunden as Wochenstunden"]); + $this->ci->BenutzerfunktionModel->addSelect([ + "CASE WHEN (tbl_benutzerfunktion.bezeichnung IS NOT NULL AND tbl_benutzerfunktion.bezeichnung <> '' AND tbl_benutzerfunktion.bezeichnung <> tbl_funktion.beschreibung) THEN tbl_funktion.beschreibung || ' - ' || tbl_benutzerfunktion.bezeichnung ELSE tbl_funktion.beschreibung END as \"Bezeichnung\"", + "tbl_organisationseinheit.bezeichnung as Organisationseinheit", + "datum_von as Gültig_von", + "datum_bis as Gültig_bis", + "COALESCE(wochenstunden, '0'::numeric(5,2)) AS \"Wochenstunden\"" + ]); + $this->ci->BenutzerfunktionModel->addJoin("tbl_funktion", "funktion_kurzbz"); $this->ci->BenutzerfunktionModel->addJoin("tbl_organisationseinheit", "oe_kurzbz"); - $benutzer_funktion_res = $this->ci->BenutzerfunktionModel->loadWhere(array('uid' => $uid)); + $benutzer_funktion_res = $this->ci->BenutzerfunktionModel->loadWhere( + array( + 'uid' => $uid, + 'NOW()::date BETWEEN COALESCE(datum_von, \'1970-01-01\'::date) AND COALESCE(datum_bis, \'2170-12-01\'::date)' => null + ) + ); if(isError($benutzer_funktion_res)){ return error(getData($benutzer_funktion_res)); } diff --git a/application/models/education/Lehreinheit_model.php b/application/models/education/Lehreinheit_model.php index 0475ed058..e52af4cba 100644 --- a/application/models/education/Lehreinheit_model.php +++ b/application/models/education/Lehreinheit_model.php @@ -694,10 +694,26 @@ EOSQL; private function _getTagsCTE() { + $this->load->config('lvverwaltung'); + $tags = $this->config->item('tags'); + + $whereTags = ''; + if (is_array($tags) && !isEmptyArray($tags)) + { + $tags = array_keys($tags); + + foreach ($tags as $key => $tag) + { + $tags[$key] = $this->db->escape($tag); + } + + $whereTags = " AND tbl_notiz_typ.typ_kurzbz IN (" . implode(",", $tags) . ")"; + } + return "tag_data_agg AS ( SELECT lehreinheit_id, - COALESCE(json_agg(tag ORDER BY id), '[]'::json) AS tags + COALESCE(json_agg(tag ORDER BY done), '[]'::json) AS tags FROM ( SELECT DISTINCT ON (public.tbl_notiz.notiz_id) tbl_notiz.notiz_id AS id, @@ -710,8 +726,9 @@ EOSQL; FROM public.tbl_notizzuordnung JOIN public.tbl_notiz ON tbl_notizzuordnung.notiz_id = tbl_notiz.notiz_id JOIN public.tbl_notiz_typ ON tbl_notiz.typ = tbl_notiz_typ.typ_kurzbz - WHERE lehreinheit_id IN (SELECT lehreinheit_id FROM lehreinheiten) - ) AS tag + WHERE lehreinheit_id IN (SELECT lehreinheit_id FROM lehreinheiten)" + . $whereTags. + ") AS tag GROUP BY lehreinheit_id )"; } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 997048972..3947378cf 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -307,72 +307,60 @@ class Person_model extends DB_Model public function checkDuplicate($person_id) { - $qry = "SELECT person_id - FROM public.tbl_prestudent p - JOIN - ( - SELECT DISTINCT ON(prestudent_id) * - FROM public.tbl_prestudentstatus - WHERE prestudent_id IN - ( - SELECT prestudent_id - FROM public.tbl_prestudent - WHERE person_id IN - ( - SELECT p2.person_id - FROM public.tbl_person p - JOIN public.tbl_person p2 - ON lower(p.vorname) = lower(p2.vorname) - AND lower(p.nachname) = lower(p2.nachname) - AND p.gebdatum = p2.gebdatum - AND p.person_id = ? - ) - ) - ORDER BY prestudent_id, datum DESC, insertamum DESC - ) ps USING(prestudent_id) - JOIN public.tbl_status USING(status_kurzbz) + $qry = " + WITH person AS ( + SELECT * + FROM public.tbl_person + WHERE person_id = ? + ), + allePersonen AS ( + SELECT p.person_id + FROM public.tbl_person p + JOIN person + ON lower(p.vorname) = lower(person.vorname) + AND lower(p.nachname) = lower(person.nachname) + AND p.gebdatum = person.gebdatum + ), + lastStatus AS ( + SELECT DISTINCT ON (tbl_prestudentstatus.prestudent_id) + tbl_prestudentstatus.prestudent_id, + tbl_prestudentstatus.status_kurzbz, + tbl_prestudent.studiengang_kz, + tbl_prestudent.person_id + FROM public.tbl_prestudentstatus + JOIN public.tbl_prestudent USING (prestudent_id) + WHERE tbl_prestudent.person_id IN (SELECT person_id FROM allePersonen) + ORDER BY tbl_prestudentstatus.prestudent_id, tbl_prestudentstatus.datum DESC, tbl_prestudentstatus.insertamum DESC + ), + interessenten AS ( + SELECT * + FROM lastStatus WHERE status_kurzbz = 'Interessent' - AND studiengang_kz IN - ( - SELECT studiengang_kz - FROM public.tbl_prestudent p - JOIN - ( - SELECT DISTINCT ON(prestudent_id) * - FROM public.tbl_prestudentstatus - WHERE prestudent_id IN - ( - SELECT prestudent_id - FROM public.tbl_prestudent - WHERE person_id IN - ( - SELECT p2.person_id - FROM public.tbl_person p - JOIN public.tbl_person p2 - ON lower(p.vorname) = lower(p2.vorname) - AND lower(p.nachname) = lower(p2.nachname) - AND p.gebdatum = p2.gebdatum - AND p.person_id = ? - ) - ) - ORDER BY prestudent_id, datum DESC, insertamum DESC - ) ps USING(prestudent_id) - JOIN public.tbl_status USING(status_kurzbz) - WHERE status_kurzbz = 'Abbrecher' - ) - - UNION - + ), + keineInteressenten AS ( + SELECT * + FROM lastStatus + WHERE status_kurzbz != 'Interessent' + ), + doppeltePerson AS ( SELECT p2.person_id - FROM tbl_person p1 - JOIN tbl_prestudent ps ON p1.person_id = ps.person_id - INNER JOIN ( - SELECT vorname, nachname, gebdatum, person.person_id - FROM tbl_person person - JOIN tbl_prestudent sps ON person.person_id = sps.person_id - ) p2 - ON (lower(p1.vorname) = lower(p2.vorname) AND lower(p1.nachname) = lower(p2.nachname) AND p1.gebdatum = p2.gebdatum) - WHERE p1.person_id != p2.person_id AND (p1.person_id = ?)"; + FROM public.tbl_person p1 + JOIN public.tbl_prestudent ps1 ON ps1.person_id = p1.person_id + JOIN public.tbl_person p2 + ON lower(p1.vorname) = lower(p2.vorname) + AND lower(p1.nachname) = lower(p2.nachname) + AND p1.gebdatum = p2.gebdatum + WHERE p1.person_id = ? + AND p1.person_id <> p2.person_id + ) + SELECT DISTINCT(interessenten.person_id) + FROM interessenten + JOIN keineInteressenten + ON interessenten.studiengang_kz = keineInteressenten.studiengang_kz + WHERE interessenten.person_id = ? + UNION + SELECT DISTINCT person_id + FROM doppeltePerson"; return $this->execQuery($qry, array($person_id, $person_id, $person_id)); } diff --git a/application/views/system/infocenter/anmerkungenZurBewerbung.php b/application/views/system/infocenter/anmerkungenZurBewerbung.php index ca012ff3e..3ffe5f9a2 100644 --- a/application/views/system/infocenter/anmerkungenZurBewerbung.php +++ b/application/views/system/infocenter/anmerkungenZurBewerbung.php @@ -18,6 +18,9 @@ kurzbzlang)) ?: print_r('(' . nl2br($notiz->kurzbzlang) . ') - ') ?> text) ?> +
{{$p.t('profilUpdate','profilBildUpdateMessage',[titel])}}
diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js index 8d46377d5..3f8e8380d 100644 --- a/public/js/components/Cis/Profil/StudentProfil.js +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -11,6 +11,7 @@ import FetchProfilUpdates from "./ProfilComponents/FetchProfilUpdates.js"; import EditProfil from "./ProfilModal/EditProfil.js"; import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; +import { dateFilter } from '../../../tabulator/filters/Dates.js'; export default { components: { @@ -39,7 +40,7 @@ export default { persistence: { columns: false }, - height: 200, + minHeight: 200, layout: "fitColumns", columns: [{ title: Vue.computed(() => this.preloadedPhrasen.zutrittsGruppenPhrase), @@ -51,7 +52,7 @@ export default { persistence: { columns: false }, - height: 300, + minHeight: 300, layout: "fitColumns", responsiveLayout: "collapse", responsiveLayoutCollapseUseFormatters: false, @@ -85,9 +86,12 @@ export default { { title: Vue.computed(() =>this.preloadedPhrasen.ausgabedatum) , field: "Ausgegeben_am", - headerFilter: true, + headerFilterFunc: 'dates', + headerFilter: dateFilter, minWidth: 200, - visible: true + visible: true, + formatter:"datetime", + formatterParams: this.datetimeFormatterParams() }, ], }, @@ -160,6 +164,15 @@ export default { this.$refs.editModal.show(); }); }, + datetimeFormatterParams: function() { + const params = { + inputFormat:"yyyy-MM-dd", + outputFormat:"dd.MM.yyyy", + invalidPlaceholder:"(invalid date)", + timezone:FHC_JS_DATA_STORAGE_OBJECT.timezone + }; + return params; + } }, computed: { diff --git a/public/js/components/DetailHeader/DetailHeader.js b/public/js/components/DetailHeader/DetailHeader.js index 5c1573753..1088e3f63 100644 --- a/public/js/components/DetailHeader/DetailHeader.js +++ b/public/js/components/DetailHeader/DetailHeader.js @@ -102,6 +102,13 @@ export default { redirectToLeitung(){ this.$emit('redirectToLeitung', { person_id: this.leitungData.person_id}); + }, + getFotoSrc(foto) { + if(foto === null) { + return FHC_JS_DATA_STORAGE_OBJECT.app_root + 'skin/images/profilbild_dummy.jpg'; + } else { + return 'data:image/jpeg;base64,' + foto; + } } }, template: ` @@ -116,7 +123,7 @@ export default {