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/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/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/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/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/include/dokument.class.php b/include/dokument.class.php index 6dec9a66d..7b1d490fb 100644 --- a/include/dokument.class.php +++ b/include/dokument.class.php @@ -888,9 +888,10 @@ class dokument extends basis_db * Akzeptiert ein bestimmtes Dokument * @param char $dokument_kurzbz Bezeichner Dokument. * @param int $person_id Personenkennzeichen. + * @param array $studiengang_typen einschränken nach Studiengang Typ. * @return boolean true wenn akzeptiert bzw geprüft ohne Akzeptieren, false wenn Fehler */ - public function akzeptiereDokument($dokument_kurzbz, $person_id) + public function akzeptiereDokument($dokument_kurzbz, $person_id, $studiengang_typen = null) { $db = new basis_db(); $arrayDoksZuAkzeptieren = array(); @@ -902,7 +903,6 @@ class dokument extends basis_db tbl_prestudent ps, tbl_studiengang sg WHERE ps.studiengang_kz = sg.studiengang_kz - AND sg.typ = 'm' AND person_id = ".$this->db_add_param($person_id)." AND not exists( SELECT * @@ -910,6 +910,11 @@ class dokument extends basis_db where dok.prestudent_id = ps.prestudent_id and dokument_kurzbz = ".$this->db_add_param($dokument_kurzbz).")"; + if (isset($studiengang_typen) && is_array($studiengang_typen) && !empty($studiengang_typen)) + { + $qry .= ' AND sg.typ IN ('. $db->db_implode4SQL($studiengang_typen).')'; + } + //gibt ein Array von zu akzeptierenden Dokumenten zurück if ($db->db_query($qry)) { @@ -923,11 +928,14 @@ class dokument extends basis_db } //für alle prestudent_ids das Dokument akzeptieren - $qry = "INSERT INTO public.tbl_dokumentprestudent(dokument_kurzbz, prestudent_id) VALUES"; + $qry = "INSERT INTO public.tbl_dokumentprestudent(dokument_kurzbz, prestudent_id, datum, insertamum) VALUES"; foreach ($arrayDoksZuAkzeptieren as $prestudent_id) { - $qry .= "(".$this->db_add_param($dokument_kurzbz). ",". $prestudent_id. ")"; + $qry .= "(".$this->db_add_param($dokument_kurzbz). + ",".$this->db_add_param($prestudent_id, FHC_INTEGER). + ",".$this->db_add_param(date('Y-m-d')). + ",".$this->db_add_param(strftime('%Y-%m-%d %H:%M')). ")"; if (next($arrayDoksZuAkzeptieren) == true) { diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 73703b42b..5b76c5721 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -50,7 +50,7 @@ const app = Vue.createApp({ defaultaction: { type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; @@ -79,7 +79,7 @@ const app = Vue.createApp({ icon: "fas fa-info-circle", type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; 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 { Profilbild