diff --git a/application/controllers/Cis/Documents.php b/application/controllers/Cis/Documents.php index c5a6684d3..0b8d08a56 100644 --- a/application/controllers/Cis/Documents.php +++ b/application/controllers/Cis/Documents.php @@ -72,7 +72,7 @@ class Documents extends Auth_Controller $stgs = []; $stsemArray = []; - $buchungstypen = implode('\',\'', defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN") ? unserialize(CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN) : []); + $buchungstypen = defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN") ? unserialize(CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN) : []; $person_ids = []; foreach ($stati as $status) { $person_ids[] = $status->person_id; diff --git a/application/controllers/Cis/ProfilUpdate.php b/application/controllers/Cis/ProfilUpdate.php index 74641d748..698b091d1 100644 --- a/application/controllers/Cis/ProfilUpdate.php +++ b/application/controllers/Cis/ProfilUpdate.php @@ -13,7 +13,7 @@ class ProfilUpdate extends Auth_Controller { parent::__construct([ 'index' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'], - 'show' => ['basis/cis:r'], + 'show' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r', 'basis/cis:r'], 'id' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'] ]); diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index bbfed651c..f97546288 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -637,7 +637,7 @@ class ProfilUpdate extends FHCAPI_Controller //? Send email to the Studiengangsassistentinnen $this->StudentModel->addSelect(["public.tbl_studiengang.email"]); $this->StudentModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_student.student_uid"); - $this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id"); + $this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id and public.tbl_student.studiengang_kz = public.tbl_prestudent.studiengang_kz"); $this->StudentModel->addJoin("public.tbl_prestudentstatus", "public.tbl_prestudentstatus.prestudent_id = public.tbl_prestudent.prestudent_id"); $this->StudentModel->addJoin("public.tbl_studiengang", "public.tbl_studiengang.studiengang_kz = public.tbl_prestudent.studiengang_kz"); $this->StudentModel->addGroupBy(["public.tbl_studiengang.email"]); @@ -706,7 +706,13 @@ class ProfilUpdate extends FHCAPI_Controller private function setStatusOnUpdateRequest($id, $status, $status_message) { - return $this->ProfilUpdateModel->update([$id], ["status" => $status, "status_timestamp" => "NOW()", "status_message" => $status_message]); + return $this->ProfilUpdateModel->update([$id], [ + "status" => $status, + "status_timestamp" => "NOW()", + "status_message" => $status_message, + "updateamum" => "NOW()", + "updatevon" => getAuthUID() + ]); } private function updateRequestedChange($id, $requested_change) @@ -716,13 +722,12 @@ class ProfilUpdate extends FHCAPI_Controller private function deleteOldVersionFile($dms_id) { + if (!isset($dms_id)) { + return true; + } + // starting the transaction $this->db->trans_start(); - - - if (!isset($dms_id)) { - return; - } //? delete the file from the profilUpdate first $profilUpdateFileDelete = $this->ProfilUpdateModel->removeFileFromProfilUpdate($dms_id); @@ -777,13 +782,8 @@ class ProfilUpdate extends FHCAPI_Controller $res = $this->StudentModel->execReadOnlyQuery($query, [$student_uid]); $res = $this->getDataOrTerminateWithError($res, $this->p->t('profilUpdate', 'profilUpdate_loadingOE_error')); - $res = array_map( - function ($item) { - return $item->oe_kurzbz; - }, - $res - ); - return $res; + $oe = ($res[0])->oe_kurzbz; + return $oe; } private function handleAdresse($requested_change, $personID) @@ -813,7 +813,7 @@ class ProfilUpdate extends FHCAPI_Controller $insert_adresse_id = $insertID; $insert_adresse_id = $this->getDataOrTerminateWithError($insert_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error')); if ($insert_adresse_id) { - $this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $insert_adresse_id); + $this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $insert_adresse_id, $personID); } } //! DELETE @@ -825,12 +825,33 @@ class ProfilUpdate extends FHCAPI_Controller } //! UPDATE else { - $requested_change['updateamum'] = "NOW()"; - $requested_change['updatevon'] = getAuthUID(); - $update_adresse_id = $this->AdresseModel->update($adresse_id, $requested_change); - $update_adresse_id = $this->getDataOrTerminateWithError($update_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_updateAdresse_error')); - $this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $update_adresse_id); + $curadresse_res = $this->AdresseModel->load($adresse_id); + $curadresse = ($this->getDataOrTerminateWithError($curadresse_res))[0]; + if($curadresse->heimatadresse) + { + $tmpadresse = array_merge((array) $curadresse, $requested_change); + unset($tmpadresse["adresse_id"]); + $tmpadresse['insertamum'] = "NOW()"; + $tmpadresse['insertvon'] = getAuthUID(); + $tmpadresse['person_id'] = $personID; + unset($tmpadresse["heimatadresse"]); + unset($tmpadresse["updateamum"]); + unset($tmpadresse["updatevon"]); + + $tmpadresse_res = $this->AdresseModel->insert($tmpadresse); + $tmpadresse_id = $this->getDataOrTerminateWithError($tmpadresse_res, $this->p->t('profilUpdate', 'profilUpdate_insertAdresse_error')); + $this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $tmpadresse_id, $personID); + } + else + { + $requested_change['updateamum'] = "NOW()"; + $requested_change['updatevon'] = getAuthUID(); + + $update_adresse_id = $this->AdresseModel->update($adresse_id, $requested_change); + $update_adresse_id = $this->getDataOrTerminateWithError($update_adresse_id, $this->p->t('profilUpdate', 'profilUpdate_updateAdresse_error')); + $this->handleDupplicateZustellAdressen($requested_change['zustelladresse'], $update_adresse_id, $personID); + } } return $insertID ?? null; } @@ -852,7 +873,7 @@ class ProfilUpdate extends FHCAPI_Controller $insert_kontakt_id = $insertID; $insert_kontakt_id = $this->getDataOrTerminateWithError($insert_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_insertKontakt_error')); if ($insert_kontakt_id) { - $this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id); + $this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id, $requested_change['kontakttyp'], $personID); } } //! DELETE @@ -869,18 +890,18 @@ class ProfilUpdate extends FHCAPI_Controller $update_kontakt_id = $this->KontaktModel->update($kontakt_id, $requested_change); $update_kontakt_id = $this->getDataOrTerminateWithError($update_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_updateKontakt_error')); if ($update_kontakt_id) { - $this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id); + $this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id, $requested_change['kontakttyp'], $personID); } } return isset($insertID) ? $insertID : null; } - private function handleDupplicateZustellAdressen($zustellung, $adresse_id) + private function handleDupplicateZustellAdressen($zustellung, $adresse_id, $person_id) { if ($zustellung) { $this->PersonModel->addSelect("public.tbl_adresse.adresse_id"); $this->PersonModel->addJoin("public.tbl_adresse", "public.tbl_adresse.person_id = public.tbl_person.person_id"); - $zustellAdressenArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustelladresse" => TRUE]); + $zustellAdressenArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $person_id, "zustelladresse" => TRUE]); if (isError($zustellAdressenArray)) { $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loadingZustellAdressen_error')); } @@ -893,6 +914,8 @@ class ProfilUpdate extends FHCAPI_Controller return $adresse->adresse_id != $adresse_id; }); + $this->addMeta('bhzustelladressen', $zustellAdressenArray); + // remove the zustelladresse from all other zustelladressen foreach ($zustellAdressenArray as $adresse) { $this->AdresseModel->update($adresse->adresse_id, ["zustelladresse" => FALSE]); @@ -902,12 +925,16 @@ class ProfilUpdate extends FHCAPI_Controller } } - private function handleDupplicateZustellKontakte($zustellung, $kontakt_id) + private function handleDupplicateZustellKontakte($zustellung, $kontakt_id, $kontakttyp, $person_id) { if ($zustellung) { $this->PersonModel->addSelect("public.tbl_kontakt.kontakt_id"); $this->PersonModel->addJoin("public.tbl_kontakt", "public.tbl_kontakt.person_id = public.tbl_person.person_id"); - $zustellKontakteArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $this->pid, "zustellung" => TRUE]); + $zustellKontakteArray = $this->PersonModel->loadWhere([ + "public.tbl_person.person_id" => $person_id, + "zustellung" => TRUE, + "kontakttyp" => $kontakttyp + ]); if (!isSuccess($zustellKontakteArray)) { return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellkontakte_error')); } diff --git a/application/controllers/api/frontend/v1/stv/Favorites.php b/application/controllers/api/frontend/v1/stv/Favorites.php index ca8b62da6..951eb01a4 100644 --- a/application/controllers/api/frontend/v1/stv/Favorites.php +++ b/application/controllers/api/frontend/v1/stv/Favorites.php @@ -60,17 +60,6 @@ class Favorites extends FHCAPI_Controller $favorites = $this->input->post('favorites'); - $removed = []; - while (strlen($favorites) > 64) { - $favObj = json_decode($favorites); - if (!$favObj->list) - break; - $removed[] = array_shift($favObj->list); - $favorites = json_encode($favObj); - } - if ($removed) - $this->addMeta('removed', $removed); - $result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites); $this->getDataOrTerminateWithError($result); 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/Konto.php b/application/controllers/api/frontend/v1/stv/Konto.php index a33680ea0..384452f3e 100644 --- a/application/controllers/api/frontend/v1/stv/Konto.php +++ b/application/controllers/api/frontend/v1/stv/Konto.php @@ -352,7 +352,7 @@ class Konto extends FHCAPI_Controller continue; } - + $result = $this->KontoModel->insert([ 'person_id' => $buchung['person_id'], 'studiengang_kz' => $buchung['studiengang_kz'], @@ -361,7 +361,7 @@ class Konto extends FHCAPI_Controller 'buchungstyp_kurzbz' => $buchung['buchungstyp_kurzbz'], 'credit_points' => $buchung['credit_points'], 'zahlungsreferenz' => $buchung['zahlungsreferenz'], - 'betrag' => $betrag, + 'betrag' => number_format($betrag, 2, '.', ''), 'buchungsdatum' => $buchungsdatum, 'mahnspanne' => '0', 'buchungsnr_verweis' => $buchung['buchungsnr'], diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index 4d0aa5fe1..7dc607d1a 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -138,13 +138,24 @@ class Prestudent extends FHCAPI_Controller { $val = $this->input->post($prop, true); - if ($val !== null || $prop === 'foerderrelevant') { + if ($val !== null) { + if(in_array($prop, ['dual', 'bismelden', 'foerderrelevant'])) + { + $val = boolval($val); + } + elseif ( + $val === '' + && in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode']) + ) + { + $val = null; + } $update_prestudent[$prop] = $val; } // allowed to be null, but has to be in postparameter if ( - in_array($prop, ['zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) + in_array($prop, ['foerderrelevant', 'zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) && !isset($update_prestudent[$prop]) && array_key_exists($prop, $_POST) ) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 665fb620f..dc48a47ff 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -286,11 +286,11 @@ class Status extends FHCAPI_Controller ]); $this->form_validation->set_rules('_default', '', [ - ['meldestichtag_not_exceeded', function () use ($datum, $isBerechtigtNoStudstatusCheck) { + ['meldestichtag_not_exceeded', function () use ($datum_string, $isBerechtigtNoStudstatusCheck) { if ($isBerechtigtNoStudstatusCheck) return true; // Skip if access right says so - $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum); + $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum_string); return !$this->getDataOrTerminateWithError($result); }], @@ -733,8 +733,9 @@ class Status extends FHCAPI_Controller ); $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + $isMeldestichtagErreicht = $this->getDataOrTerminateWithError($result); - if (!$this->getDataOrTerminateWithError($result)) + if ($isMeldestichtagErreicht) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 0cfd82c36..f2845572f 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -276,7 +276,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/jobs/MeldezettelJob.php b/application/controllers/jobs/MeldezettelJob.php new file mode 100644 index 000000000..329597985 --- /dev/null +++ b/application/controllers/jobs/MeldezettelJob.php @@ -0,0 +1,86 @@ +_ci =& get_instance(); + + $this->_ci->load->model('crm/Dokumentprestudent_model', 'DokumentprestudentModel'); + } + + /** + * Sets Meldezettel to "accepted" for all students with Meldeadresse. + */ + public function acceptMeldezettel() + { + $this->logInfo('Start Meldezettel Job'); + + $params = array(self::DOKUMENT_KURZBZ); + + $qry = " + -- get all prestudents with meldeadresse, but no accepted Meldezettel + SELECT + DISTINCT prestudent_id + FROM + public.tbl_adresse + JOIN public.tbl_person USING (person_id) + JOIN public.tbl_prestudent ps USING (person_id) + WHERE + typ = 'm' + AND NOT EXISTS ( + SELECT + 1 + FROM + public.tbl_dokumentprestudent + WHERE + prestudent_id = ps.prestudent_id + AND dokument_kurzbz = ? + )"; + + // get all prestudents with Meldeadresse and no accpeted Meldezettel + $result = $this->_ci->DokumentprestudentModel->execReadOnlyQuery($qry, $params); + + if (isError($result)) + { + $this->logError(getError($result)); + } + + $count = 0; + + if (hasData($result)) + { + $prestudents = getData($result); + + foreach ($prestudents as $prestudent) + { + // set Meldezettel to accepted + $result = $this->_ci->DokumentprestudentModel->insert( + array( + 'prestudent_id' => $prestudent->prestudent_id, + 'dokument_kurzbz' => self::DOKUMENT_KURZBZ, + 'datum' => date('Y-m-d'), + 'insertamum' => strftime('%Y-%m-%d %H:%M'), + 'insertvon' => self::INSERT_VON + ) + ); + + if (isError($result)) + $this->logError(getError($result)); + else + $count++; + } + } + + $this->logInfo('End Meldezettel Job', array('Number of changes ' => $count)); + } +} diff --git a/application/libraries/FilterCmptLib.php b/application/libraries/FilterCmptLib.php index 272899de6..b1de89245 100644 --- a/application/libraries/FilterCmptLib.php +++ b/application/libraries/FilterCmptLib.php @@ -1,7 +1,7 @@ getSession(); // If session is NOT empty -> a filter was already loaded - if ($session != null) + if (!isError($session) && $session != null) { // Retrieve the filterId stored in the session $sessionFilterId = $this->_getSessionElement(FilterCmptLib::FILTER_ID); @@ -219,9 +219,7 @@ class FilterCmptLib } } } - - // If the session is empty -> first time that this filter is loaded - if ($session == null) + else { // Load filter definition data from DB $definition = $this->_loadDefinition( @@ -602,7 +600,7 @@ class FilterCmptLib { $session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId); - if (isset($session[$name])) + if (!isError($session) && isset($session[$name])) { return $session[$name]; } @@ -623,7 +621,7 @@ class FilterCmptLib if (!$this->_ci->permissionlib->hasAtLeastOne($this->_requiredPermissions, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE)) { - $this->_setSession(error('The required permission is not help by the logged user')); + $this->_setSession(error('The required permission is not held by the logged user')); return false; } @@ -904,7 +902,7 @@ class FilterCmptLib $filterCmptsSession = getSession(self::SESSION_NAME); // If something is present in session - if ($filterCmptsSession != null) + if (!isError($filterCmptsSession) && $filterCmptsSession != null) { // Loops in the session for all the filter components foreach ($filterCmptsSession as $filterCmpt => $filterCmptData) @@ -951,9 +949,11 @@ class FilterCmptLib { $session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId); - $session[$name] = $value; - - setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value + if (!isError($session) && $session != null) + { + $session[$name] = $value; + setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value + } } /** @@ -965,7 +965,7 @@ class FilterCmptLib $filterCmptsSession = getSession(self::SESSION_NAME); // If something is present in session - if ($filterCmptsSession != null) + if (!isError($filterCmptsSession) && $filterCmptsSession != null) { // Loops in the session for all the filter components foreach ($filterCmptsSession as $filterCmpt => $filterCmptData) @@ -1174,3 +1174,4 @@ class FilterCmptLib return $filterName; } } + diff --git a/application/libraries/ProfilLib.php b/application/libraries/ProfilLib.php index 50b8bc264..97cb8ce5d 100644 --- a/application/libraries/ProfilLib.php +++ b/application/libraries/ProfilLib.php @@ -183,7 +183,10 @@ class ProfilLib{ $zutrittskarte_ausgegebenam = $zutrittskarte_ausgegebenam ? current($zutrittskarte_ausgegebenam)->ausgegebenam : null; //? formats date from 01-01-2000 to 01.01.2000 - $zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam); + if ($zutrittskarte_ausgegebenam !== NULL) + { + $zutrittskarte_ausgegebenam = (new DateTime($zutrittskarte_ausgegebenam))->format('d.m.Y'); + } return $zutrittskarte_ausgegebenam; } @@ -196,7 +199,7 @@ class ProfilLib{ private function getAdressenInfo($pid) { $this->ci->load->model("person/Adresse_model","AdresseModel"); - $adresse_res = $this->ci->AdresseModel->addSelect(["adresse_id", "strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort", "zustelladresse", "gemeinde", "nation"]); + $adresse_res = $this->ci->AdresseModel->addSelect(["adresse_id", "strasse", "tbl_adressentyp.bezeichnung as typ", "plz", "ort", "heimatadresse", "zustelladresse", "gemeinde", "nation"]); $adresse_res = $this->ci->AdresseModel->addOrder("zustelladresse", "DESC"); $adresse_res = $this->ci->AdresseModel->addJoin("tbl_adressentyp", "typ=adressentyp_kurzbz"); @@ -214,7 +217,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 +225,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)); } diff --git a/application/libraries/StundenplanLib.php b/application/libraries/StundenplanLib.php index 6d53a2e2e..7ed64da2c 100644 --- a/application/libraries/StundenplanLib.php +++ b/application/libraries/StundenplanLib.php @@ -229,9 +229,10 @@ class StundenplanLib $this->_ci->load->model('ressource/Stundenplan_model', 'StundenplanModel'); $is_mitarbeiter = getData($this->_ci->MitarbeiterModel->isMitarbeiter(getAuthUID())); - - if ($is_mitarbeiter) { - $reservierungen = $this->_ci->ReservierungModel->getReservierungenMitarbeiter($start_date, $end_date, $ort_kurzbz); + + if ($is_mitarbeiter && empty($ort_kurzbz)) { + // request for personal lvplan show only reservations of logged in user + $reservierungen = $this->_ci->ReservierungModel->getReservierungenMitarbeiter($start_date, $end_date); } else { // querying the reservierungen $reservierungen = $this->_ci->ReservierungModel->getReservierungen($start_date, $end_date, $ort_kurzbz); diff --git a/application/models/person/Kontaktverifikation_model.php b/application/models/person/Kontaktverifikation_model.php new file mode 100644 index 000000000..17bcb1c35 --- /dev/null +++ b/application/models/person/Kontaktverifikation_model.php @@ -0,0 +1,42 @@ +dbTable = 'public.tbl_kontakt_verifikation'; + $this->pk = 'kontakt_verifikation_id'; + } + + /** + * Gets contact verification for a person and a verification code + * @param person_id + * @param kontakttyp + * @param verifikation_code + * @param expiration_days number of days after which verifikation code expires + * @return object success or error + */ + public function getKontaktVerifikation($person_id, $kontakttyp, $verifikation_code, $expiration_days = 1) + { + $qry = " + SELECT + kt.kontakt_id, + kv.verifikation_code + FROM + public.tbl_kontakt_verifikation kv + JOIN public.tbl_kontakt kt USING(kontakt_id) + WHERE kt.person_id = ? + AND kt.kontakttyp = ? + AND kv.verifikation_code = ? + AND kv.erstelldatum >= NOW() - INTERVAL '".$this->escape($expiration_days)." days' + ORDER BY + kt.kontakt_id DESC + LIMIT 1"; + + return $this->execQuery($qry, array($person_id, $kontakttyp, $verifikation_code)); + } +} diff --git a/application/models/person/Profil_update_model.php b/application/models/person/Profil_update_model.php index ffb04b7e7..31005c4b7 100644 --- a/application/models/person/Profil_update_model.php +++ b/application/models/person/Profil_update_model.php @@ -63,6 +63,7 @@ class Profil_update_model extends DB_Model $this->addSelect(["public.tbl_profil_update.*", "public.tbl_person.vorname"]); $this->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_profil_update.uid"); $this->addJoin("public.tbl_person", "public.tbl_person.person_id = public.tbl_benutzer.person_id"); + $this->db->order_by('COALESCE(public.tbl_profil_update.updateamum, public.tbl_profil_update.insertamum)', 'DESC', false); $res = $this->loadWhere($whereClause); if (isError($res)) { return $res; @@ -118,13 +119,47 @@ class Profil_update_model extends DB_Model $parameters = []; $query = " SELECT - profil_update_id, tbl_profil_update.uid, (tbl_person.vorname || ' ' || tbl_person.nachname) AS name , topic, requested_change, tbl_profil_update.updateamum, tbl_profil_update.updatevon, tbl_profil_update.insertamum, tbl_profil_update.insertvon, status, public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] as status_translated, status_timestamp, status_message, attachment_id + profil_update_id, + tbl_profil_update.uid, + (tbl_person.vorname || ' ' || tbl_person.nachname) AS name , + topic, + requested_change, + tbl_profil_update.updateamum, + tbl_profil_update.updatevon, + tbl_profil_update.insertamum, + tbl_profil_update.insertvon, + status, + public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] as status_translated, + status_timestamp, + status_message, + attachment_id, + UPPER(public.tbl_studiengang.typ || public.tbl_studiengang.kurzbz) AS studiengang, + COALESCE(of.orgform_kurzbz, public.tbl_studiengang.orgform_kurzbz) AS orgform, + NULL as oezuordnung FROM public.tbl_profil_update JOIN public.tbl_profil_update_status ON public.tbl_profil_update_status.status_kurzbz = public.tbl_profil_update.status JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid JOIN public.tbl_benutzer ON public.tbl_benutzer.uid = public.tbl_student.student_uid JOIN public.tbl_person ON public.tbl_benutzer.person_id=public.tbl_person.person_id JOIN public.tbl_studiengang ON public.tbl_studiengang.studiengang_kz=public.tbl_student.studiengang_kz + LEFT JOIN ( + select + pss.prestudent_id, COALESCE(sp.orgform_kurzbz, pss.orgform_kurzbz) as orgform_kurzbz + from ( + select + prestudent_id, max(insertamum) as insertamum + from + public.tbl_prestudentstatus + where + datum <= NOW() + group by + prestudent_id + ) mpss + join + public.tbl_prestudentstatus pss on pss.prestudent_id = mpss.prestudent_id and pss.insertamum = mpss.insertamum + left join + lehre.tbl_studienplan sp on pss.studienplan_id = sp.studienplan_id + ) of ON of.prestudent_id = public.tbl_student.prestudent_id Where public.tbl_studiengang.oe_kurzbz IN ? "; $parameters[] = $oe_berechtigung; if ($whereClause) { @@ -144,12 +179,33 @@ class Profil_update_model extends DB_Model } } if ($mitarbeiterBerechtigung) { - $this->addSelect(["profil_update_id", "tbl_profil_update.uid", "(tbl_person.vorname || ' ' || tbl_person.nachname) AS name", "topic", "requested_change", "tbl_profil_update.updateamum", "tbl_profil_update.updatevon", "tbl_profil_update.insertamum", "tbl_profil_update.insertvon", "status", "public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] AS status_translated", "status_timestamp", "status_message", "attachment_id"]); + $this->addSelect([ + "profil_update_id", + "tbl_profil_update.uid", + "(tbl_person.vorname || ' ' || tbl_person.nachname) AS name", + "topic", + "requested_change", + "tbl_profil_update.updateamum", + "tbl_profil_update.updatevon", + "tbl_profil_update.insertamum", + "tbl_profil_update.insertvon", + "status", + "public.tbl_profil_update_status.bezeichnung_mehrsprachig[(" . $lang . ")] AS status_translated", + "status_timestamp", + "status_message", + "attachment_id", + "COALESCE(NULL) as studiengang", + "COALESCE(NULL) as orgform", + "oe.bezeichnung as oezuordnung" + ]); $this->addJoin('tbl_profil_update_status', 'tbl_profil_update_status.status_kurzbz=tbl_profil_update.status'); $this->addJoin('tbl_mitarbeiter', 'tbl_mitarbeiter.mitarbeiter_uid=tbl_profil_update.uid'); $this->addJoin('tbl_benutzer', 'tbl_benutzer.uid=tbl_profil_update.uid'); $this->addJoin('tbl_person', 'tbl_benutzer.person_id=tbl_person.person_id'); + $this->addJoin('tbl_benutzerfunktion bf', 'bf.uid = tbl_benutzer.uid AND bf.funktion_kurzbz = \'oezuordnung\' AND NOW() >= COALESCE(bf.datum_von, \'1970-01-01\'::date) AND NOW() <= COALESCE(bf.datum_bis, \'2170-12-31\'::date)', 'LEFT'); + $this->addJoin('tbl_organisationseinheit oe', 'oe.oe_kurzbz = bf.oe_kurzbz', 'LEFT'); $mitarbeiterRequests = $this->loadWhere($whereClause); + if (isError($mitarbeiterRequests)) return error("db error: " . getData($mitarbeiterRequests)); $mitarbeiterRequests = getData($mitarbeiterRequests) ?: []; @@ -179,8 +235,11 @@ class Profil_update_model extends DB_Model private function formatProfilRequest($request) { $request->requested_change = json_decode($request->requested_change); + $request->insertamum_iso = !is_null($request->insertamum) ? date_create($request->insertamum)->format('Y-m-d') : null; $request->insertamum = !is_null($request->insertamum) ? date_create($request->insertamum)->format('d.m.Y') : null; + $request->updateamum_iso = !is_null($request->updateamum) ? date_create($request->updateamum)->format('Y-m-d') : null; $request->updateamum = !is_null($request->updateamum) ? date_create($request->updateamum)->format('d.m.Y') : null; + $request->status_timestamp_iso = !is_null($request->status_timestamp) ? date_create($request->status_timestamp)->format('Y-m-d') : null; $request->status_timestamp = !is_null($request->status_timestamp) ? date_create($request->status_timestamp)->format('d.m.Y') : null; } diff --git a/application/models/ressource/Reservierung_model.php b/application/models/ressource/Reservierung_model.php index 789ff3d9c..0c391ea20 100644 --- a/application/models/ressource/Reservierung_model.php +++ b/application/models/ressource/Reservierung_model.php @@ -76,7 +76,7 @@ class Reservierung_model extends DB_Model * * @return stdClass */ - public function getReservierungenMitarbeiter($start_date, $end_date, $ort_kurzbz = null) + public function getReservierungenMitarbeiter($start_date, $end_date) { $raum_reservierungen_query = "SELECT res.*, beginn, ende, @@ -89,7 +89,6 @@ class Reservierung_model extends DB_Model JOIN lehre.tbl_stunde ON lehre.tbl_stunde.stunde = res.stunde WHERE res.uid = ? AND datum >= ? AND datum <= ?"; -// $subquery = is_null($ort_kurzbz)? $lvplan_reservierungen_query:$raum_reservierungen_query; $subquery = $raum_reservierungen_query; diff --git a/application/views/Cis/ProfilUpdate.php b/application/views/Cis/ProfilUpdate.php index e797d436f..2e69208c7 100644 --- a/application/views/Cis/ProfilUpdate.php +++ b/application/views/Cis/ProfilUpdate.php @@ -2,10 +2,14 @@ $includesArray = array( 'title' => 'Profil Änderungen', 'vue3' => true, + 'primevue3' => true, 'bootstrap5' => true, 'fontawesome6'=> true, 'axios027' => true, 'tabulator5' => true, + 'customJSs' => array( + 'vendor/moment/luxonjs/luxon.min.js' + ), 'customJSModules' => array( 'public/js/apps/Cis/ProfilUpdateRequests.js' ), diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index f852e9ace..83961dd91 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -182,7 +182,7 @@ zugangscode)): ?>
-  p->t('infocenter','zugangBewerbung') ?>
diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php index 4142e413c..ea4c1eff0 100644 --- a/cis/private/lehre/pruefung/pruefung.js.php +++ b/cis/private/lehre/pruefung/pruefung.js.php @@ -382,7 +382,7 @@ function writePruefungsTable(e, data, anmeldung) } else if(new Date() > minimumFrist) { - button = "

"+frist+"'>

"; + button = "

"+frist+"'>

"; } } else @@ -479,13 +479,15 @@ function showPruefungsDetails(prfId, lvId) * @param {type} lvBezeichnung Bezeichnung der Lehrveranstaltung * @param {type} terminVon Beginn der Prüfung * @param {type} terminBis Ende der Prüfung + * @param {type} ects der LV * @returns {undefined} */ -function openDialog(lehrveranstaltung_id, termin_id, lvBezeichnung, terminVon, terminBis) +function openDialog(lehrveranstaltung_id, termin_id, lvBezeichnung, terminVon, terminBis, ects) { $("#lehrveranstaltungHidden").val(lehrveranstaltung_id); $("#terminHidden").val(termin_id); $("#lehrveranstaltung").html(lvBezeichnung); + $("#ectsangabe").val(ects); $.ajax({ dataType: 'json', @@ -582,6 +584,12 @@ function saveAnmeldung(lehrveranstaltung_id, termin_id) if($('#prestudent_studiengang').length) studiengang_kz = $('#prestudent_studiengang option:selected').val(); + var ects = null; + if ($('#ectsangabe').length) + { + ects = $('#ectsangabe').val(); + } + $.ajax({ dataType: 'json', url: "./pruefungsanmeldung.json.php", @@ -593,7 +601,8 @@ function saveAnmeldung(lehrveranstaltung_id, termin_id) bemerkung: bemerkungen, uid: uid, studienverpflichtung_id: studienverpflichtung_id, - studiengang_kz: studiengang_kz + studiengang_kz: studiengang_kz, + ects: ects }, error: loadError, success: function(data){ @@ -804,6 +813,7 @@ function writeAnmeldungen(data, showMessage = true) var pruefung_id = data.result.anmeldungen[0].pruefung_id; var lehrveranstaltung_id = data.result.anmeldungen[0].lehrveranstaltung_id; var ort_kurzbz = data.result.ort_kurzbz; + var anderer_raum = data.result.anderer_raum; var lv_bezeichnung = data.result.lv_bezeichnung; var lv_lehrtyp = data.result.lv_lehrtyp; var prf_termin = data.result.datum; @@ -816,24 +826,33 @@ function writeAnmeldungen(data, showMessage = true) count++; var vorname = d.student.vorname !== "null" ? d.student.vorname : ""; var nachname = d.student.nachname !== "null" ? d.student.nachname : ""; + + let ects = ""; + + ects = d.ects !== null ? "(" + d.ects + " ECTS) ": ""; + + + switch(d.status_kurzbz) { case 'angemeldet': - liste += "
  • "+vorname+" "+nachname+""; + liste += "
  • "+ects+vorname+" "+nachname+""; liste += "
    "+count+"
    ' onclick='anmeldungBestaetigen(\""+d.pruefungsanmeldung_id+"\", \""+terminId+"\", \""+lehrveranstaltung_id+"\");'>"; liste += "
    "; if(d.wuensche !== null) { - liste += "
    "+d.wuensche+"'>
    "; + let msg = $('
    ').text(d.wuensche).html(); + liste += `
    `; } liste += "
  • "; break; case 'bestaetigt': - liste += "
  • "+vorname+" "+nachname+""; + liste += "
  • "+ects+vorname+" "+nachname+""; liste += "
    "+count+"
    : "+d.statusupdatevon+"'>t('pruefung/bestaetigt'); ?>
    "; if(d.wuensche !== null) { - liste += "
    "+d.wuensche+"'>
    "; + let msg = $('
    ').text(d.wuensche).html(); + liste += `
    `; } break; @@ -844,13 +863,14 @@ function writeAnmeldungen(data, showMessage = true) }); liste += ""; $("#anmeldung_hinzufuegen").html("' onclick='saveAnmeldung(\""+lehrveranstaltung_id+"\",\""+terminId+"\");'/>"); - $("#reihungSpeichernButton").html("' onclick='saveReihung(\""+terminId+"\", \""+lehrveranstaltung_id+"\");'>' onclick='alleBestaetigen(\""+terminId+"\", \""+lehrveranstaltung_id+"\");'>"); + $("#reihungSpeichernButton").html("