diff --git a/application/controllers/codex/UHSTAT1.php b/application/controllers/codex/UHSTAT1.php new file mode 100644 index 000000000..6bbd4d4f8 --- /dev/null +++ b/application/controllers/codex/UHSTAT1.php @@ -0,0 +1,438 @@ +load->library('form_validation'); + + // load ci helpers + $this->load->helper(array('form', 'url')); + + // load libraries + $this->load->library('AuthLib'); + $this->load->library('PermissionLib'); + + // load models + $this->load->model('codex/Oehbeitrag_model', 'OehbeitragModel'); + $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + $this->load->model('system/Sprache_model', 'SpracheModel'); + $this->load->model('codex/Abschluss_model', 'AbschlussModel'); + $this->load->model('codex/Uhstat1daten_model', 'Uhstat1datenModel'); + + $this->loadPhrases( + array( + 'ui', + 'uhstat' + ) + ); + + $this->_uid = getAuthUID(); + + // set form field information + $this->_uhstat1Fields = array( + 'mutter_geburtsstaat' => array('name' => 'Geburtsstaat Mutter'), + 'mutter_geburtsjahr' => array('name' => 'Geburtsjahr Mutter'), + 'mutter_bildungsstaat' => array('name' => 'Bildungsstaat Mutter'), + 'mutter_bildungmax' => array( + 'name' => 'Geburtsjahr Mutter', + 'rules' => array( + 'callback_bildungsstaat_bildungmax_check[m]' => array( + 'bildungsstaat_bildungmax_check' => $this->p->t('uhstat', 'ausbildungBildungsstaatUebereinstimmung') + ) + ) + ), + 'vater_geburtsstaat' => array('name' => 'Geburtsstaat Vater'), + 'vater_geburtsjahr' => array('name' => 'Geburtsjahr Vater'), + 'vater_bildungsstaat' => array('name' => 'Bildungsstaat Vater'), + 'vater_bildungmax' => array('name' => 'Geburtsjahr Vater'), + 'vater_bildungmax' => array( + 'name' => 'Geburtsjahr Vater', + 'rules' => array( + 'callback_bildungsstaat_bildungmax_check[v]' => array( + 'bildungsstaat_bildungmax_check' => $this->p->t('uhstat', 'ausbildungBildungsstaatUebereinstimmung') + ) + ) + ) + ); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + + public function index() + { + $formMetaData = $this->_getFormMetaData(); + + if (isError($formMetaData)) show_error(getError($formMetaData)); + + if (!hasData($formMetaData)) show_error("No form meta data could be loaded"); + + $uhstatData = $this->_getUHSTAT1Data(); + + if (isError($uhstatData)) show_error(getError($uhstatData)); + + $this->load->view("codex/uhstat1.php", array( + 'formMetaData' => getData($formMetaData), + 'uhstatData' => getData($uhstatData) + ) + ); + } + + /** + * Add or update UHSTAT1 data + */ + public function saveUHSTAT1Data() + { + $saved = false; + + $person_id = $this->_getValidPersonId('sui'); + + $this->form_validation->set_error_delimiters('', ''); + + foreach ($this->_uhstat1Fields as $field => $params) + { + // all fields are required + $ruleNames = 'required'; + $ruleMessages = array('required' => $this->p->t('uhstat', 'angabeFehlt')); + + // add additional rules + if (isset($params['rules'])) + { + foreach ($params['rules'] as $ruleName => $ruleMessage) + { + $ruleNames .= '|'.$ruleName; + $ruleMessages = array_merge($ruleMessages, $ruleMessage); + } + } + + $this->form_validation->set_rules( + $field, + $params['name'], + $ruleNames, + $ruleMessages + ); + } + + $uhstat1datenRes = null; + if ($this->form_validation->run()) // if valid + { + // get post fields + $uhstatData = array(); + foreach ($this->_uhstat1Fields as $field => $params) + { + $uhstatData[$field] = $this->input->post($field); + } + + // check if entry already exists + $uhstat1datenloadRes = $this->Uhstat1datenModel->loadWhere(array('person_id' => $person_id)); + + // if yes, update + if (hasData($uhstat1datenloadRes)) + { + $uhstatData['updateamum'] = 'NOW()'; + $uhstatData['updatevon'] = $this->_uid; + $uhstat1datenRes = $this->Uhstat1datenModel->update( + array('person_id' => $person_id), + $uhstatData + ); + } + else // otherwise insert + { + $uhstatData['insertamum'] = 'NOW()'; + $uhstatData['insertvon'] = $this->_uid; + $uhstat1datenRes = $this->Uhstat1datenModel->insert( + array_merge($uhstatData, array('person_id' => $person_id)) + ); + } + } + + $formMetaData = $this->_getFormMetaData(); + + if (isError($formMetaData)) show_error(getError($formMetaData)); + + if (!hasData($formMetaData)) show_error("No form meta data could be loaded"); + + $successMessage = ''; + $errorMessage = ''; + // pass success/error messages to view + if (isset($uhstat1datenRes)) + { + if (isSuccess($uhstat1datenRes)) + { + $successMessage = $this->p->t('uhstat', 'erfolgreichGespeichert'); + $saved = true; + } + else + $errorMessage = $this->p->t('uhstat', 'fehlerBeimSpeichern'); + } + + // load view with form data + $this->load->view("codex/uhstat1.php", array( + 'formMetaData' => getData($formMetaData), + 'saved' => $saved, + 'successMessage' => $successMessage, + 'errorMessage' => $errorMessage + ) + ); + } + + /** + * Check callback for Bildungsstaat - if Bildungsstaat is Austria, a highest education should be in Austria. + * @param $bildungmax + * @param $bildungsstaat_typ - mother (m) or father (v) + * @return bool true if valid, false otherwise + */ + public function bildungsstaat_bildungmax_check($bildungmax, $bildungsstaat_typ) + { + // valid if no type passed + if (!isset($bildungsstaat_typ) || !isset($bildungmax)) return true; + + // get correct input + if ($bildungsstaat_typ == 'm') // mutter + $bildungsstaat = $this->input->post('mutter_bildungsstaat'); + elseif ($bildungsstaat_typ == 'v') // vater + $bildungsstaat = $this->input->post('vater_bildungsstaat'); + else + return true; + + if (!isset($bildungsstaat)) return true; + + // find out if abschluss is in Austria + $this->AbschlussModel->addSelect("in_oesterreich"); + $abschlussRes = $this->AbschlussModel->load($bildungmax); + + if (hasData($abschlussRes)) + { + $in_oesterreich = getData($abschlussRes)[0]->in_oesterreich; + // invalid if abschluss in Austria, but not Bildungsstaat, or abschluss not in Austria, but Bildungsstaat in Austria + return ($in_oesterreich && $bildungsstaat == self::CODEX_OESTERREICH) || (!$in_oesterreich && $bildungsstaat != self::CODEX_OESTERREICH); + } + + return false; + } + + /** + * Deletes UHSTAT1 entry. + */ + public function deleteUHSTAT1Data() + { + $saved = false; + + // uhstat data can only be deleted with permission + if (!$this->_checkPermission('suid')) show_error('no permission'); + + $person_id = $this->_getValidPersonId('suid'); + + $uhstat1datenRes = $this->Uhstat1datenModel->delete( + array('person_id' => $person_id) + ); + + $formMetaData = $this->_getFormMetaData(); + + if (isError($formMetaData)) show_error(getError($formMetaData)); + + if (!hasData($formMetaData)) show_error("No form meta data could be loaded"); + + $successMessage = ''; + $errorMessage = ''; + // pass success/error messages to view + if (isset($uhstat1datenRes)) + { + if (isSuccess($uhstat1datenRes)) + { + $successMessage = $this->p->t('uhstat', 'erfolgreichGeloescht'); + } + else + $errorMessage = $this->p->t('uhstat', 'fehlerBeimLoeschen'); + } + + // load view with form data + $this->load->view("codex/uhstat1.php", array( + 'formMetaData' => getData($formMetaData), + 'successMessage' => $successMessage, + 'errorMessage' => $errorMessage + ) + ); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Gets initial data needed to display UHSTAT1 form. + */ + private function _getFormMetaData() + { + $person_id = $this->_getValidPersonId('s'); + + // read only display param + $readOnly = $this->input->get('readOnly'); + + // depending on permissions, editing or deleting is possible + $editPermission = $this->_checkPermission('sui'); + $deletePermission = $this->_checkPermission('suid'); + + $languageIdx = $this->_getLanguageIndex(); + + $formMetaData = array( + 'nation' => array(), + 'abschluss_oesterreich' => array(), + 'abschluss_nicht_oesterreich' => array(), + 'jahre' => array(), + 'person_id' => $person_id, + 'editPermission' => $editPermission, + 'deletePermission' => $deletePermission, + 'readOnly' => $readOnly + ); + + // get person data + $this->load->model('person/Person_model', 'PersonModel'); + $this->PersonModel->addSelect("vorname, nachname"); + $personRes = $this->PersonModel->load($person_id); + + if (isError($personRes)) return $personRes; + + if (hasData($personRes)) + { + $person = getData($personRes)[0]; + $formMetaData['vorname'] = $person->vorname; + $formMetaData['nachname'] = $person->nachname; + } + + $nationTextFieldName = $languageIdx == 1 ? 'langtext' : 'engltext'; + + // get nation list + $this->load->model('codex/Nation_model', 'NationModel'); + + $this->NationModel->addSelect("nation_code, $nationTextFieldName AS nation_text"); + $this->NationModel->addOrder("nation_text"); + $nationRes = $this->NationModel->load(); + + if (isError($nationRes)) return $nationRes; + + if (hasData($nationRes)) + { + $nations = getData($nationRes); + + // put austria in beginning of selection + foreach ($nations as $nation) + { + if ($nation->nation_code == self::CODEX_OESTERREICH) array_unshift($nations, $nation); + } + + $formMetaData['nation'] = $nations; + } + + // get abschluss list + $abschlussRes = $this->AbschlussModel->getActiveAbschluesse($languageIdx); + + if (isError($abschlussRes)) return $abschlussRes; + + $abschlussData = getData($abschlussRes); + + if (hasData($abschlussRes)) + { + foreach (getData($abschlussRes) as $abschluss) + { + if ($abschluss->in_oesterreich === true) + $formMetaData['abschluss_oesterreich'][] = $abschluss; + elseif ($abschluss->in_oesterreich === false) + $formMetaData['abschluss_nicht_oesterreich'][] = $abschluss; + else + { + $formMetaData['abschluss_oesterreich'][] = $abschluss; + $formMetaData['abschluss_nicht_oesterreich'][] = $abschluss; + } + } + } + + // get realistic birth years, dated back from current year + $currYear = date("Y"); + $formMetaData['jahre'] = range($currYear - self::UPPER_BOUNDARY_YEARS, $currYear - self::LOWER_BOUNDARY_YEARS); + + return success($formMetaData); + } + + /** + * Gets initial data needed to display UHSTAT1 form. + */ + private function _getUHSTAT1Data() + { + $person_id = $this->_getValidPersonId('s'); + + $this->Uhstat1datenModel->addSelect( + implode(', ', array_keys($this->_uhstat1Fields)) + ); + $uhstatRes = $this->Uhstat1datenModel->loadWhere(array('person_id' => $person_id)); + + if (isError($uhstatRes)) return $uhstatRes; + + return success(hasData($uhstatRes) ? getData($uhstatRes)[0] : null); + } + + /** + * Gets language index of currently logged in user. + * @return int (the index, start at 1) + */ + private function _getLanguageIndex() + { + $idx = 1; + $this->SpracheModel->addSelect('index'); + $langRes = $this->SpracheModel->loadWhere(array('sprache' => getUserLanguage())); + + if (hasData($langRes)) + { + $idx = getData($langRes)[0]->index; + } + + return $idx; + } + + /** + * Gets Id of person having permissions to manage UHSTAT1 data. + * Can be passed as parameter or be in session. + * @return int person_id + */ + private function _getValidPersonId($berechtigungsArt) + { + // if coming from bewerbungstool - person id is in session (person must be logged in bewerbungstool) + if (isset($_SESSION[self::PERSON_ID_SESSION_INDEX]) && is_numeric($_SESSION[self::PERSON_ID_SESSION_INDEX])) + return $_SESSION[self::PERSON_ID_SESSION_INDEX]; + + // if person id passed directly... + $person_id = $this->input->post('person_id'); + if (!isset($person_id)) $person_id = $this->input->get('person_id'); + + if (!isset($person_id) || !is_numeric($person_id)) show_error("invalid person id"); + + // ...check if there is a permission for editing UHSTAT1 data + if ($this->_checkPermission($berechtigungsArt)) return $person_id; + + show_error("No permission"); + } + + /** + * Checks if logged user has the UHSTAT management permission. + * @param $art - type of permission, e.g. suid for full permissions + * @return bool + */ + private function _checkPermission($art) + { + return $this->permissionlib->isBerechtigt(self::BERECHTIGUNG_UHSTAT_VERWALTEN, $art); + } +} diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php index 7aae80d54..5784830b6 100644 --- a/application/controllers/jobs/AnrechnungJob.php +++ b/application/controllers/jobs/AnrechnungJob.php @@ -37,6 +37,9 @@ class AnrechnungJob extends JOB_Controller $this->load->helper('hlp_sancho_helper'); $this->load->library('AnrechnungLib'); + + // Load configs + $this->load->config('anrechnung'); } /** @@ -213,7 +216,7 @@ class AnrechnungJob extends JOB_Controller 'datentabelle' => $anrechnungen_table, 'link' => anchor($url, 'Anrechnungsanträge Übersicht') ); - + // Send mail sendSanchoMail( 'AnrechnungAntragStellen', @@ -227,6 +230,82 @@ class AnrechnungJob extends JOB_Controller $this->logInfo('SUCCEDED: Sending emails to STGL about yesterdays new Anrechnungen succeded.'); } + // Send Sancho mail to LV-Leitung (fallback Lectors) that were requested for recommendation yesterday. + public function sendMailRecommendationRequests(){ + + $this->logInfo('Start AnrechnungJob sendMailRecommendationRequests to inform lecturers about yesterdays requests for recommendation.'); + + // Get Anrechnungen, für die gestern eine Empfehlung angefragt worden ist + $this->AnrechnungModel->addSelect('astat.anrechnung_id, astat.datum, astat.insertamum'); + $this->AnrechnungModel->addDistinct('astat.anrechnung_id'); + $this->AnrechnungModel->addJoin('lehre.tbl_anrechnung_anrechnungstatus astat', 'anrechnung_id'); + + $result = $this->AnrechnungModel->loadWhere(' + studiensemester_kurzbz = (SELECT studiensemester_kurzbz FROM tbl_studiensemester WHERE now()::date BETWEEN start AND ende) + AND genehmigt_von IS NULL + AND empfehlung_anrechnung IS NULL + AND status_kurzbz = '. $this->db->escape(self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR) .' -- in Bearbeitung durch Lektor + AND NOW()::date = (astat.datum + interval \'1 day\') -- nur gestrige Empfehlungsanfrage + ORDER BY astat.anrechnung_id, astat.datum DESC, astat.insertamum DESC -- nur letzten status dabei prüfen + '); + + // Exit, wenn es gestern keine Empfehlungsanfragen gab + if (!hasData($result)) + { + $this->logInfo('End AnrechnungJob sendMailRecommendationRequests, because no recommendations were requested yesterday.'); + exit; + } + + $anrechnung_id_arr = array_column(getData($result), 'anrechnung_id'); + + $arr_lvLector_arr = array(); + foreach ($anrechnung_id_arr as $anrechnung_id) + { + // Get full name of Fachbereichsleitung or LV Leitung. + if($this->config->item('fbl') === TRUE) + { + $arr_lvLector_arr[] = $this->anrechnunglib->getLeitungOfLvOe($anrechnung_id); + } + else + { + $arr_lvLector_arr[] = $this->anrechnunglib->getLectors($anrechnung_id); // Returns LV Leitung. If not present, then all lectors of LV. + } + } + + // Unique lector array to send only one mail per lector + $arr_lvLector_arr = array_unique($arr_lvLector_arr, SORT_REGULAR); + + // Link to 'Anrechnungen prüfen' dashboard + $url = + CIS_ROOT. 'cis/index.php?menu='. + CIS_ROOT. 'cis/menu.php?content_id=&content='. + CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI; + + foreach ($arr_lvLector_arr as $lvLector_arr) + { + foreach ($lvLector_arr as $lector) + { + // Prepare mail content + $fields = array( + 'vorname' => $lector->vorname, + 'stgl_name' => 'Die Studiengangsleitung', + 'link' => anchor($url, 'Anrechnungsanträge Übersicht') + ); + + // Send mail + sendSanchoMail( + 'AnrechnungEmpfehlungAnfordern', + $fields, + $lector->uid. '@'. DOMAIN, + 'Deine Empfehlung wird benötigt zur Anerkennung nachgewiesener Kenntnisse' + ); + } + } + + $this->logInfo('SUCCEDED AnrechnungJob sendMailRecommendationRequests'); + + } + /** * Send Sancho mail to students, whose Anrechnungen were approved 24 hours ago. */ @@ -308,7 +387,7 @@ class AnrechnungJob extends JOB_Controller $db = new DB_Model(); $result = $db->execReadOnlyQuery($qry); - + // Exit if there are no rejected Anrechnungen if (!hasData($result)) { @@ -361,9 +440,9 @@ html; $result = $this->AnrechnungModel->loadWhere(' studiensemester_kurzbz = ( - SELECT studiensemester_kurzbz FROM tbl_studiensemester WHERE now()::date BETWEEN start AND ende) + SELECT studiensemester_kurzbz FROM tbl_studiensemester WHERE now()::date BETWEEN start AND ende ) - AND genehmigt_von IS NULL + AND genehmigt_von IS NULL AND empfehlung_anrechnung IS NULL AND status_kurzbz = '. $this->db->escape(self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR) .' -- in Bearbeitung durch Lektor AND NOW()::date = (astat.datum + interval \'1 week\') -- eine Woche nach Empfehlungsanfrage @@ -376,7 +455,7 @@ html; $this->logInfo('End AnrechnungJob sendMailRemindRecommendation, because no recommendations to be done.'); exit; } - + $anrechnung_id_arr = array_column(getData($result), 'anrechnung_id'); $arr_lvLector_arr = array(); @@ -435,7 +514,7 @@ html; 'vorname' => $stgl->vorname ); } - + return $stglMailAdress_arr; } // If not available, get assistance mail address diff --git a/application/controllers/jobs/ReihungstestJob.php b/application/controllers/jobs/ReihungstestJob.php index ab6c429a0..431ac5b04 100644 --- a/application/controllers/jobs/ReihungstestJob.php +++ b/application/controllers/jobs/ReihungstestJob.php @@ -3,6 +3,9 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); class ReihungstestJob extends JOB_Controller { + + const LAST_DAYS_PRESTUDENTSTATUS = 5; + /** * Constructor */ @@ -826,7 +829,7 @@ class ReihungstestJob extends JOB_Controller AND tbl_studiengang.typ IN ('b', 'm') ) SELECT * FROM prst - WHERE prestudenstatus_datum >= (SELECT CURRENT_DATE - 1) + WHERE prestudenstatus_datum >= (SELECT CURRENT_DATE - ". self::LAST_DAYS_PRESTUDENTSTATUS .") AND (studiengang_typ = 'b' OR (studiengang_typ = 'm' AND EXISTS (SELECT 1 /* Master Studiengänge berücksichtigen wenn auch Bachelor im gleichen Semester */ FROM prst prstb WHERE studiengang_typ = 'b' @@ -868,7 +871,8 @@ class ReihungstestJob extends JOB_Controller tbl_person.nachname, tbl_person.vorname, tbl_prestudent.*, - tbl_studiengang.typ AS studiengang_typ + tbl_studiengang.typ AS studiengang_typ, + tbl_prestudentstatus.datum FROM PUBLIC.tbl_person JOIN PUBLIC.tbl_prestudent USING (person_id) JOIN PUBLIC.tbl_prestudentstatus USING (prestudent_id) @@ -901,7 +905,7 @@ class ReihungstestJob extends JOB_Controller $mailArray[$rowNiedrPrios->studiengang_kz][$rowNiedrPrios->orgform_kurzbz]['AufnahmeHoeherePrio'][] = $rowNiedrPrios->nachname.' '.$rowNiedrPrios->vorname.' ('.$rowNiedrPrios->prestudent_id.')'; } - elseif ($rowNiedrPrios->laststatus == 'Bewerber') + elseif ($rowNiedrPrios->laststatus == 'Bewerber' && $row_ps->prestudenstatus_datum > $rowNiedrPrios->datum) { // Abgewiesenen-Status mit Statusgrund "Aufnahme anderer Studiengang" (ID 5) setzen $lastStatus = $this->PrestudentstatusModel->getLastStatus($rowNiedrPrios->prestudent_id); @@ -927,7 +931,7 @@ class ReihungstestJob extends JOB_Controller = $rowNiedrPrios->nachname.' '.$rowNiedrPrios->vorname.' ('.$rowNiedrPrios->prestudent_id.')'; } } - elseif ($rowNiedrPrios->laststatus == 'Wartender') + elseif ($rowNiedrPrios->laststatus == 'Wartender' && $row_ps->prestudenstatus_datum > $rowNiedrPrios->datum) { // Abgewiesenen-Status mit Statusgrund "Aufnahme anderer Studiengang" (ID 5) setzen // Mail zur Info an Assistenz schicken diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 8f71dc8d0..3a62ff7d9 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -242,7 +242,7 @@ class approveAnrechnungDetail extends Auth_Controller $empfehlungsanfrage_an = !isEmptyArray($result) ? implode(', ', array_column($result, 'fullname')) : ''; // Request Recommendation - if($this->anrechnunglib->requestRecommendation($anrechnung_id)) + if ($this->anrechnunglib->requestRecommendation($anrechnung_id)) { $retval[]= array( 'anrechnung_id' => $anrechnung_id, @@ -254,31 +254,23 @@ class approveAnrechnungDetail extends Auth_Controller ); } - /** - * Send mails to lectors - * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector - * even if they are required for more recommendations - * */ - if (!isEmptyArray($retval)) - { - if ($this->config->item('send_mail') === TRUE) - { - $this->_sendSanchoMailToLectors($anrechnung_id); - } - - // Output json to ajax - return $this->outputJsonSuccess($retval); - } - // Output json to ajax + if ($empfehlungsanfrage_an == '') + { + $this->terminateWithJsonError( + "Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt." + ); + } + if (isEmptyArray($retval)) { - $this->terminateWithJsonError( - "Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt." - ); + $this->terminateWithJsonError("Empfehlung wurde nicht angefordert"); } - - $this->terminateWithJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); + else + { + // Output json to ajax + return $this->outputJsonSuccess($retval); + } } /** diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index f13814e66..b5a44b8f6 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -249,19 +249,6 @@ class approveAnrechnungUebersicht extends Auth_Controller } } - /** - * Send mails - * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector - * even if they are required for more recommendations - * */ - if (!isEmptyArray($retval)) - { - if ($this->config->item('send_mail') === TRUE) - { - $this->_sendSanchoMail($retval); - } - } - // Output json to ajax if (isEmptyArray($retval)) { @@ -273,7 +260,7 @@ class approveAnrechnungUebersicht extends Auth_Controller $this->terminateWithJsonError('Es wurden keine Empfehlungen angefordert'); } - return $this->outputJsonSuccess($retval); + $this->outputJsonSuccess($retval); } /** diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index e9059720b..1922bacda 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -111,6 +111,8 @@ class requestAnrechnung extends Auth_Controller $lehrveranstaltung_id = $this->input->post('lv_id'); $studiensemester_kurzbz = $this->input->post('studiensemester'); $bestaetigung = $this->input->post('bestaetigung'); + $begruendung_ects = $this->input->post('begruendung_ects'); + $begruendung_lvinhalt = $this->input->post('begruendung_lvinhalt'); // Validate data if (empty($_FILES['uploadfile']['name'])) @@ -121,7 +123,9 @@ class requestAnrechnung extends Auth_Controller if (isEmptyString($begruendung_id) || isEmptyString($anmerkung) || isEmptyString($lehrveranstaltung_id) || - isEmptyString($studiensemester_kurzbz)) + isEmptyString($studiensemester_kurzbz) || + isEmptyString($begruendung_ects) || + isEmptyString($begruendung_lvinhalt)) { return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen')); } @@ -172,7 +176,9 @@ class requestAnrechnung extends Auth_Controller $lehrveranstaltung_id, $begruendung_id, $lastInsert_dms_id, - $anmerkung + $anmerkung, + $begruendung_ects, + $begruendung_lvinhalt ); if (isError($result)) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 548b071d3..cf0c6755a 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -21,6 +21,7 @@ class InfoCenter extends Auth_Controller const FREIGEGEBEN_PAGE = 'freigegeben'; const REIHUNGSTESTABSOLVIERT_PAGE = 'reihungstestAbsolviert'; const ABGEWIESEN_PAGE = 'abgewiesen'; + const AUFGENOMMEN_PAGE = 'aufgenommen'; const SHOW_DETAILS_PAGE = 'showDetails'; const SHOW_ZGV_DETAILS_PAGE = 'showZGVDetails'; const ZGV_UBERPRUEFUNG_PAGE = 'ZGVUeberpruefung'; @@ -115,6 +116,7 @@ class InfoCenter extends Auth_Controller 'index' => 'infocenter:r', 'freigegeben' => 'infocenter:r', 'abgewiesen' => 'infocenter:r', + 'aufgenommen' => 'infocenter:r', 'reihungstestAbsolviert' => 'infocenter:r', 'showDetails' => 'infocenter:r', 'showZGVDetails' => 'lehre/zgvpruefung:r', @@ -228,6 +230,16 @@ class InfoCenter extends Auth_Controller $this->load->view('system/infocenter/infocenterAbgewiesen.php'); } + + /** + * Aufgenommene page of the InfoCenter tool + */ + public function aufgenommen() + { + $this->_setNavigationMenu(self::AUFGENOMMEN_PAGE); // define the navigation menu for this page + + $this->load->view('system/infocenter/infocenterAufgenommen.php'); + } /** * @@ -314,7 +326,7 @@ class InfoCenter extends Auth_Controller show_error('Person does not exist!'); $origin_page = $this->input->get(self::ORIGIN_PAGE); - if ($origin_page == self::INDEX_PAGE) + if (in_array($origin_page, array(self::INDEX_PAGE, self::ABGEWIESEN_PAGE))) { // mark person as locked for editing $result = $this->PersonLockModel->lockPerson($person_id, $this->_uid, self::APP); @@ -359,7 +371,14 @@ class InfoCenter extends Auth_Controller if (isError($result)) show_error(getError($result)); - $redirectLink = '/'.self::INFOCENTER_URI.'?'.self::FHC_CONTROLLER_ID.'='.$this->getControllerId(); + $origin_page = $this->input->get(self::ORIGIN_PAGE); + + if ($origin_page === self::ABGEWIESEN_PAGE) + $redirectLink = self::INFOCENTER_URI. '/' .self::ABGEWIESEN_PAGE; + else + $redirectLink = '/'.self::INFOCENTER_URI; + + $redirectLink .= '?'.self::FHC_CONTROLLER_ID.'='.$this->getControllerId(); // Force reload of Dataset after Unlock $redirectLink .= '&'.self::KEEP_TABLESORTER_FILTER.'=true'; @@ -1526,6 +1545,7 @@ class InfoCenter extends Auth_Controller $freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE); $reihungstestAbsolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE); $abgewiesenLink = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE); + $aufgenommenLink = site_url(self::INFOCENTER_URI.'/'.self::AUFGENOMMEN_PAGE); $currentFilterId = $this->input->get(self::FILTER_ID); if (isset($currentFilterId)) @@ -1533,6 +1553,7 @@ class InfoCenter extends Auth_Controller $freigegebenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; $reihungstestAbsolviertLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; $abgewiesenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; + $aufgenommenLink .= '?'.self::PREV_FILTER_ID.'='.$currentFilterId; } $this->navigationlib->setSessionMenu( @@ -1583,7 +1604,19 @@ class InfoCenter extends Auth_Controller null, // subscriptLinkValue '', // target 30 // sort - ) + ), + 'aufgenommen' => $this->navigationlib->oneLevel( + 'Aufgenommene', // description + $aufgenommenLink, // link + null, // children + 'check', // icon + null, // subscriptDescription + false, // expand + null, // subscriptLinkClass + null, // subscriptLinkValue + '', // target + 40 // sort + ), ) ); } @@ -1611,6 +1644,9 @@ class InfoCenter extends Auth_Controller if ($origin_page === self::ABGEWIESEN_PAGE) $link = site_url(self::INFOCENTER_URI.'/'.self::ABGEWIESEN_PAGE); + if ($origin_page === self::AUFGENOMMEN_PAGE) + $link = site_url(self::INFOCENTER_URI.'/'.self::AUFGENOMMEN_PAGE); + $prevFilterId = $this->input->get(self::PREV_FILTER_ID); if (isset($prevFilterId)) { diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index d8c4b1fd3..8ee1891b5 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -174,6 +174,8 @@ class AnrechnungLib $anrechnung_data->insertvon = ''; $anrechnung_data->studiensemester_kurzbz = ''; $anrechnung_data->empfehlung = ''; + $anrechnung_data->begruendung_ects = ''; + $anrechnung_data->begruendung_lvinhalt = ''; $anrechnung_data->status_kurzbz = ''; $anrechnung_data->status = getUserLanguage() == 'German' ? 'neu' : 'new'; $anrechnung_data->dokumentname = ''; @@ -894,6 +896,8 @@ class AnrechnungLib $anrechnung_data->insertvon= $anrechnung->insertvon; $anrechnung_data->studiensemester_kurzbz= $anrechnung->studiensemester_kurzbz; $anrechnung_data->empfehlung= $anrechnung->empfehlung_anrechnung; + $anrechnung_data->begruendung_ects = $anrechnung->begruendung_ects; + $anrechnung_data->begruendung_lvinhalt = $anrechnung->begruendung_lvinhalt; // Get last status_kurzbz $result = $this->ci->AnrechnungModel->getLastAnrechnungstatus($anrechnung->anrechnung_id); diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index dbbc22f08..60dd52342 100644 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -182,6 +182,7 @@ class MailLib { if ($this->sended == $this->email_number_per_time_range) { + $this->sended = 0; sleep($this->email_time_range); // Wait!!! } } diff --git a/application/libraries/issues/plausichecks/GbDatumWeitZurueck.php b/application/libraries/issues/plausichecks/GbDatumWeitZurueck.php index a9e9f817a..04e1cf97b 100644 --- a/application/libraries/issues/plausichecks/GbDatumWeitZurueck.php +++ b/application/libraries/issues/plausichecks/GbDatumWeitZurueck.php @@ -85,6 +85,12 @@ class GbDatumWeitZurueck extends PlausiChecker $params[] = $studiengang_kz; } + if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz)) + { + $qry .= " AND stg.studiengang_kz NOT IN ?"; + $params[] = $exkludierte_studiengang_kz; + } + $qry .= ")"; if (isset($person_id)) @@ -93,12 +99,6 @@ class GbDatumWeitZurueck extends PlausiChecker $params[] = $person_id; } - if (isset($exkludierte_studiengang_kz) && !isEmptyArray($exkludierte_studiengang_kz)) - { - $qry .= " AND stg.studiengang_kz NOT IN ?"; - $params[] = $exkludierte_studiengang_kz; - } - return $this->_db->execReadOnlyQuery($qry, $params); } } diff --git a/application/models/codex/Abschluss_model.php b/application/models/codex/Abschluss_model.php new file mode 100644 index 000000000..2907deff1 --- /dev/null +++ b/application/models/codex/Abschluss_model.php @@ -0,0 +1,30 @@ +dbTable = 'bis.tbl_abschluss'; + $this->pk = 'ausbildung_code'; + } + + public function getActiveAbschluesse($languageIndex) + { + return $this->execQuery( + ' + SELECT + ausbildung_code, bezeichnung[?], in_oesterreich + FROM + bis.tbl_abschluss + WHERE + aktiv + ORDER BY + CASE WHEN in_oesterreich THEN 0 ELSE 1 END, ausbildung_code', + array($languageIndex) + ); + } +} diff --git a/application/models/codex/Uhstat1daten_model.php b/application/models/codex/Uhstat1daten_model.php new file mode 100644 index 000000000..9bca44b58 --- /dev/null +++ b/application/models/codex/Uhstat1daten_model.php @@ -0,0 +1,14 @@ +dbTable = 'bis.tbl_uhstat1daten'; + $this->pk = 'uhstat1daten_id'; + } +} diff --git a/application/models/education/Anrechnung_model.php b/application/models/education/Anrechnung_model.php index ebecf4118..cbfdb6607 100644 --- a/application/models/education/Anrechnung_model.php +++ b/application/models/education/Anrechnung_model.php @@ -30,7 +30,7 @@ class Anrechnung_model extends DB_Model */ public function createAnrechnungsantrag( $prestudent_id, $studiensemester_kurzbz, $lehrveranstaltung_id, - $begruendung_id, $dms_id, $anmerkung_student = null + $begruendung_id, $dms_id, $anmerkung_student = null, $begruendung_ects = null, $begruendung_lvinhalt = null ) { // Start DB transaction @@ -44,6 +44,8 @@ class Anrechnung_model extends DB_Model 'dms_id' => $dms_id, 'studiensemester_kurzbz' => $studiensemester_kurzbz, 'anmerkung_student' => $anmerkung_student, + 'begruendung_ects' => $begruendung_ects, + 'begruendung_lvinhalt' => $begruendung_lvinhalt, 'insertvon' => $this->_uid )); diff --git a/application/models/organisation/Studiensemester_model.php b/application/models/organisation/Studiensemester_model.php index bb9b94c92..45a4eac7c 100644 --- a/application/models/organisation/Studiensemester_model.php +++ b/application/models/organisation/Studiensemester_model.php @@ -204,4 +204,14 @@ class Studiensemester_model extends DB_Model return $this->execQuery($query, array($studiensemester_kurzbz)); } + + public function getAktAndFutureSemester() + { + $query = 'SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE start >= NOW() OR (start <= NOW() AND ende >= NOW()) + ORDER BY start'; + + return $this->execQuery($query); + } } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index b946ad11f..2063505bf 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -326,10 +326,12 @@ class Person_model extends DB_Model SELECT p2.person_id FROM tbl_person p1 + JOIN tbl_prestudent ps ON p1.person_id = ps.person_id INNER JOIN ( - SELECT vorname, nachname, gebdatum, person_id - FROM tbl_person - ) p2 + SELECT vorname, nachname, gebdatum, person.person_id + FROM tbl_person person + JOIN tbl_prestudent sps ON person.person_id = sps.person_id + ) p2 ON (lower(p1.vorname) = lower(p2.vorname) AND lower(p1.nachname) = lower(p2.nachname) AND p1.gebdatum = p2.gebdatum) WHERE p1.person_id != p2.person_id AND (p1.person_id = ?)"; diff --git a/application/views/codex/uhstat1.php b/application/views/codex/uhstat1.php new file mode 100644 index 000000000..a09f9c70a --- /dev/null +++ b/application/views/codex/uhstat1.php @@ -0,0 +1,274 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'UHSTAT1Formular', + 'jquery3' => true, + 'bootstrap3' => true, + 'fontawesome4' => true, + 'phrases' => array( + 'ui' => array('speichern') + ), + 'customCSSs' => array('public/css/codex/uhstat1.css'), + 'customJSs' => array('public/js/codex/uhstat1.js') + ) +); +?> +mutter_geburtsjahr) ? $uhstatData->mutter_geburtsjahr : set_value('mutter_geburtsjahr'); +$mutter_geburtsstaat = isset($uhstatData->mutter_geburtsstaat) ? $uhstatData->mutter_geburtsstaat : set_value('mutter_geburtsstaat'); +$mutter_bildungsstaat = isset($uhstatData->mutter_bildungsstaat) ? $uhstatData->mutter_bildungsstaat : set_value('mutter_bildungsstaat'); +$mutter_bildungmax = isset($uhstatData->mutter_bildungmax) ? $uhstatData->mutter_bildungmax : set_value('mutter_bildungmax'); +$vater_geburtsjahr = isset($uhstatData->vater_geburtsjahr) ? $uhstatData->vater_geburtsjahr : set_value('vater_geburtsjahr'); +$vater_geburtsstaat = isset($uhstatData->vater_geburtsstaat) ? $uhstatData->vater_geburtsstaat : set_value('vater_geburtsstaat'); +$vater_bildungsstaat = isset($uhstatData->vater_bildungsstaat) ? $uhstatData->vater_bildungsstaat : set_value('vater_bildungsstaat'); +$vater_bildungmax = isset($uhstatData->vater_bildungmax) ? $uhstatData->vater_bildungmax : set_value('vater_bildungmax'); +$readOnly = isset($formMetaData['readOnly']); +$disabled = $readOnly ? ' disabled' : ''; +$editPermission = isset($formMetaData['editPermission']) && $formMetaData['editPermission'] === true; +$deletePermission = isset($formMetaData['deletePermission']) && $formMetaData['deletePermission'] === true; +$saved = isset($saved) && $saved === true; +?> + +
+

+ +

+
+ +

p->t('uhstat', 'uhstat1AnmeldungUeberschrift') ?>

+

+ p->t('uhstat', 'rechtsbelehrung') ?> +

+

+ p->t('uhstat', 'uhstat1AnmeldungEinleitungstext') ?> +

+
+ + +
+ + +
+ + +
+ + +
+ ' /> +
+ p->t('uhstat', 'angabenErziehungsberechtigte') ?> +

+ p->t('uhstat', 'angabenErziehungsberechtigteEinleitungstext') ?> +

+
+

p->t('uhstat', 'erziehungsberechtigtePersonEins') ?>

+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+

p->t('uhstat', 'erziehungsberechtigtePersonZwei') ?>

+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+
+
+
+ +
+
+
+ +
+ +
+ ' /> +
+
+ +
+
+
+ +
+
+ +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 87b9d53cc..0970b6edd 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -92,85 +92,93 @@ $this->load->view(
-
+
- + - + - + - + - + - - -
p->t('person', 'studentIn')); ?>p->t('person', 'studentIn')); ?> vorname . ' ' . $antragData->nachname; ?>
p->t('person', 'personenkennzeichen'); ?>p->t('person', 'personenkennzeichen'); ?> matrikelnr ?>
p->t('lehre', 'studiensemester')); ?>p->t('lehre', 'studiensemester')); ?> studiensemester_kurzbz ?>
p->t('lehre', 'studiengang')); ?>p->t('lehre', 'studiengang')); ?> stg_bezeichnung ?>
p->t('lehre', 'lehrveranstaltung'); ?>p->t('lehre', 'lehrveranstaltung'); ?> lv_bezeichnung ?>
-
-
- - - - - - - - + + + + + + + + - + + +
p->t('lehre', 'ects'); ?>ects ?>
- p->t('anrechnung', 'bisherAngerechneteEcts'); ?> + p->t('lehre', 'lektorInnen'); ?> + lektoren) - 1 ?> + lektoren as $key => $lektor): ?> + vorname . ' ' . $lektor->nachname; + echo $key === $len ? '' : ', ' ?> + +
p->t('lehre', 'ects'); ?>ects ?>
+ p->t('anrechnung', 'bisherAngerechneteEcts'); ?> + Total: sumEctsSchulisch + $antragData->sumEctsBeruflich, 1) ?> [Schulisch: sumEctsSchulisch ?> / Beruflich: sumEctsBeruflich ?> ] - +
+
+
+ + + - - - - - - + + - + - - + + + + + + + + +
p->t('lehre', 'lektorInnen'); ?> - lektoren) - 1 ?> - lektoren as $key => $lektor): ?> - vorname . ' ' . $lektor->nachname; - echo $key === $len ? '' : ', ' ?> - -
p->t('global', 'zgv')); ?>zgv ?>p->t('global', 'zgv')); ?>zgv ?>
p->t('anrechnung', 'herkunftDerKenntnisse'); ?>anmerkung ?>anmerkung ?>
p->t('anrechnung', 'nachweisdokumente'); ?> + dokumentname) ?>
p->t('global', 'begruendung'); ?>begruendung ?>begruendung ?>
p->t('anrechnung', 'begruendungEctsLabel'); ?>begruendung_ects ?>
p->t('anrechnung', 'begruendungLvinhaltLabel'); ?>begruendung_lvinhalt ?>
diff --git a/application/views/lehre/anrechnung/requestAnrechnung.php b/application/views/lehre/anrechnung/requestAnrechnung.php index cfd9058f5..18fd66a67 100644 --- a/application/views/lehre/anrechnung/requestAnrechnung.php +++ b/application/views/lehre/anrechnung/requestAnrechnung.php @@ -1,5 +1,8 @@ load->view( 'templates/FHC-Header', @@ -197,6 +200,46 @@ $this->load->view(
+ +
+
+
+
+ p->t('anrechnung', 'begruendungEcts'); ?>  + + + +
+
+ + p->t('ui', 'maxZeichen'); ?> : +
+
+
+
+ +
+
+
+
+ p->t('anrechnung', 'begruendungLvinhalt'); ?>  + + + +
+
+ +  / p->t('ui', 'maxZeichen'); ?> : + p->t('ui', 'fehlendeMinZeichen'); ?> : +
+
+
+
@@ -242,8 +285,8 @@ $this->load->view(
- p->t('ui', 'maxZeichen'); ?> : + maxlength="" required>anmerkung; ?> + p->t('ui', 'maxZeichen'); ?> :
diff --git a/application/views/lehre/anrechnung/requestAnrechnungImportant.php b/application/views/lehre/anrechnung/requestAnrechnungImportant.php index d157b22c2..8cacb9c26 100644 --- a/application/views/lehre/anrechnung/requestAnrechnungImportant.php +++ b/application/views/lehre/anrechnung/requestAnrechnungImportant.php @@ -16,6 +16,23 @@ + +
+ +
+
+ p->t('anrechnung', 'requestAnrechnungInfoEctsBerechnungBody'); ?> +
+
+
-
+
- + - + - + - + - + - -
p->t('person', 'studentIn')); ?>p->t('person', 'studentIn')); ?> vorname . ' ' . $antragData->nachname; ?>
p->t('person', 'personenkennzeichen'); ?>p->t('person', 'personenkennzeichen'); ?> matrikelnr ?>
p->t('lehre', 'studiensemester')); ?>p->t('lehre', 'studiensemester')); ?> studiensemester_kurzbz ?>
p->t('lehre', 'studiengang')); ?>p->t('lehre', 'studiengang')); ?> stg_bezeichnung ?>
p->t('lehre', 'lehrveranstaltung'); ?>p->t('lehre', 'lehrveranstaltung'); ?> lv_bezeichnung ?>
-
-
- - - - - - - - - + + + + + + - + + + +
p->t('lehre', 'ects'); ?>ects ?>
p->t('lehre', 'lektorInnen'); ?> +
p->t('lehre', 'ects'); ?>ects ?>
p->t('lehre', 'lektorInnen'); ?> lektoren) - 1 ?> lektoren as $key => $lektor): ?> vorname . ' ' . $lektor->nachname; echo $key === $len ? '' : ', ' ?> -
+
+
+ + + @@ -142,6 +143,14 @@ $this->load->view( target="_blank">dokumentname) ?> + + + + + + + +
p->t('global', 'zgv')); ?> zgv ?>
p->t('anrechnung', 'begruendungEctsLabel'); ?>begruendung_ects ?>
p->t('anrechnung', 'begruendungLvinhaltLabel'); ?>begruendung_lvinhalt ?>
diff --git a/application/views/lehre/anrechnung/reviewAnrechnungInfo.php b/application/views/lehre/anrechnung/reviewAnrechnungInfo.php index 4b899d4dc..7e658ffcb 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungInfo.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungInfo.php @@ -15,6 +15,22 @@
+
+ +
+
+ p->t('anrechnung', 'requestAnrechnungInfoEctsBerechnungBody'); ?> +
+
+