diff --git a/application/controllers/api/frontend/v1/checkperson/CheckPerson.php b/application/controllers/api/frontend/v1/checkperson/CheckPerson.php new file mode 100644 index 000000000..321893610 --- /dev/null +++ b/application/controllers/api/frontend/v1/checkperson/CheckPerson.php @@ -0,0 +1,141 @@ +. + */ + +if (! defined('BASEPATH')) exit('No direct script access allowed'); + +class CheckPerson extends FHCAPI_Controller +{ + public function __construct() + { + parent::__construct([ + 'updatePersonUnrulyStatus' => array('basis/mitarbeiter:rw', 'student/antragfreigabe:rw', 'student/studierendenantrag:rw'), + 'filterPerson' => array('basis/mitarbeiter:rw', 'student/antragfreigabe:rw', 'student/studierendenantrag:rw'), + 'checkUnruly' => array('basis/mitarbeiter:r', 'student/antragfreigabe:r', 'student/studierendenantrag:r', 'infocenter:r'), + 'checkDuplicate' => array('infocenter:r'), + ]); + + $this->_ci =& get_instance(); + $this->_ci->load->model('person/Person_model', 'PersonModel'); + } + + public function updatePersonUnrulyStatus() + { + $data = json_decode($this->input->raw_input_stream, true); + + $person_id = $data['person_id']; + $unruly = $data['unruly']; + + $result = $this->_ci->PersonModel->updateUnruly($person_id, $unruly); + + if(isError($result)) { + $this->terminateWithError($result); + } else if (isSuccess($result)) { + $this->terminateWithSuccess($result); + } + + } + + public function checkDuplicate() { + + $person_id = $this->input->post('person_id'); + + $result = $this->_ci->PersonModel->checkDuplicate($person_id); + + if (isSuccess($result)) + $this->terminateWithSuccess($result); + else + $this->terminateWithError('Error when searching for person'); + + } + + // performs strict check over vorname, nachname, gebdatum + public function checkUnruly() { + + $vorname = $this->input->post('vorname'); + $nachname = $this->input->post('nachname'); + $gebdatum = $this->input->post('gebdatum'); + + $result = $this->_ci->PersonModel->checkUnruly($vorname, $nachname, $gebdatum); + + if (isSuccess($result)) + $this->terminateWithSuccess($result); + else + $this->terminateWithError('Error when searching for person'); + } + + // filters nachname on similarity and vorname/gebdatum are optional + public function filterPerson() { + $payload = json_decode($this->input->raw_input_stream, TRUE); + + $nachnameString = ''; + $vornameString = ''; + $filterUnruly = true; + $birthdateString = ''; + + if(array_key_exists( 'nachname', $payload) ) { + $nachnameString = $payload['nachname']; + } + + if(array_key_exists('vorname', $payload)) { + $vornameString = $payload['vorname']; + } + + if(array_key_exists('unruly', $payload)){ + $filterUnruly = $payload['unruly']; + } + + if(array_key_exists('gebdatum', $payload)) { + // TODO: enable if gebdatum filter for unrulys is desired +// $birthdateString = $payload['gebdatum']; + } + + $parametersArray = array($nachnameString); + $where ="p.nachname~* ? "; + if (mb_strlen($nachnameString) == 2) + { + $where = "p.nachname=? "; + } + + if(isset($vornameString) && $vornameString != '') + { + $where.= " AND p.vorname~*?"; + $parametersArray[] = $vornameString; + } + + if(isset($birthdateString) && $birthdateString != '') + { + $where.=" AND p.gebdatum=?"; + $parametersArray[] = $birthdateString; + } + + if(isset($filterUnruly)) + { + $where.=" AND p.unruly=?"; + $parametersArray[] = $filterUnruly; + } + + $result = $this->_ci->PersonModel->checkUnrulyWhere($where, $parametersArray); + + if (isSuccess($result)) + $this->terminateWithSuccess($result); + else + $this->terminateWithError('Error when searching for person'); + + + } +} \ No newline at end of file diff --git a/application/controllers/api/frontend/v1/studstatus/Abmeldung.php b/application/controllers/api/frontend/v1/studstatus/Abmeldung.php index 875b6484c..aada1f436 100644 --- a/application/controllers/api/frontend/v1/studstatus/Abmeldung.php +++ b/application/controllers/api/frontend/v1/studstatus/Abmeldung.php @@ -184,4 +184,4 @@ class Abmeldung extends FHCAPI_Controller $this->terminateWithSuccess($data); } -} +} \ No newline at end of file diff --git a/application/controllers/api/v1/person/Person.php b/application/controllers/api/v1/person/Person.php index a686f6060..6a373137f 100644 --- a/application/controllers/api/v1/person/Person.php +++ b/application/controllers/api/v1/person/Person.php @@ -264,4 +264,4 @@ class Person extends API_Controller return success('Input data are valid'); } -} +} \ No newline at end of file diff --git a/application/controllers/lehre/Studierendenantrag.php b/application/controllers/lehre/Studierendenantrag.php index d6d6b2c50..107c9af96 100644 --- a/application/controllers/lehre/Studierendenantrag.php +++ b/application/controllers/lehre/Studierendenantrag.php @@ -21,6 +21,7 @@ class Studierendenantrag extends FHC_Controller // Load Models $this->load->model('education/Studierendenantrag_model', 'StudierendenantragModel'); + $this->load->model('person/Person_model', 'PersonModel'); // Load language phrases $this->loadPhrases([ @@ -102,6 +103,7 @@ class Studierendenantrag extends FHC_Controller public function abmeldungstgl($prestudent_id, $studierendenantrag_id = null) { + $this->load->view('lehre/Antrag/Create', [ 'prestudent_id' => $prestudent_id, 'studierendenantrag_id' => $studierendenantrag_id, @@ -185,4 +187,4 @@ class Studierendenantrag extends FHC_Controller return $strRequiredPermissions; } -} +} \ No newline at end of file diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index cf0c6755a..f6e41d2e6 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -337,10 +337,13 @@ class InfoCenter extends Auth_Controller $persondata = $this->_loadPersonData($person_id); $checkPerson = $this->PersonModel->checkDuplicate($person_id); - if (isError($checkPerson)) show_error(getError($checkPerson)); - $duplicate = array('duplicated' => getData($checkPerson)); + $checkUnruly = $this->PersonModel->checkUnruly($persondata['stammdaten']->vorname, $persondata['stammdaten']->nachname, $persondata['stammdaten']->gebdatum); + if (isError($checkUnruly)) show_error(getError($checkUnruly)); + + $duplicate = array('duplicate' => getData($checkPerson)); + $unruly = array('unruly' => getData($checkUnruly)); $prestudentdata = $this->_loadPrestudentData($person_id); @@ -351,7 +354,8 @@ class InfoCenter extends Auth_Controller $persondata, $prestudentdata, $dokumentdata, - $duplicate + $duplicate, + $unruly ); $data[self::FHC_CONTROLLER_ID] = $this->getControllerId(); @@ -1285,67 +1289,28 @@ class InfoCenter extends Auth_Controller $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); $kontakte = $this->input->post('kontakt'); - foreach ($kontakte as $kontakt) - { - $kontaktExists = $this->KontaktModel->loadWhere(array( - 'kontakt_id' => $kontakt['id'], - 'person_id' => $person_id, - )); + if($kontakte) { - if (hasData($kontaktExists)) - { - $kontaktExists = getData($kontaktExists)[0]; + foreach ($kontakte as $kontakt) { + $kontaktExists = $this->KontaktModel->loadWhere(array( + 'kontakt_id' => $kontakt['id'], + 'person_id' => $person_id, + )); - if ($kontaktExists->kontakt === $kontakt['value']) - continue; + if (hasData($kontaktExists)) { + $kontaktExists = getData($kontaktExists)[0]; - $update = $this->KontaktModel->update( - array - ( - 'kontakt_id' => $kontakt['id'] - ), - array - ( - 'kontakt' => isEmptyString($kontakt['value']) ? null : $kontakt['value'], - 'updateamum' => date('Y-m-d H:i:s'), - 'updatevon' => $this->_uid - ) - ); + if ($kontaktExists->kontakt === $kontakt['value']) + continue; - if (isError($update)) - $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); - } - } - - $adressen = $this->input->post('adresse'); - - foreach ($adressen as $adresse) - { - $adresseExists = $this->AdresseModel->loadWhere(array( - 'adresse_id' => $adresse['id'], - 'person_id' => $person_id, - )); - - if (hasData($adresseExists)) - { - $adresse = $adresse['value']; - $adresseExists = getData($adresseExists)[0]; - if ($adresseExists->strasse !== $adresse['strasse'] || - $adresseExists->plz !== $adresse['plz'] || - $adresseExists->ort !== $adresse['ort'] || - $adresseExists->nation !== $adresse['nation']) - { - $update = $this->AdresseModel->update( + $update = $this->KontaktModel->update( array ( - 'adresse_id' => $adresseExists->adresse_id + 'kontakt_id' => $kontakt['id'] ), array ( - 'strasse' => isEmptyString($adresse['strasse']) ? null : $adresse['strasse'], - 'plz' => isEmptyString($adresse['plz']) ? null : $adresse['plz'], - 'ort' => isEmptyString($adresse['ort']) ? null : $adresse['ort'], - 'nation' => isEmptyString($adresse['nation']) ? null : $adresse['nation'], + 'kontakt' => isEmptyString($kontakt['value']) ? null : $kontakt['value'], 'updateamum' => date('Y-m-d H:i:s'), 'updatevon' => $this->_uid ) @@ -1354,7 +1319,48 @@ class InfoCenter extends Auth_Controller if (isError($update)) $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); } + } + } + + $adressen = $this->input->post('adresse'); + + if($adressen) { + + foreach ($adressen as $adresse) { + $adresseExists = $this->AdresseModel->loadWhere(array( + 'adresse_id' => $adresse['id'], + 'person_id' => $person_id, + )); + + if (hasData($adresseExists)) { + $adresse = $adresse['value']; + $adresseExists = getData($adresseExists)[0]; + if ($adresseExists->strasse !== $adresse['strasse'] || + $adresseExists->plz !== $adresse['plz'] || + $adresseExists->ort !== $adresse['ort'] || + $adresseExists->nation !== $adresse['nation']) { + $update = $this->AdresseModel->update( + array + ( + 'adresse_id' => $adresseExists->adresse_id + ), + array + ( + 'strasse' => isEmptyString($adresse['strasse']) ? null : $adresse['strasse'], + 'plz' => isEmptyString($adresse['plz']) ? null : $adresse['plz'], + 'ort' => isEmptyString($adresse['ort']) ? null : $adresse['ort'], + 'nation' => isEmptyString($adresse['nation']) ? null : $adresse['nation'], + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + } + + } } } @@ -2383,4 +2389,4 @@ class InfoCenter extends Auth_Controller $this->outputJsonSuccess("Success"); } -} +} \ No newline at end of file diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index e45c4ad34..885acac90 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -930,7 +930,7 @@ class AntragLib public function createWiederholung($prestudent_id, $studiensemester_kurzbz, $insertvon, $repeat) { $result = $this->_ci->StudierendenantragModel->loadIdAndStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 'studiensemester_kurzbz'=> $studiensemester_kurzbz, 'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG ]); @@ -1360,7 +1360,7 @@ class AntragLib if (!in_array($result->status_kurzbz, $this->_ci->config->item('antrag_prestudentstatus_whitelist_abmeldung'))) { $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_APPROVED ], [ Studierendenantrag_model::TYP_ABMELDUNG, @@ -1372,7 +1372,7 @@ class AntragLib return success(-1); $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_PAUSE ], [ Studierendenantrag_model::TYP_ABMELDUNG, @@ -1386,7 +1386,7 @@ class AntragLib return success(0); } - $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]); + $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]); if (isError($result)) return $result; if (!hasData($result)) @@ -1447,7 +1447,7 @@ class AntragLib && $result->status_kurzbz != 'Unterbrecher') { return success(0); } - $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]); + $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]); if (isError($result)) return $result; if (!hasData($result)) @@ -1523,7 +1523,7 @@ class AntragLib $datumStatus = $result->datum; if (!in_array($result->status_kurzbz, $this->_ci->config->item('antrag_prestudentstatus_whitelist'))) { $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG, 's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_APPROVED ]); @@ -1533,7 +1533,7 @@ class AntragLib return success(-1); $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG, 's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_DEREGISTERED ]); @@ -1543,7 +1543,7 @@ class AntragLib return success(-1); $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere([ - 'prestudent_id' => $prestudent_id, + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id, 'typ' => Studierendenantrag_model::TYP_WIEDERHOLUNG, 's.studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_PAUSE ]); @@ -1554,7 +1554,7 @@ class AntragLib return success(0); } - $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['prestudent_id' => $prestudent_id]); + $result = $this->_ci->StudierendenantragModel->loadWithStatusWhere(['tbl_studierendenantrag.prestudent_id' => $prestudent_id]); if (isError($result)) return $result; if (!hasData($result)) @@ -1607,7 +1607,7 @@ class AntragLib public function getDetailsForLastAntrag($prestudent_id, $typ = null) { $where = [ - 'prestudent_id' => $prestudent_id + 'tbl_studierendenantrag.prestudent_id' => $prestudent_id ]; $types = null; if ($typ) { @@ -2193,4 +2193,4 @@ class AntragLib $result = $this->_ci->StudierendenantraglehrveranstaltungModel->getLvsForPrestudent($prestudent_id, $studiensemester_kurzbz); return $result; } -} +} \ No newline at end of file diff --git a/application/libraries/PrestudentLib.php b/application/libraries/PrestudentLib.php index af62668cf..ef5e2e3a9 100644 --- a/application/libraries/PrestudentLib.php +++ b/application/libraries/PrestudentLib.php @@ -254,7 +254,7 @@ class PrestudentLib $studiengang = current(getData($res)); $prestudent_status = current($result); - if($prestudent_status->ausbildungssemester + 1 < $studiengang->max_semester) + if ($prestudent_status->status_kurzbz != Prestudentstatus_model::STATUS_UNTERBRECHER && $prestudent_status->ausbildungssemester + 1 < $studiengang->max_semester) $ausbildungssemester_plus = 1; if(!$result) @@ -264,6 +264,35 @@ class PrestudentLib 'studiensemester_kurzbz' => $studiensemester_kurzbz ])); } + } elseif (current($result)->status_kurzbz == Prestudentstatus_model::STATUS_UNTERBRECHER) { + if ($studierendenantrag_id) + { + $resultAntrag = $this->_ci->StudierendenantragModel->load($studierendenantrag_id); + if (isError($resultAntrag)) + return $resultAntrag; + $resultAntrag = getData($resultAntrag); + if (!$resultAntrag) + return error($this->_ci->p->t('studierendenantrag', 'error_no_antrag_found', ['id' => $studierendenantrag_id])); + + $antrag = current($resultAntrag); + $anmerkung = current($result)->anmerkung . ' Wiedereinstieg ' . $antrag->datum_wiedereinstieg; + + $result = $this->_ci->PrestudentstatusModel->update([ + 'prestudent_id' => $prestudent_id, + 'status_kurzbz' => Prestudentstatus_model::STATUS_UNTERBRECHER, + 'studiensemester_kurzbz' => $studiensemester_kurzbz, + 'ausbildungssemester' => current($result)->ausbildungssemester + ], [ + 'updatevon' => $insertvon, + 'updateamum' => date('c'), + 'anmerkung'=> $anmerkung + ]); + + if (isError($result)) + return $result; + } + + return success(); } $prestudent_status = current($result); diff --git a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php index 22f8ee2ae..95bbdd908 100644 --- a/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php +++ b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php @@ -201,6 +201,10 @@ class Gehaltsbestandteil extends AbstractBestandteil implements \JsonSerializabl public function setGrundbetrag($grundbetrag) { + if(is_float($grundbetrag)) + { + $grundbetrag = number_format($grundbetrag, 2, '.', ''); + } $this->markDirty('grundbetrag', $this->grundbetrag, $grundbetrag); $this->grundbetrag = $grundbetrag; return $this; @@ -208,6 +212,10 @@ class Gehaltsbestandteil extends AbstractBestandteil implements \JsonSerializabl public function setBetrag_valorisiert($betrag_valorisiert) { + if(is_float($betrag_valorisiert)) + { + $betrag_valorisiert = number_format($betrag_valorisiert, 2, '.', ''); + } $this->markDirty('betrag_valorisiert', $this->betrag_valorisiert, $betrag_valorisiert); $this->betrag_valorisiert = $betrag_valorisiert; return $this; diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index 6405569db..5f0b5876c 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -289,6 +289,7 @@ class Prestudentstatus_model extends DB_Model $this->addSelect('ss.studienjahr_kurzbz'); $this->addSelect('pers.vorname'); $this->addSelect('pers.nachname'); + $this->addSelect('pers.unruly'); $this->addSelect('TRIM(CONCAT(pers.vorname, \' \', pers.nachname)) AS name'); $this->addSelect('pers.person_id'); $this->addSelect('g.studiengang_kz'); @@ -571,12 +572,12 @@ class Prestudentstatus_model extends DB_Model $this->addOrder('tbl_prestudentstatus.datum', 'DESC'); $this->addOrder('tbl_prestudentstatus.insertamum', 'DESC'); $this->addOrder('tbl_prestudentstatus.ext_id', 'DESC'); - + $this->addLimit(1); $this->db->where('prestudent_id', $prestudent_id); $this->db->where('status_kurzbz', self::STATUS_STUDENT); - + $sql = $this->db->get_compiled_select($this->dbTable); $this->addJoin('lehre.tbl_studienplan plan', 'studienplan_id', 'LEFT'); @@ -587,4 +588,4 @@ class Prestudentstatus_model extends DB_Model 'status_kurzbz' => self::STATUS_BEWERBER ]); } -} +} \ No newline at end of file diff --git a/application/models/education/Studierendenantrag_model.php b/application/models/education/Studierendenantrag_model.php index b7c0667cb..677d01f04 100644 --- a/application/models/education/Studierendenantrag_model.php +++ b/application/models/education/Studierendenantrag_model.php @@ -38,6 +38,7 @@ class Studierendenantrag_model extends DB_Model $this->addSelect('studienjahr_kurzbz'); $this->addSelect('vorname'); $this->addSelect('nachname'); + $this->addSelect('unruly'); $this->addSelect('p.prestudent_id'); $this->addSelect('p.studiengang_kz'); $this->addSelect('semester'); @@ -149,6 +150,8 @@ class Studierendenantrag_model extends DB_Model $this->addSelect('s.studierendenantrag_statustyp_kurzbz status'); $this->addSelect('s.insertvon status_insertvon'); $this->addSelect('t.bezeichnung[(' . $lang . ')] statustyp'); + $this->addSelect('p.unruly AS unruly'); + $this->addSelect($this->dbTable . '.insertamum AS insertamum'); $this->addJoin( 'campus.tbl_studierendenantrag_status s', @@ -158,6 +161,18 @@ class Studierendenantrag_model extends DB_Model 'campus.tbl_studierendenantrag_statustyp t', 's.studierendenantrag_statustyp_kurzbz=t.studierendenantrag_statustyp_kurzbz' ); + $this->addJoin( + 'public.tbl_student st', + 'st.prestudent_id=tbl_studierendenantrag.prestudent_id' + ); + $this->addJoin( + 'public.tbl_benutzer b', + 'st.student_uid=b.uid' + ); + $this->addJoin( + 'public.tbl_person p', + 'b.person_id=p.person_id' + ); if ($types && is_array($types)) { $this->db->where_in('typ', $types); diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 88813220e..dc925a171 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -294,15 +294,15 @@ class Person_model extends DB_Model { $qry = "SELECT person_id FROM public.tbl_prestudent p - JOIN + JOIN ( SELECT DISTINCT ON(prestudent_id) * FROM public.tbl_prestudentstatus - WHERE prestudent_id IN + WHERE prestudent_id IN ( - SELECT prestudent_id - FROM public.tbl_prestudent - WHERE person_id IN + SELECT prestudent_id + FROM public.tbl_prestudent + WHERE person_id IN ( SELECT p2.person_id FROM public.tbl_person p @@ -316,8 +316,8 @@ class Person_model extends DB_Model ORDER BY prestudent_id, datum DESC, insertamum DESC ) ps USING(prestudent_id) JOIN public.tbl_status USING(status_kurzbz) - WHERE status_kurzbz = 'Interessent' - AND studiengang_kz IN + WHERE status_kurzbz = 'Interessent' + AND studiengang_kz IN ( SELECT studiengang_kz FROM public.tbl_prestudent p @@ -374,5 +374,38 @@ class Person_model extends DB_Model 'prestudent_id' => $prestudent_id ]); } -} + public function checkUnruly($vorname, $nachname, $gebdatum) + { + $qry = "SELECT person_id, vorname, nachname, gebdatum, unruly + FROM tbl_person + WHERE tbl_person.vorname = ? + AND tbl_person.nachname = ? + AND tbl_person.gebdatum = ? + AND tbl_person.unruly = TRUE;"; + + return $this->execQuery($qry, [$vorname, $nachname, $gebdatum]); + } + + public function checkUnrulyWhere($where, $paramsArray) + { + $qry = 'SELECT * + FROM tbl_person p + WHERE '.$where.';'; + + return $this->execQuery($qry, $paramsArray); + } + + public function updateUnruly($person_id, $unruly) + { + $result = $this->update($person_id, array( + 'unruly' => $unruly + )); + + if (isError($result)) { + return error($result->msg, EXIT_ERROR); + } else if (isSuccess($result) && hasData($result)) { + return success($result); + } + } +} \ No newline at end of file diff --git a/application/views/lehre/Antrag/Create.php b/application/views/lehre/Antrag/Create.php index 91b20c9b7..7e8bda874 100644 --- a/application/views/lehre/Antrag/Create.php +++ b/application/views/lehre/Antrag/Create.php @@ -52,4 +52,4 @@ $this->load->view( $this->load->view( 'templates/FHC-Footer', $sitesettings -); +); \ No newline at end of file diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index a8e6e3e13..51b913b6c 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -27,7 +27,8 @@ 'public/js/infocenter/rueckstellung.js', 'public/js/infocenter/zgvUeberpruefung.js', 'public/js/infocenter/docUeberpruefung.js', - 'public/js/infocenter/stammdaten.js' + 'public/js/infocenter/stammdaten.js', + 'public/js/infocenter/personcheck.js' ), 'phrases' => array( 'infocenter', @@ -38,6 +39,14 @@ $this->load->view('templates/FHC-Header', $includesArray); ?> + + +
widgetlib->widget('NavigationWidget'); ?> @@ -74,22 +83,8 @@
- -
-

- p->t('global', 'bewerberVorhanden') . ':'; ?> -

-
- person_id . '
'; - } - ?> -
- -
- +
+ load->view('system/infocenter/personCheck.php', array('unruly' => $unruly, 'duplicate' => $duplicate)); ?>
@@ -201,5 +196,4 @@
-load->view('templates/FHC-Footer', $includesArray); ?> - +load->view('templates/FHC-Footer', $includesArray); ?> \ No newline at end of file diff --git a/application/views/system/infocenter/personCheck.php b/application/views/system/infocenter/personCheck.php new file mode 100644 index 000000000..d24d26419 --- /dev/null +++ b/application/views/system/infocenter/personCheck.php @@ -0,0 +1,34 @@ + + + + \ No newline at end of file diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index a372bc9da..09f33ee31 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -266,6 +266,8 @@ define('BIS_FUNKTIONSCODE_6_ARR', array( // bPk Abfrage define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false); +// bPk Typen in Form 'BEREICH' => 'kennzeichenTyp' +define('VBPK_TYPES', array('AS' => 'vbpkAs', 'BF' => 'vbpkBf', 'ZP-TD' => 'vbpkTd')); // Docsbox configs define('DOCSBOX_SERVER', 'http://docconverter.technikum-wien.at/'); diff --git a/include/dvb.class.php b/include/dvb.class.php index fbeb79afc..90eb8d306 100644 --- a/include/dvb.class.php +++ b/include/dvb.class.php @@ -29,6 +29,7 @@ require_once(dirname(__FILE__).'/studiensemester.class.php'); require_once(dirname(__FILE__).'/adresse.class.php'); require_once(dirname(__FILE__).'/webservicelog.class.php'); require_once(dirname(__FILE__).'/prestudent.class.php'); +require_once(dirname(__FILE__).'/kennzeichen.class.php'); require_once(dirname(__FILE__).'/errorhandler.class.php'); class dvb extends basis_db @@ -42,6 +43,7 @@ class dvb extends basis_db const DVB_URL_WEBSERVICE_RESERVIERUNG = DVB_PORTAL.'/rws/0.6/matrikelreservierung.xml'; const DVB_URL_WEBSERVICE_MELDUNG = DVB_PORTAL.'/rws/0.6/matrikelmeldung.xml'; const DVB_URL_WEBSERVICE_BPK = DVB_PORTAL.'/rws/0.6/pruefebpk.xml'; + const DVB_URL_WEBSERVICE_BPK_ALL = DVB_PORTAL.'/rws/0.8/pruefebpk.xml'; public $authentication; private $username; @@ -1149,15 +1151,29 @@ class dvb extends basis_db */ public function getBPK($person_id) { + $vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null; + $person = new person(); if ($person->load($person_id)) { if ($person->bpk != '') { - // BPK exisitert bereits $retval = new stdClass(); $retval->bpk = $person->bpk; - return ErrorHandler::success($retval); + + // BPK existiert bereits + if (!isset($vbpkTypes)) return ErrorHandler::success($retval); + + $kennzeichen = new kennzeichen(); + + if ($kennzeichen->load_pers($person_id, $vbpkTypes)) + { + if (array_unique(array_column($kennzeichen->result, 'kennzeichentyp_kurzbz')) == array_values($vbpkTypes)) + { + // BPKs exisiteren bereits + return ErrorHandler::success($retval); + } + } } if ($person->gebdatum == '') @@ -1178,7 +1194,8 @@ class dvb extends basis_db return ErrorHandler::error($errormsg); } - $geburtsdatum = str_replace("-", "", $person->gebdatum); + //$geburtsdatum = str_replace("-", "", $person->gebdatum); + $geburtsdatum = $person->gebdatum; $vorname = $person->vorname; $nachname = $person->nachname; $geschlecht = mb_strtoupper($person->geschlecht); @@ -1258,6 +1275,8 @@ class dvb extends basis_db */ public function pruefeBPK($geburtsdatum, $vorname, $nachname, $geschlecht, $plz = null, $strasse = null) { + $vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null; + if ($this->tokenIsExpired()) { $result = $this->authenticate(); @@ -1271,7 +1290,7 @@ class dvb extends basis_db $uuid = $this->getUUID(); - $url = self::DVB_URL_WEBSERVICE_BPK; + $url = self::DVB_URL_WEBSERVICE_BPK_ALL; $url .= '?geburtsdatum='.curl_escape($curl, $geburtsdatum); $url .= '&vorname='.curl_escape($curl, $vorname); $url .= '&nachname='.curl_escape($curl, $nachname); @@ -1311,24 +1330,15 @@ class dvb extends basis_db if ($curl_info['http_code'] == '200') { /* Example Response: - - - 12345ABCDEFGHXXXXXXX= - - - Hans - Huber - M - 1990-01-01 - - - - 1100 - - - - - + + + 5cc93441-a46a-4f97-a5e3-e64891b39f10 + 12345ABCDEFG + 12345ABCDEFG + 12345ABCDEFG + 12345ABCDEFG + true + Example Error: @@ -1369,10 +1379,30 @@ class dvb extends basis_db } $domnodes_bpk = $dom->getElementsByTagNameNS($namespace, 'bpk'); + if ($domnodes_bpk->length > 0) { $retval = new stdClass(); $retval->bpk = $domnodes_bpk->item(0)->textContent; + + // vbpks auslesen + $domnodes_vbpks = $dom->getElementsByTagNameNS($namespace, 'vbpk'); + + $retval->vbpks = array(); + if ($domnodes_vbpks->length > 0) + { + foreach ($domnodes_vbpks as $domnode_vbpk) + { + foreach ($domnode_vbpk->attributes as $attribute) + { + if ($attribute->nodeName == 'bereich' && isset($vbpkTypes[$attribute->nodeValue])) + { + $retval->vbpks[$vbpkTypes[$attribute->nodeValue]] = $domnode_vbpk->nodeValue; + } + } + } + } + return ErrorHandler::success($retval); } else @@ -1385,6 +1415,27 @@ class dvb extends basis_db $retval->multiple = true; return ErrorHandler::error(null, $retval); } + else + { + $errorTexts = array(); + $domnodes_fehler = $dom->getElementsByTagNameNS($namespace, 'fehlerliste'); + + if ($domnodes_fehler->length > 0) + { + foreach ($domnodes_fehler as $domnode_fehler) + { + if ($domnode_fehler->childNodes->length > 0) + { + foreach ($domnode_fehler->childNodes as $childNode) + { + $errorTexts[] = $childNode->nodeValue; + } + } + } + $this->errormsg = count($errorTexts) > 0 ? implode('; ', $errorTexts) : null; + return ErrorHandler::error(null); + } + } } return ErrorHandler::error(); } diff --git a/include/kennzeichen.class.php b/include/kennzeichen.class.php new file mode 100644 index 000000000..c21c5eee0 --- /dev/null +++ b/include/kennzeichen.class.php @@ -0,0 +1,261 @@ +, + */ +/** + * Klasse kennzeichen + */ +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class kennzeichen extends basis_db +{ + public $new; // boolean + public $result = array(); // adresse Objekt + + //Tabellenspalten + public $kennzeichen_id; // integer + public $person_id; // integer + + public $kennzeichentyp_kurzbz; // string + public $inhalt; // string + public $aktiv; // boolean + public $insertamum; // timestamp + public $insertvon; // string + public $updateamum; // timestamp + public $updatevon; // string + + /** + * Konstruktor + * @param $kennzeichen_id ID des Kennzeichens das geladen werden soll (Default=null) + */ + public function __construct($kennzeichen_id=null) + { + parent::__construct(); + $this->new = true; + + if(!is_null($kennzeichen_id)) + $this->load($kennzeichen_id); + } + + /** + * Laedt ein Kennzeichen mit der ID $kennzeichen_id + * @param $kennzeichen_id ID des zu ladenden Kennzeichens + * @return true wenn ok, false im Fehlerfall + */ + public function load($kennzeichen_id) + { + if (!is_numeric($kennzeichen_id)) + { + $this->errormsg = 'Kennzeichen Id ist ungueltig'; + return false; + } + + $qry = "SELECT + * + FROM + public.tbl_kennzeichen + WHERE + kennzeichen_id = " . $this->db_add_param($kennzeichen_id, FHC_INTEGER) . ";"; + + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { + $this->kennzeichen_id = $row->kennzeichen_id; + $this->person_id = $row->person_id; + $this->kennzeichentyp_kurzbz = $row->kennzeichentyp_kurzbz; + $this->inhalt = $row->inhalt; + $this->aktiv = $this->db_parse_bool($row->aktiv); + $this->updateamum = $row->updateamum; + $this->updatevon = $row->updatevon; + $this->insertamum = $row->insertamum; + $this->insertvon = $row->insertvon; + return true; + } + else + { + $this->errormsg = 'Datensatz wurde nicht gefunden'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + /** + * Prueft die Kennzeichen auf Gueltigkeit + * @return true wenn ok, false im Fehlerfall + */ + public function validate() + { + //Gesamtlaenge pruefen + if(mb_strlen($this->kennzeichentyp_kurzbz)>32) + { + $this->errormsg = 'Kennzeichentyp darf nicht länger als 32 Zeichen sein'; + return false; + } + $this->errormsg = ''; + return true; + } + + /** + * Speichert den aktuellen Datensatz in die Datenbank + * Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt + * andernfalls wird der Datensatz mit der ID in $kennzeichen_id aktualisiert + * @return true wenn ok, false im Fehlerfall + */ + public function save($new = null) + { + if(!is_null($new)) + $this->new = $new; + + //Variablen pruefen + if(!$this->validate()) + return false; + + if($this->new) + { + //Neuen Datensatz einfuegen + $qry='BEGIN;INSERT INTO public.tbl_kennzeichen (person_id, kennzeichentyp_kurzbz, inhalt, aktiv, insertamum, insertvon) VALUES('. + $this->db_add_param($this->person_id, FHC_INTEGER).', '. + $this->db_add_param($this->kennzeichentyp_kurzbz).', '. + $this->db_add_param($this->inhalt).', '. + $this->db_add_param($this->aktiv, FHC_BOOLEAN).', now(), '. + $this->db_add_param($this->insertvon).');'; + } + else + { + //Updaten des bestehenden Datensatzes + + //Pruefen ob kennzeichen_id eine gueltige Zahl ist + if(!is_numeric($this->kennzeichen_id)) + { + $this->errormsg = 'kennzeichen_id muss eine gueltige Zahl sein'; + return false; + } + + $qry='UPDATE public.tbl_kennzeichen SET '. + 'person_id='.$this->db_add_param($this->person_id,FHC_INTEGER).', '. + 'kennzeichentyp_kurzbz='.$this->db_add_param($this->kennzeichentyp_kurzbz).', '. + 'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '. + 'updateamum= now(), '. + 'updatevon='.$this->db_add_param($this->updatevon).' '. + 'WHERE kennzeichen_id='.$this->db_add_param($this->kennzeichen_id, FHC_INTEGER).';'; + } + + if($this->db_query($qry)) + { + //Sequence auslesen um die eingefuegte ID zu ermitteln + if($this->new) + { + $qry = "SELECT currval('public.tbl_kennzeichen_id_seq') as id;"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->kennzeichen_id = $row->id; + $this->db_query('COMMIT;'); + return true; + } + else + { + $this->errormsg = 'Fehler beim Auslesen er Sequence'; + $this->db_query('ROLLBACK;'); + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Auslesen der Sequence'; + $this->db_query('ROLLBACK;'); + return false; + } + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Speichern der Daten'; + return false; + } + } + + /** + * Laedt Kennzeichen einer Person + * @param person_id + * @param kennzeichentyp_kurzbz_arr filtern nach Kennzeichentyp + * @return boolean + */ + public function load_pers($person_id, $kennzeichentyp_kurzbz_arr) + { + if(!is_numeric($person_id)) + { + $this->errormsg = 'Person_id ist ungueltig'; + return false; + } + if(!is_array($kennzeichentyp_kurzbz_arr)) + { + $this->errormsg = 'Kennzeichen sind ungueltig'; + return false; + } + + $qry = " + SELECT + kz.kennzeichen_id, kz.person_id, kz.kennzeichentyp_kurzbz, inhalt, aktiv, updateamum, updatevon, insertamum, insertvon + FROM + public.tbl_kennzeichen kz + WHERE + person_id=".$this->db_add_param($person_id, FHC_INTEGER)." + AND aktiv = TRUE + AND kennzeichentyp_kurzbz IN (".$this->implode4SQL($kennzeichentyp_kurzbz_arr).") + ORDER BY + kz.kennzeichentyp_kurzbz, kz.kennzeichen_id;"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new kennzeichen(); + + $obj->kennzeichen_id = $row->kennzeichen_id; + $obj->person_id = $row->person_id; + $obj->kennzeichentyp_kurzbz = $row->kennzeichentyp_kurzbz; + $obj->inhalt = $row->inhalt; + $obj->aktiv = $this->db_parse_bool($row->aktiv); + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + + $this->result[] = $obj; + } + + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } +} +?> diff --git a/include/person.class.php b/include/person.class.php index 95230ef3e..f8103dd65 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -98,9 +98,9 @@ class person extends basis_db geschlecht, staatsbuergerschaft, geburtsnation, kurzbeschreibung, zugangscode, foto_sperre, matr_nr, bpk, wahlname"; if ($hasUDF = $udf->personHasUDF()) - $qry .= ", udf_values "; + $qry .= ", udf_values"; - $qry .= "FROM public.tbl_person + $qry .= " FROM public.tbl_person WHERE person_id = " . $this->db_add_param($personId, FHC_INTEGER); if (!$this->db_query($qry)) diff --git a/public/js/api/checkperson.js b/public/js/api/checkperson.js new file mode 100644 index 000000000..7cad23c3d --- /dev/null +++ b/public/js/api/checkperson.js @@ -0,0 +1,23 @@ +export default { + updatePersonUnrulyStatus(person_id, unrulyParam) { + + try { + const payload = {person_id, unruly: unrulyParam} + const url = '/api/frontend/v1/checkperson/CheckPerson/updatePersonUnrulyStatus'; + return this.$fhcApi.post(url, payload, null); + } catch (error) { + throw error; + } + + }, + filterPerson(payload, base = ''){ + + try { + const url = base + '/api/frontend/v1/checkperson/CheckPerson/filterPerson'; + return axios.post(url, payload) + } catch (error) { + throw error; + } + + } +} \ No newline at end of file diff --git a/public/js/api/fhcapifactory.js b/public/js/api/fhcapifactory.js index 655bfa409..e30772ca7 100644 --- a/public/js/api/fhcapifactory.js +++ b/public/js/api/fhcapifactory.js @@ -23,6 +23,7 @@ import studstatus from "./studstatus.js"; import stv from "./stv.js"; import notiz from "./notiz.js"; import betriebsmittel from "./betriebsmittel.js"; +import checkperson from "./checkperson.js"; export default { search, @@ -32,5 +33,6 @@ export default { studstatus, stv, notiz, - betriebsmittel -}; + betriebsmittel, + checkperson +}; \ No newline at end of file diff --git a/public/js/components/Studierendenantrag/Antrag.js b/public/js/components/Studierendenantrag/Antrag.js index 197fe2206..b04801075 100644 --- a/public/js/components/Studierendenantrag/Antrag.js +++ b/public/js/components/Studierendenantrag/Antrag.js @@ -55,4 +55,4 @@ export default { ` -} +} \ No newline at end of file diff --git a/public/js/components/Studierendenantrag/Form/Abmeldung.js b/public/js/components/Studierendenantrag/Form/Abmeldung.js index 1660957c5..7486f9095 100644 --- a/public/js/components/Studierendenantrag/Form/Abmeldung.js +++ b/public/js/components/Studierendenantrag/Form/Abmeldung.js @@ -77,6 +77,7 @@ export default { this.formData.grund ) .then(result => { + if (result.data === true) document.location += ""; @@ -259,4 +260,4 @@ export default { ` -} +} \ No newline at end of file diff --git a/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js b/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js index 004f6f4d0..450769362 100644 --- a/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js +++ b/public/js/components/Studierendenantrag/Form/AbmeldungStgl.js @@ -26,7 +26,8 @@ export default { saving: false, formData: { grund: '' - } + }, + unrulyInternal: false } }, computed: { @@ -77,6 +78,16 @@ export default { this.formData.grund ) .then(result => { + + if(this.unrulyInternal) { + this.$fhcApi.factory.checkperson.updatePersonUnrulyStatus(this.data.person_id, true).then( + (res)=> { + if(res?.meta?.status === "success") { + this.$fhcAlert.alertSuccess(this.$p.t('studierendenantrag', 'antrag_unruly_updated')) + } + }) + } + if (result.data === true) document.location += ""; @@ -106,11 +117,16 @@ export default { this.formData.grund = event.target.value ? this.$p.t('studierendenantrag', event.target.value) : ''; - }, + } }, created() { this.uuid = _uuid++; }, + watch: { + 'formData.grund'(newVal) { + this.unrulyInternal = (newVal === this.$p.t('studierendenantrag', 'textLong_unruly')) + } + }, template: `
@@ -172,7 +188,11 @@ export default { + +
` -} +} \ No newline at end of file diff --git a/public/js/infocenter/infocenterDetails.js b/public/js/infocenter/infocenterDetails.js index 186479a8f..35da8f584 100644 --- a/public/js/infocenter/infocenterDetails.js +++ b/public/js/infocenter/infocenterDetails.js @@ -847,4 +847,4 @@ var InfocenterDetails = { { return elementid.substr(elementid.indexOf("_") + 1); } -}; +}; \ No newline at end of file diff --git a/public/js/infocenter/personcheck.js b/public/js/infocenter/personcheck.js new file mode 100644 index 000000000..ad0026bac --- /dev/null +++ b/public/js/infocenter/personcheck.js @@ -0,0 +1,70 @@ +$(document).ready(function () +{ + if(viewData?.checkPerson?.unruly?.length) { + const unruly = document.getElementById('unruly') + unruly.setAttribute('style', 'display: block;') + } + + if(viewData?.checkPerson?.duplicate?.length) { + const duplicate = document.getElementById('duplicate') + duplicate.setAttribute('style', 'display: block;') + } + +}); + +var PersonCheck = { + update: function(data) + { + // format date according to db + if(data.gebdatum) { + const [day, month, year] = data.gebdatum.split('.'); + data.gebdatum = year + '-' + month + '-' + day + } + + FHC_AjaxClient.ajaxCallPost( + 'api/frontend/v1/checkperson/CheckPerson/checkUnruly', + data, + { + successCallback: function(response, textStatus, jqXHR) { + if (response?.meta?.status === 'success') + { + PersonCheck._updatedUnruly(response); + } + else + { + FHC_DialogLib.alertError('unruly error'); + } + }, + errorCallback: function() { + FHC_DialogLib.alertWarning("Fehler beim Speichern!"); + } + } + ); + + }, + + _updatedUnruly: function(response) + { + const unruly = document.getElementById('unruly') + + if(response?.data?.retval?.length) { + viewData.checkPerson.unruly = response?.data?.retval + + // replace existing elements + const unrulylist = document.getElementById('unrulylist') + const newUnrulyPeople = [] + viewData.checkPerson.unruly.forEach(u => { + newUnrulyPeople.push(document.createTextNode("Person ID: " + u.person_id)) + newUnrulyPeople.push(document.createElement('br')) + }) + unrulylist.replaceChildren(...newUnrulyPeople) + + // and show it all + unruly.setAttribute('style', 'display: block;') + } else { + // just hide everything + unruly.setAttribute('style', 'display: none;') + } + + }, +} \ No newline at end of file diff --git a/public/js/infocenter/stammdaten.js b/public/js/infocenter/stammdaten.js index d83690b04..c7600f677 100644 --- a/public/js/infocenter/stammdaten.js +++ b/public/js/infocenter/stammdaten.js @@ -14,6 +14,7 @@ $(document).ready(function () $('.saveStammdaten').click(function() { + var kontakt = []; $('.kontakt_input').each(function(){ kontakt.push({ @@ -62,15 +63,16 @@ var Stammdaten = { CALLED_PATH + "/updateStammdaten/", data, { - successCallback: function(data, textStatus, jqXHR) { - if (FHC_AjaxClient.isSuccess(data)) + successCallback: function(response, textStatus, jqXHR) { + if (FHC_AjaxClient.isSuccess(response)) { FHC_DialogLib.alertSuccess("Done!"); Stammdaten._updated(); + PersonCheck.update(data) } else { - FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + FHC_DialogLib.alertError(FHC_AjaxClient.getError(response)); } }, errorCallback: function() { @@ -149,6 +151,7 @@ var Stammdaten = { _updated: function() { + $('.kontakt_input').each(function() { var span = $(this).parent('td').children('span'); var value = $(this).val(); diff --git a/public/js/plugin/FhcAlert.js b/public/js/plugin/FhcAlert.js index 01fa12d82..b079bf98e 100644 --- a/public/js/plugin/FhcAlert.js +++ b/public/js/plugin/FhcAlert.js @@ -394,5 +394,6 @@ export default { } }; app.config.globalProperties.$fhcAlert = $fhcAlert; + app.provide('$fhcAlert', app.config.globalProperties.$fhcAlert); } } diff --git a/public/js/plugin/FhcApi.js b/public/js/plugin/FhcApi.js index 7be1a5b9f..88d2ac919 100644 --- a/public/js/plugin/FhcApi.js +++ b/public/js/plugin/FhcApi.js @@ -316,6 +316,6 @@ export default { const mergedFhcApiFactory = options?.factory ? {...FhcApiFactory, ...options.factory} : FhcApiFactory; app.config.globalProperties.$fhcApi.factory = new FhcApiFactoryWrapper(mergedFhcApiFactory); - + app.provide('$fhcApi', app.config.globalProperties.$fhcApi); } }; \ No newline at end of file diff --git a/public/js/plugin/Phrasen.js b/public/js/plugin/Phrasen.js index 277402639..5d861fce5 100644 --- a/public/js/plugin/Phrasen.js +++ b/public/js/plugin/Phrasen.js @@ -69,5 +69,6 @@ export default { loadCategory: cat => phrasen.loadCategory.call(app, cat), t_ref: phrasen.t_ref }; + app.provide('$p', app.config.globalProperties.$p); } } diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 11880fd55..658fead05 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -58,6 +58,7 @@ require_once('dbupdate_3.4/17513_Entwicklungsteam.php'); require_once('dbupdate_3.4/28575_softwarebereitstellung.php'); require_once('dbupdate_3.4/41150_oe-pfad_db_view.php'); require_once('dbupdate_3.4/44031_stv_favorites.php'); +require_once('dbupdate_3.4/40896_kennzeichnung_unruly_person.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -301,7 +302,7 @@ $tabellen=array( "public.tbl_ortraumtyp" => array("ort_kurzbz","hierarchie","raumtyp_kurzbz"), "public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen","lehre","standort","warn_semesterstunden_frei","warn_semesterstunden_fix","standort_id"), "public.tbl_organisationseinheittyp" => array("organisationseinheittyp_kurzbz", "bezeichnung", "beschreibung"), - "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk","matr_aktiv","wahlname"), + "public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre","matr_nr","zugangscode_timestamp","udf_values","bpk","matr_aktiv","wahlname","unruly"), "public.tbl_person_fotostatus" => array("person_fotostatus_id","person_id","fotostatus_kurzbz","datum","insertamum","insertvon","updateamum","updatevon"), "public.tbl_personfunktionstandort" => array("personfunktionstandort_id","funktion_kurzbz","person_id","standort_id","position","anrede"), "public.tbl_preincoming" => array("preincoming_id","person_id","mobilitaetsprogramm_code","zweck_code","firma_id","universitaet","aktiv","bachelorthesis","masterthesis","von","bis","uebernommen","insertamum","insertvon","updateamum","updatevon","anmerkung","zgv","zgv_ort","zgv_datum","zgv_name","zgvmaster","zgvmaster_datum","zgvmaster_ort","zgvmaster_name","program_name","bachelor","master","jahre","person_id_emergency","person_id_coordinator_dep","person_id_coordinator_int","code","deutschkurs1","deutschkurs2","research_area","deutschkurs3","ext_id"), @@ -477,4 +478,4 @@ if (!$result=@$db->db_query($sql_query)) } if($error==false) echo '
Gegenpruefung fehlerfrei'; -?> +?> \ No newline at end of file diff --git a/system/dbupdate_3.4/28260_vertraege.php b/system/dbupdate_3.4/28260_vertraege.php index 8fc6be05f..9ce2ba29b 100644 --- a/system/dbupdate_3.4/28260_vertraege.php +++ b/system/dbupdate_3.4/28260_vertraege.php @@ -85,6 +85,8 @@ if ($result = $db->db_query("SELECT * FROM information_schema.tables WHERE table betrag bytea, gehaltsbestandteil_id integer, mitarbeiter_uid character varying(32), + gehaltsbestandteil_von date, + gehaltsbestandteil_bis date, CONSTRAINT tbl_gehaltshistorie_pk PRIMARY KEY (gehaltshistorie_id) ); @@ -570,3 +572,37 @@ if ($result = $db->db_query("SELECT * FROM hr.tbl_vertragsart WHERE vertragsart_ echo 'Vertragsart "Dienstverhältnis zu einer anderen Bildungseinrichtung oder einem anderen Träger" erstellt.
'; } } + +if ($result = $db->db_query("SELECT * FROM information_schema.columns WHERE column_name='gehaltsbestandteil_von' AND table_name='tbl_gehaltshistorie' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " + ALTER TABLE + hr.tbl_gehaltshistorie + ADD COLUMN + gehaltsbestandteil_von date + "; + if (! $db->db_query($qry)) + echo 'Vertraege: ' . $db->db_last_error() . '
'; + else + echo 'Spalte gehaltsbestandteil_von wurde in hr.tbl_gehaltshistorie neu erstellt
'; + } +} + +if ($result = $db->db_query("SELECT * FROM information_schema.columns WHERE column_name='gehaltsbestandteil_bis' AND table_name='tbl_gehaltshistorie' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " + ALTER TABLE + hr.tbl_gehaltshistorie + ADD COLUMN + gehaltsbestandteil_bis date + "; + if (! $db->db_query($qry)) + echo 'Vertraege: ' . $db->db_last_error() . '
'; + else + echo 'Spalte gehaltsbestandteil_bis wurde in hr.tbl_gehaltshistorie neu erstellt
'; + } +} \ No newline at end of file diff --git a/system/dbupdate_3.4/40896_kennzeichnung_unruly_person.php b/system/dbupdate_3.4/40896_kennzeichnung_unruly_person.php new file mode 100644 index 000000000..32c01502c --- /dev/null +++ b/system/dbupdate_3.4/40896_kennzeichnung_unruly_person.php @@ -0,0 +1,17 @@ +db_query("SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' + AND table_name = 'tbl_person' AND column_name = 'unruly'")) +{ + if($db->db_num_rows($result) === 0) + { + $qry = "ALTER TABLE tbl_person ADD COLUMN unruly BOOLEAN NOT NULL DEFAULT FALSE"; + + if(!$db->db_query($qry)) + echo 'Public Tabelle person: '.$db->db_last_error().'
'; + else + echo '
spalte unruly hinzugefuegt'; + } +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index a8d80a4af..925f88bba 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -2662,6 +2662,26 @@ $phrases = array( ) ) ), + array( + 'app' => 'core', + 'category' => 'person', + 'phrase' => 'unruly', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Unruly', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Unruly', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'person', @@ -5321,6 +5341,26 @@ The invoice will be sent to you again. The amount is only to be trans ) ) ), + array( + 'app' => 'infocenter', + 'category' => 'infocenter', + 'phrase' => 'unrulyPersonFound', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Unruly Person wurde gefunden', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Unruly Person detected', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'password', @@ -21190,6 +21230,46 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'studierendenantrag', + 'phrase' => 'antrag_unruly', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Unruly', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Unruly', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'studierendenantrag', + 'phrase' => 'antrag_unruly_updated', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Unruly Person Status wurde aktualisiert.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Unruly person status has been updated.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'studierendenantrag', @@ -23531,6 +23611,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'studierendenantrag', + 'phrase' => 'textLong_unruly', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Person ist unruly', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Person is unruly', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'studierendenantrag', @@ -23711,6 +23811,46 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'studierendenantrag', + 'phrase' => 'dropdown_unruly', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Person ist unruly.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Person is unruly.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'studierendenantrag', + 'phrase' => 'mark_person_as_unruly', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Person ist unruly.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Person is unruly.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'notiz', diff --git a/vilesci/cronjobs/bpk.php b/vilesci/cronjobs/bpk.php index 3a7ac4395..75af4f9f8 100644 --- a/vilesci/cronjobs/bpk.php +++ b/vilesci/cronjobs/bpk.php @@ -27,6 +27,7 @@ require_once(dirname(__FILE__).'/../../include/basis_db.class.php'); require_once(dirname(__FILE__).'/../../include/dvb.class.php'); require_once(dirname(__FILE__).'/../../include/benutzerberechtigung.class.php'); require_once(dirname(__FILE__).'/../../include/datum.class.php'); +require_once(dirname(__FILE__).'/../../include/kennzeichen.class.php'); require_once(dirname(__FILE__).'/../../include/errorhandler.class.php'); if (!$db = new basis_db()) @@ -34,6 +35,7 @@ if (!$db = new basis_db()) $limit = ''; $debug = false; +$vbpkTypes = defined('VBPK_TYPES') && is_array(VBPK_TYPES) ? VBPK_TYPES : null; // Wenn das Script nicht ueber Commandline gestartet wird, muss eine // Authentifizierung stattfinden @@ -85,8 +87,27 @@ if (defined('BPK_FUER_ALLE_BENUTZER_ABFRAGEN') && BPK_FUER_ALLE_BENUTZER_ABFRAGE JOIN public.tbl_benutzer USING(person_id) WHERE public.tbl_benutzer.aktiv = true - AND tbl_person.bpk is null - AND gebdatum is not null"; + AND + ( + tbl_person.bpk is null"; + + // checken, ob vBpks fehlen + if (isset($vbpkTypes)) + { + $qry .= + " OR ( + SELECT + COUNT(DISTINCT kennzeichentyp_kurzbz) + FROM + public.tbl_kennzeichen + WHERE + person_id = tbl_person.person_id + AND kennzeichentyp_kurzbz IN (".$db->implode4SQL($vbpkTypes).") + ) < ".$db->db_add_param(count($vbpkTypes), FHC_INTEGER); + } + + $qry .= + ") AND gebdatum is not null"; } else { @@ -100,8 +121,27 @@ else WHERE public.tbl_benutzer.aktiv = true AND tbl_person.matr_nr is not null - AND tbl_person.bpk is null - AND studiengang_kz<10000 + AND + ( + tbl_person.bpk is null"; + + // checken, ob vBpks fehlen + if (isset($vbpkTypes)) + { + $qry .= + " OR ( + SELECT + COUNT(DISTINCT kennzeichentyp_kurzbz) + FROM + public.tbl_kennzeichen + WHERE + person_id = tbl_person.person_id + AND kennzeichentyp_kurzbz IN (".$db->implode4SQL($vbpkTypes).") + ) < ".$db->db_add_param(count($vbpkTypes), FHC_INTEGER); + } + + $qry .= + ") AND studiengang_kz<10000 AND EXISTS(SELECT 1 FROM public.tbl_prestudent WHERE person_id=tbl_person.person_id AND bismelden=true) AND gebdatum is not null"; } @@ -135,6 +175,50 @@ if ($result = $db->db_query($qry)) echo ' OK'; else echo ' Failed: '.$person->errormsg; + + $vbpkErrors = array(); + + // alle existierenden vBpks einer Person holen + $kennzeichenTypes = new kennzeichen(); + if ($kennzeichenTypes->load_pers($row->person_id, $vbpkTypes)) + { + $existingVbpks = $kennzeichenTypes->result; + + foreach ($data->retval->vbpks as $vbpkType => $vbpkValue) + { + $new = true; + foreach ($existingVbpks as $existingVbpk) + { + // nicht speichern, wenn vBpk bereits vorhanden + if ($existingVbpk->kennzeichentyp_kurzbz == $vbpkType) + { + $new = false; + break; + } + } + + if (!$new) continue; + + // neue vBpk speichern + $kennzeichen = new kennzeichen(); + + $kennzeichen->person_id = $row->person_id; + $kennzeichen->kennzeichentyp_kurzbz = $vbpkType; + $kennzeichen->inhalt = $vbpkValue; + $kennzeichen->aktiv = true; + $kennzeichen->insertvon = 'bpkJob'; + + if (!$kennzeichen->save()) + { + $vbpkErrors[] = 'Failed to save vBpk '.$vbpkType.':'.$kennzeichen->errormsg; + } + } + } + + if (count($vbpkErrors) > 0) + { + echo implode('; ', $vbpkErrors); + } } } else diff --git a/vilesci/stammdaten/reihungstestverwaltung.php b/vilesci/stammdaten/reihungstestverwaltung.php index 038c1977d..07e88183c 100644 --- a/vilesci/stammdaten/reihungstestverwaltung.php +++ b/vilesci/stammdaten/reihungstestverwaltung.php @@ -256,9 +256,9 @@ if(isset($_GET['excel'])) SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester WHERE studiensemester_kurzbz = rt.studiensemester_kurzbz - + UNION - + ( SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester @@ -269,9 +269,9 @@ if(isset($_GET['excel'])) ) ORDER BY ende DESC LIMIT 1 ) - + UNION - + ( SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester @@ -820,8 +820,8 @@ if(isset($_GET['excel'])) Reihungstest - - @@ -951,15 +951,15 @@ if(isset($_GET['excel'])) }); $("#studienplan_autocomplete").autocomplete({ - source: function(request, response) + source: function(request, response) { - $.getJSON("reihungstestverwaltung_autocomplete.php", - { + $.getJSON("reihungstestverwaltung_autocomplete.php", + { autocomplete: 'studienplan', aktiv: 'true', studiensemester_kurzbz: $('#studiensemester_dropdown').val(), term: request.term - }, + }, response); }, minLength:2, @@ -1247,7 +1247,7 @@ if(isset($_GET['excel'])) }); window.location.href = "mailto:?bcc="+mailadressen; } - + function SendMessage() { // Wenn Checkboxen markiert sind, an diese senden, sonst an alle @@ -1411,7 +1411,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren'])) $reihungstest->insertvon = $user; $reihungstest->insertamum = date('Y-m-d H:i:s'); } - + // OE über Studiengang des Reihungstests laden und Berechtigung prüfen $stg_rechtecheck = new studiengang($reihungstest->studiengang_kz); if(!$rechte->isBerechtigt('lehre/reihungstest', $stg_rechtecheck->oe_kurzbz, 'sui')) @@ -1439,7 +1439,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren'])) $error = true; } } - + if (isset($_POST['zugangs_ueberpruefung']) && $_POST['zugangcode'] === '') { $messageError .= '

Der Zugangscode muss ausgefüllt sein, wenn die Zugangsüberprüfung aktiviert ist.

'; @@ -1548,7 +1548,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren'])) $rt_stpl->new = true; $rt_stpl->reihungstest_id = $reihungstest->reihungstest_id; $rt_stpl->studienplan_id = $studienplan; - + if (!in_array($studienplan, $rt_stplaeneArray)) { if (!$rt_stpl->saveStudienplanReihungstest()) @@ -1572,7 +1572,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren'])) $rt_studienplan = new reihungstest(); $rt_studienplan->getStudienplaeneReihungstest($_POST['reihungstest_id']); $error = false; - foreach ($rt_studienplan->result as $row) + foreach ($rt_studienplan->result as $row) { $rtKopieStudienplan = new reihungstest(); $rtKopieStudienplan->new = true; @@ -1609,7 +1609,7 @@ if(isset($_POST['speichern']) || isset($_POST['kopieren'])) { $messageSuccess .= '

Der Termin wurde erfolgreich kopiert

'; } - else + else { $messageSuccess .= '

Neuer Reihungstesttermin erfolgreich angelegt

'; } @@ -1666,14 +1666,14 @@ if(isset($_POST['raumzuteilung_speichern'])) { die($raumzuteilung->errormsg); } - + // OE über Studiengang des Reihungstests laden und Berechtigung prüfen $stg_rechtecheck = new studiengang($raumzuteilung->studiengang_kz); if(!$rechte->isBerechtigt('lehre/reihungstest', $stg_rechtecheck->oe_kurzbz, 'su')) { die($rechte->errormsg); } - + if (isset($_POST['checkbox'])) { $person_ids = $_POST['checkbox']; @@ -1914,7 +1914,7 @@ if(isset($_GET['type']) && $_GET['type']=='auffuellen') { die($rechte->errormsg); } - + $orte = new Reihungstest(); $orte->getOrteReihungstest($reihungstest_id); @@ -2001,7 +2001,7 @@ if(isset($_POST['aufsicht']) && $_POST['aufsicht']!='' && !isset($_POST['kopiere { die($rechte->errormsg); } - + //Reihungstest laden if(!$save_aufsicht->load($_POST['reihungstest_id'])) { @@ -2047,7 +2047,7 @@ if(isset($_POST['delete_ort'])) { die($rechte->errormsg); } - + $delete_ort = new reihungstest(); $delete_ort->getPersonReihungstestOrt($_POST['reihungstest_id'], $_POST['delete_ort']); @@ -2119,7 +2119,7 @@ echo "'; } - + if ($stg_kz == '') $stg_kz = $row->studiengang_kz; if ($row->studiengang_kz == $stg_kz) $selected = 'selected'; else $selected = ''; - + echo "" . "\n"; $typ = $row->typ; } @@ -2293,7 +2293,7 @@ $studienplaene_list = implode(',', array_keys($studienplaene_arr)); @@ -2575,7 +2577,7 @@ $studienplaene_list = implode(',', array_keys($studienplaene_arr)); - isBerechtigt('lehre/reihungstest', $stg_rechtecheck->oe_kurzbz, 'sui')) @@ -2588,7 +2590,7 @@ $studienplaene_list = implode(',', array_keys($studienplaene_arr)); { echo ''; } - + if($rechte->isBerechtigt('lehre/reihungstest', $stg_rechtecheck->oe_kurzbz, 'suid')) { $anzahl_teilnehmer = new reihungstest(); @@ -2701,9 +2703,9 @@ if($reihungstest_id!='') SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester WHERE studiensemester_kurzbz = rt.studiensemester_kurzbz - + UNION - + ( SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester @@ -2714,9 +2716,9 @@ if($reihungstest_id!='') ) ORDER BY ende DESC LIMIT 1 ) - + UNION - + ( SELECT studiensemester_kurzbz FROM PUBLIC.tbl_studiensemester @@ -3152,7 +3154,7 @@ if($reihungstest_id!='') echo ''; } } -} +} /** * Liefert die interne Empfangsadresse des Studiengangs fuer den Mailversand. @@ -3168,18 +3170,18 @@ if($reihungstest_id!='') function getMailEmpfaenger($studiengang_kz, $studienplan_id = null, $orgform_kurzbz = null) { $studiengang = new studiengang($studiengang_kz); - + if ($studienplan_id != '') { $studienplan = new studienplan(); $studienplan->loadStudienplan($studienplan_id); } - + $empf_array = array(); $empfaenger = ''; if(defined('BEWERBERTOOL_BEWERBUNG_EMPFAENGER')) $empf_array = unserialize(BEWERBERTOOL_BEWERBUNG_EMPFAENGER); - + // Umgehung für FHTW. Ausprogrammiert im Code if(defined('BEWERBERTOOL_MAILEMPFANG') && BEWERBERTOOL_MAILEMPFANG != '') { @@ -3199,7 +3201,7 @@ function getMailEmpfaenger($studiengang_kz, $studienplan_id = null, $orgform_kur } else $empfaenger = $studiengang->email; - + if ($empfaenger != '') return $empfaenger; else