diff --git a/application/config/stv.php b/application/config/stv.php index 84b148362..8942c35e6 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -88,9 +88,14 @@ if (!defined('ZGV_DOKTOR_ANZEIGEN') || !ZGV_DOKTOR_ANZEIGEN) { ); } -$config['tabs']['projektarbeit']['defaultProjektbetreuerStunden'] = '4.0'; -$config['tabs']['projektarbeit']['defaultProjektbetreuerStundenDiplom'] = '5.0'; -$config['tabs']['projektarbeit']['lvLektroinnenzuteilungFixangestelltStundensatz'] = true; +$config['tabs']['projektarbeit']['defaultProjektbetreuerStunden'] = + defined('FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_BACHELOR') + ? FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_BACHELOR + : '0.0'; +$config['tabs']['projektarbeit']['defaultProjektbetreuerStundenDiplom'] = + defined('FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_MASTER') + ? FAS_STUDIERENDE_PROJEKTARBEIT_DEFAULT_BETREUER_STUNDEN_MASTER + : '0.0'; $config['tabs']['projektarbeit']['defaultProjektbetreuerStundensatz'] = '80.0'; $config['student_tab_order'] = [ @@ -119,6 +124,7 @@ $config['student_tab_order'] = [ $config['students_tab_order'] = [ 'banking', 'status', + 'messages', 'groups', 'finalexam', 'combinePeople', diff --git a/application/controllers/NeueNachricht.php b/application/controllers/NeueNachricht.php index 9b61b78ef..b0ff5c554 100644 --- a/application/controllers/NeueNachricht.php +++ b/application/controllers/NeueNachricht.php @@ -20,11 +20,18 @@ class NeueNachricht extends Auth_Controller */ public function _remap() { + $typeid = $this->input->post('typeid'); + $ids = ($this->input->post('ids') && strpos($this->input->post('ids'), ',')) + ? explode(',', $this->input->post('ids')) + : $this->input->post('ids'); + //now working $this->load->view('Nachrichten', [ 'permissions' => [ 'assistenz_schreibrechte' => $this->permissionlib->isBerechtigt('assistenz','suid'), - ] + ], + 'ids' => $ids, + 'typeid' => $typeid ]); } } diff --git a/application/controllers/Studentenverwaltung.php b/application/controllers/Studentenverwaltung.php index 2ce19c58a..3fba97e91 100644 --- a/application/controllers/Studentenverwaltung.php +++ b/application/controllers/Studentenverwaltung.php @@ -32,6 +32,10 @@ class Studentenverwaltung extends Auth_Controller 'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'), 'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht'), 'system/change_outputformat' => $this->permissionlib->getOE_isEntitledFor('system/change_outputformat'), + 'student/editBakkZgv' => $this->permissionlib->isBerechtigt('student/editBakkZgv'), + 'student/editMakkZgv' => $this->permissionlib->isBerechtigt('student/editMakkZgv'), + 'student/editDokZgv' => $this->permissionlib->isBerechtigt('student/editDokZgv'), + 'student/editBismelden' => $this->permissionlib->isBerechtigt('student/editBismelden') ], 'variables' => [ 'semester_aktuell' => $this->variablelib->getVar('semester_aktuell') diff --git a/application/controllers/api/frontend/v1/Documents.php b/application/controllers/api/frontend/v1/Documents.php index 2d2c410cf..7b2fc4a15 100644 --- a/application/controllers/api/frontend/v1/Documents.php +++ b/application/controllers/api/frontend/v1/Documents.php @@ -442,6 +442,10 @@ class Documents extends FHCAPI_Controller 'betreuerart_kurzbz', 'studiensemester_kurzbz' ] as $key) { + if (in_array($xsl, array('Ausbildungsver', 'AusbVerEng')) && $key === 'uid') + { + continue; + } $value = $this->input->post_get($key); if ($value !== null) $params .= '&' . $key . '=' . urlencode($value); diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index 355fe79a4..3035e532d 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -1,6 +1,5 @@ ['admin:r', 'assistenz:r'], 'getMsgVarsLoggedInUser' => ['admin:r', 'assistenz:r'], 'getNameOfDefaultRecipient' => ['admin:r', 'assistenz:r'], + 'getNameOfDefaultRecipients' => ['admin:r', 'assistenz:r'], 'sendMessage' => ['admin:r', 'assistenz:r'], 'deleteMessage' => ['admin:r', 'assistenz:r'], 'getDataVorlage' => ['admin:r', 'assistenz:r'], @@ -21,6 +21,7 @@ class Messages extends FHCAPI_Controller 'getReplyData' => ['admin:r', 'assistenz:r'], 'getPersonId' => ['admin:r', 'assistenz:r'], 'getUid' => ['admin:r', 'assistenz:r'], + 'getUids' => ['admin:r', 'assistenz:r'], ]); //Load Models @@ -37,7 +38,7 @@ class Messages extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ - 'ui' + 'ui', 'messages' ]); } @@ -101,22 +102,49 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($vorlage); } - public function getMessageVarsPerson($id, $typeId) + public function getMessageVarsPerson($typeId) { - $person_id = ($typeId == 'mitarbeiter_uid') ? $this->_getPersonId($id, $typeId) : $id; - $result = $this->MessageModel->getMsgVarsDataByPersonId($person_id); - $data = $this->getDataOrTerminateWithError($result); + $ids = $this->input->post('ids'); + $messageVarsPerson = []; - $this->terminateWithSuccess($data); + foreach ($ids as $id) + { + $person_id = ($typeId == 'mitarbeiter_uid') ? $this->_getPersonId($id, $typeId) : $id; + $result = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + $data = $this->getDataOrTerminateWithError($result); + $messageVarsPerson[] = current($data); + } + + $this->terminateWithSuccess($messageVarsPerson); } - public function getMsgVarsPrestudent($id, $typeId) + public function getMsgVarsPrestudent($typeId) { - $prestudent_id = ($typeId == 'uid') ? $this->_getPrestudentIdFromUid($id) : $id; - $result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); - $data = $this->getDataOrTerminateWithError($result); + $ids = $this->input->post('ids'); + if(!is_array($ids)) { + $ids = array($ids); + } + $messageVarsPrestudent = []; - $this->terminateWithSuccess($data); + if($typeId == 'uid') + { + $prestudent_ids = []; + foreach ($ids as $id) + { + $prestudent_ids[] = $this->_getPrestudentIdFromUid($id); + } + } + else + $prestudent_ids = $ids; + + foreach ($prestudent_ids as $prestudent_id) + { + $result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); + $data = $this->getDataOrTerminateWithError($result); + $messageVarsPrestudent[] = current($data); + } + + $this->terminateWithSuccess($messageVarsPrestudent); } public function getMsgVarsLoggedInUser() @@ -127,27 +155,45 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($data); } - public function getNameOfDefaultRecipient($id, $type_id) + public function getNameOfDefaultRecipients($type_id) { - $id = ($type_id != 'person_id') ? $this->_getPersonId($id, $type_id) : $id; + $ids = $this->input->post('ids'); + if(!is_array($ids)) { + $ids = array($ids); + } + $recipients = []; + + if (empty($ids)) { + + throw new InvalidArgumentException($this->p->t('ui', 'errorMissingOrInvalidParameters', ['parameter'=> 'Id(s)']), self::ERROR_TYPE_GENERAL); + } $this->load->model('person/Person_model', 'PersonModel'); + if($type_id != 'person_id'){ + foreach ($ids as $id) + { + $person_id = $this->_getPersonId($id, $type_id); + $result = $this->PersonModel->load($person_id); + $data = $this->getDataOrTerminateWithError($result); + $name = current($data); + $recipients[$id] = $name->vorname . " " . $name->nachname; + } + } + else { + foreach ($ids as $id) { + $result = $this->PersonModel->load($id); + $data = $this->getDataOrTerminateWithError($result); + $name = current($data); + $recipients[$id] = $name->vorname . " " . $name->nachname; + } + } - $result = $this->PersonModel->load($id); - $data = $this->getDataOrTerminateWithError($result); - $name = current($data); - - $this->terminateWithSuccess($name->vorname . " " . $name->nachname ); + $this->terminateWithSuccess($recipients); } - public function sendMessage($recipient_id) + public function sendMessage($typeId) { - //has to be uid - // $this->terminateWithError("uid", $recipient_id, self::ERROR_TYPE_GENERAL); - - //default setting - $receiversPersonId = $this->_getPersonId($recipient_id, 'uid'); - + $resultReturn = []; $uid = getAuthUID(); $this->load->model('person/Benutzer_model', 'BenutzerModel'); $result = $this->BenutzerModel->loadWhere( @@ -185,47 +231,61 @@ class Messages extends FHCAPI_Controller $body = $this->input->post('body'); $relationmessage_id = $this->input->post('relationmessage_id'); - $typeId = $this->input->post('type_id'); - $id = $this->input->post('id'); - - if($typeId == 'uid') + if (isset($_POST['ids'])) { - $prestudent_id = $this-> _getPrestudentIdFromUid($id); - - //parseMessagetext for variables Prestudent - $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - } - if($typeId == 'mitarbeiter_uid') - { - $person_id = $this->_getPersonId($id, $typeId); - - $result = $this->MessagesModel->parseMessageTextPerson($person_id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - $this->terminateWithError($bodyParsed, self::ERROR_TYPE_GENERAL); - - } - elseif($typeId == 'person_id') - { - $result = $this->MessagesModel->parseMessageTextPerson($id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - } - elseif($typeId == 'prestudent_id') - { - $result = $this->MessagesModel->parseMessageTextPrestudent($id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - } - else - { - $this->terminateWithError("type_id " . $typeId . " not valid", self::ERROR_TYPE_GENERAL); + $ids = json_decode($_POST['ids']); + unset($_POST['ids']); + foreach ($data as $k => $v) { + $_POST[$k] = $v; + } } - $result = $this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id); + if (!is_array($ids)) { + $ids = [$ids]; + } - $this->terminateWithSuccess($result); + foreach ($ids as $id) + { + $receiversPersonId = $typeId == "person_id" ? $id : $this->_getPersonId($id, $typeId); + + if($typeId == 'uid') + { + $prestudent_id = $this-> _getPrestudentIdFromUid($id); + + $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body); + $bodyParsed = $this->getDataOrTerminateWithError($result); + } + if($typeId == 'mitarbeiter_uid') + { + $person_id = $this->_getPersonId($id, $typeId); + + $result = $this->MessagesModel->parseMessageTextPerson($person_id, $body); + $bodyParsed = $this->getDataOrTerminateWithError($result); + } + elseif($typeId == 'person_id') + { + $result = $this->MessagesModel->parseMessageTextPerson($id, $body); + $bodyParsed = $this->getDataOrTerminateWithError($result); + } + elseif($typeId == 'prestudent_id') + { + $result = $this->MessagesModel->parseMessageTextPrestudent($id, $body); + $bodyParsed = $this->getDataOrTerminateWithError($result); + } + else + { + $this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL); + } + + $result =$this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id); + $data = $this->getDataOrTerminateWithError($result); + $resultReturn[] = current($data); + + } + $this->terminateWithSuccess($resultReturn); } - public function getPreviewText($id, $type_id) + public function getPreviewText($type_id) { if (isset($_POST['data'])) { @@ -233,39 +293,60 @@ class Messages extends FHCAPI_Controller unset($_POST['data']); } else - $this->terminateWithError("Textbody missing ", self::ERROR_TYPE_GENERAL); + $this->terminateWithError($this->p->t('messages', 'errorMissingOrInvalidParameters', ['parameter'=> "Textbody"]), self::ERROR_TYPE_GENERAL); - switch($type_id) + if (isset($_POST['ids'])) { - case 'uid': - $prestudent_id = $this->_getPrestudentIdFromUid($id); - $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data); - break; - case 'prestudent_id': - $result = $this->MessagesModel->parseMessageTextPrestudent($id, $data); - break; - case 'person_id': - $result = $this->MessagesModel->parseMessageTextPerson($id, $data); - break; - case 'mitarbeiter_uid': - { - $person_id = $this->_getPersonId($id, $type_id); - $result = $this->MessagesModel->parseMessageTextPerson($person_id, $data); - } - break; - default: - $this->terminateWithError("MESSAGES::getPreviewText logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL); - break; + $ids = json_decode($_POST['ids']); + if(!is_array($ids)) + { + $ids = array($ids); + } + unset($_POST['ids']); } + else + $this->terminateWithError($this->p->t('ui', 'errorMissingOrInvalidParameters', ['parameter'=> 'Id(s)']), self::ERROR_TYPE_GENERAL); - $bodyParsed = $this->getDataOrTerminateWithError($result); + $bodyParsed = []; + + foreach ($ids as $id) + { + switch($type_id) + { + case 'uid': + $prestudent_id = $this->_getPrestudentIdFromUid($id); + $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'prestudent_id': + $result = $this->MessagesModel->parseMessageTextPrestudent($id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'person_id': + $result = $this->MessagesModel->parseMessageTextPerson($id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'mitarbeiter_uid': + { + $person_id = $this->_getPersonId($id, $type_id); + $result = $this->MessagesModel->parseMessageTextPerson($person_id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + } + break; + default: + $this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $type_id]), self::ERROR_TYPE_GENERAL); + break; + } + } $this->terminateWithSuccess($bodyParsed); } public function getReplyData($messageId) { - //TODO(Manu) validation of messageId: if number + if (!is_numeric($messageId)) { + $this->terminateWithError($this->p->t('ui', 'error_valueNotNumeric', ['value'=> 'Message ID']), self::ERROR_TYPE_GENERAL); + } $this->MessageModel->addSelect('public.tbl_msg_message.*'); $this->MessageModel->addSelect('r.*'); @@ -288,7 +369,6 @@ class Messages extends FHCAPI_Controller $replyBody = $this->_getReplyBody($body, $dataMessage[0]->nachname, $dataMessage[0]->vorname, $dataMessage[0]->insertamum); $dataMessage[0]->replyBody = $replyBody; - $dataMessage[0]->rest = "Help Manu"; $dataMessage[0]->replySubject = $prefix . $subject; $this->terminateWithSuccess($dataMessage); @@ -336,6 +416,11 @@ class Messages extends FHCAPI_Controller ['prestudent_id' => $id] ); } + else + { + $this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL); + } + $data = $this->getDataOrTerminateWithError($result); $person = current($data); @@ -343,8 +428,11 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($person->person_id); } - public function getUid($id, $typeId) + public function getUids($typeId) { + $ids = $this->input->post('ids'); + $benutzerIds = []; + if (!$typeId) { $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Type ID']), self::ERROR_TYPE_GENERAL); @@ -352,39 +440,50 @@ class Messages extends FHCAPI_Controller elseif ($typeId == 'person_id') { $this->load->model('person/Benutzer_model', 'BenutzerModel'); - $result = $this->BenutzerModel->loadWhere( - ['person_id' => $id] - ); + foreach ($ids as $id) + { + $result = $this->BenutzerModel->loadWhere( + ['person_id' => $id] + ); + $data = $this->getDataOrTerminateWithError($result); + $benutzer = current($data); + + $benutzerIds[$id] = $benutzer->uid; + } } elseif($typeId == 'prestudent_id') { $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - $result = $this->PrestudentModel->loadWhere( - ['prestudent_id' => $id] - ); + foreach ($ids as $id) + { + $result = $this->PrestudentModel->loadWhere( + ['prestudent_id' => $id] + ); - $data = $this->getDataOrTerminateWithError($result); - $person = current($data); - $person_id = $person->person_id; + $data = $this->getDataOrTerminateWithError($result); + $person = current($data); + $person_id = $person->person_id; - $this->load->model('person/Benutzer_model', 'BenutzerModel'); - $result = $this->BenutzerModel->loadWhere( - ['person_id' => $person_id] - ); + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + $result = $this->BenutzerModel->loadWhere( + ['person_id' => $person_id] + ); + $data = $this->getDataOrTerminateWithError($result); + $benutzer = current($data); + + $benutzerIds[$id] = $benutzer->uid; + } } elseif($typeId == 'uid' || $typeId == 'mitarbeiter_uid') { - $this->terminateWithSuccess($id); + $this->terminateWithSuccess($ids); } else { - $this->terminateWithError("MESSAGES::getUID logic for type_id " . $typeId . " not defined yet", self::ERROR_TYPE_GENERAL); + $this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL); } - $data = $this->getDataOrTerminateWithError($result); - $benutzer = current($data); - - $this->terminateWithSuccess($benutzer->uid); + $this->terminateWithSuccess($benutzerIds); } private function _getPersonId($id, $typeId) @@ -403,11 +502,16 @@ class Messages extends FHCAPI_Controller ['prestudent_id' => $id] ); } + else + { + $this->terminateWithError($this->p->t('messages', 'error_missingLogic', ['type'=> $typeId]), self::ERROR_TYPE_GENERAL); + } + $data = $this->getDataOrTerminateWithError($result); if (count($data) < 1) { - $this->terminateWithError('Error: Messages API no person_id found.'); + $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL); } $person = current($data); @@ -416,7 +520,6 @@ class Messages extends FHCAPI_Controller private function _getPrestudentIdFromUid($uid) { - // $this->terminateWithError($uid, self::ERROR_TYPE_GENERAL); $this->load->model('crm/Student_model', 'StudentModel'); $result = $this->StudentModel->loadWhere( ['student_uid' => $uid] @@ -425,7 +528,7 @@ class Messages extends FHCAPI_Controller $data = $this->getDataOrTerminateWithError($result); if (count($data) < 1) { - $this->terminateWithError('Error: Messages API no prestudent_id found.'); + $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL); } $student = current($data); diff --git a/application/controllers/api/frontend/v1/organisation/Studienplan.php b/application/controllers/api/frontend/v1/organisation/Studienplan.php new file mode 100644 index 000000000..c5a69fdee --- /dev/null +++ b/application/controllers/api/frontend/v1/organisation/Studienplan.php @@ -0,0 +1,69 @@ + self::PERM_LOGGED + ]); + } + + public function getBySemester() + { + $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); + + $studiengang_kz = $this->input->get('studiengang_kz'); + $studiensemester_kurzbz = $this->input->get('studiensemester_kurzbz'); + $ausbildungssemester = $this->input->get('ausbildungssemester') ?: null; + $orgform_kurzbz = $this->input->get('orgform_kurzbz') ?: null; + + if (!$studiengang_kz || !is_numeric($studiengang_kz)) + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Studiengangskennzahl']), self::ERROR_TYPE_GENERAL); + + if (!$studiensemester_kurzbz) + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Studiensemester']), self::ERROR_TYPE_GENERAL); + + if (isset($ausbildungssemester) && !is_numeric($ausbildungssemester)) + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Ausbildungssemester']), self::ERROR_TYPE_GENERAL); + + + //~ $this->load->library('form_validation'); + + //~ $this->form_validation->set_rules('studiengang_kz', 'StudiengangKz', 'required|numeric'); + //~ $this->form_validation->set_rules('studiensemester_kurzbz', 'StudiensemesterKurbz', 'required'); + //~ $this->form_validation->set_rules('ausbildungssemester', 'Ausbildungssemester', 'numeric'); + + //~ if (!$this->form_validation->run()) + //~ { + //~ $this->addMeta('fail2', 'fail2'); + //~ return $this->terminateWithValidationErrors($this->form_validation->error_array()); + //~ } + + + $this->addMeta('stg_kz', $studiengang_kz); + $this->addMeta('sem', $studiensemester_kurzbz); + $this->addMeta('sem2', $ausbildungssemester); + $this->addMeta('org', $orgform_kurzbz); + + $result = $this->StudienplanModel->getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester, $orgform_kurzbz); + if (isError($result)) $this->terminateWithError(getError($result), self::ERROR_TYPE_DB); + + $this->terminateWithSuccess(hasData($result) ? getData($result) : []); + } +} diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 3bf48bf5b..17b360f8c 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -331,7 +331,10 @@ class Config extends FHCAPI_Controller ]; $result['status'] = [ 'title' => 'Status', - 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/MultiStatus.js') + 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/MultiStatus.js'), + 'config' => [ + 'showStatusVorruecken' => defined('STATUS_VORRUECKEN_ANZEIGEN') ? STATUS_VORRUECKEN_ANZEIGEN : true, + ] ]; $result['documents'] = [ 'title' => $this->p->t('stv', 'tab_documents'), @@ -362,7 +365,6 @@ class Config extends FHCAPI_Controller $result['messages'] = [ 'title' => $this->p->t('stv', 'tab_messages'), 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Messages.js'), - 'showOnlyWithUid' => true ]; $result['grades'] = [ @@ -512,6 +514,11 @@ class Config extends FHCAPI_Controller 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js'), ]; + $result['messages'] = [ + 'title' => $this->p->t('stv', 'tab_messages'), + 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Messages.js'), + ]; + Events::trigger('stv_conf_students', function & () use (&$result) { return $result; }); diff --git a/application/controllers/api/frontend/v1/stv/Dokumente.php b/application/controllers/api/frontend/v1/stv/Dokumente.php index 4f33405ae..8a69d28ab 100644 --- a/application/controllers/api/frontend/v1/stv/Dokumente.php +++ b/application/controllers/api/frontend/v1/stv/Dokumente.php @@ -590,8 +590,8 @@ class Dokumente extends FHCAPI_Controller $documents = [ buildDropdownEntryPrintArray("accountinfo", "Accountinfoblatt", "xml=accountinfoblatt.xml.php&xsl=AccountInfo&output=pdf", $uid, 10, null), - buildDropdownEntryPrintArray("ausbildungsvertrag", "Ausbildungsvertrag", "xml=ausbildungsvertrag.xml.php&xsl=Ausbildungsver&output=pdf", $uid, 20, null), - buildDropdownEntryPrintArray("ausbildungsvertrag_en", "Ausbildungsvertrag Zweisprachig", "xml=ausbildungsvertrag.xml.php&xsl=AusbVerEng&output=pdf", $uid, 21, null), + buildDropdownEntryPrintArray("ausbildungsvertrag", "Ausbildungsvertrag", "xml=ausbildungsvertrag.xml.php&xsl=Ausbildungsver&output=pdf&prestudent_id=$prestudent_id", null,20, null), + buildDropdownEntryPrintArray("ausbildungsvertrag_en", "Ausbildungsvertrag Zweisprachig", "xml=ausbildungsvertrag.xml.php&xsl=AusbVerEng&output=pdf&prestudent_id=$prestudent_id", null,21, null), buildDropdownEntryPrintArray("bescheid", "Bescheid (nur Voransicht)", "xml=abschlusspruefung.rdf.php&xsl_stg_kz=$studiengang_kz&xsl=Bescheid&output=pdf", $uid, 25, null), buildDropdownEntryPrintArray("diplomasupp", "Diploma Supplement (nur Voransicht)", "xml=diplomasupplement.xml.php&xsl_stg_kz=$studiengang_kz&xsl=DiplSupplement&output=pdf", $uid, 26, null), diff --git a/application/controllers/api/frontend/v1/stv/Grades.php b/application/controllers/api/frontend/v1/stv/Grades.php index dd8f53a27..128316d2b 100644 --- a/application/controllers/api/frontend/v1/stv/Grades.php +++ b/application/controllers/api/frontend/v1/stv/Grades.php @@ -60,7 +60,8 @@ class Grades extends FHCAPI_Controller { $this->load->model('codex/Note_model', 'NoteModel'); - $this->NoteModel->addOrder('note'); + $this->NoteModel->addOrder('notenwert', 'ASC'); + $this->NoteModel->addOrder('bezeichnung', 'ASC'); $result = $this->NoteModel->load(); diff --git a/application/controllers/api/frontend/v1/stv/Projektarbeit.php b/application/controllers/api/frontend/v1/stv/Projektarbeit.php index 9cc604184..8740ef3d6 100644 --- a/application/controllers/api/frontend/v1/stv/Projektarbeit.php +++ b/application/controllers/api/frontend/v1/stv/Projektarbeit.php @@ -17,7 +17,8 @@ class Projektarbeit extends FHCAPI_Controller 'getTypenProjektarbeit' => ['admin:r', 'assistenz:r'], 'getFirmen' => ['admin:r', 'assistenz:r'], 'getLehrveranstaltungen' => ['admin:r', 'assistenz:r'], - 'getNoten' => ['admin:r', 'assistenz:r'] + 'getNoten' => ['admin:r', 'assistenz:r'], + 'getStudiensemester' => ['admin:r', 'assistenz:r'] ]); // Load Libraries @@ -40,11 +41,15 @@ class Projektarbeit extends FHCAPI_Controller $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); $this->load->model('education/Note_model', 'NoteModel'); $this->load->model('education/Projektbetreuer_model', 'BetreuerModel'); + $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); // load libraries $this->load->library('PermissionLib'); } + /** + * Get projekt works for a uid. + */ public function getProjektarbeit() { $student_uid = $this->input->get('uid'); @@ -53,10 +58,7 @@ class Projektarbeit extends FHCAPI_Controller $result = $this->ProjektarbeitModel->getProjektarbeit($student_uid); - if (isError($result)) - { - $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } + if (isError($result)) $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); if (!hasData($result)) $this->terminateWithSuccess([]); @@ -79,6 +81,9 @@ class Projektarbeit extends FHCAPI_Controller $this->terminateWithSuccess($projektarbeiten); } + /** + * Load a single Projektarbeit by id. + */ public function loadProjektarbeit() { $projektarbeit_id = $this->input->get('projektarbeit_id'); @@ -101,6 +106,9 @@ class Projektarbeit extends FHCAPI_Controller $this->terminateWithSuccess(current($data)); } + /** + * Inwert a Projektarbeit. + */ public function insertProjektarbeit() { $student_uid = $this->input->post('uid'); @@ -128,6 +136,9 @@ class Projektarbeit extends FHCAPI_Controller $this->terminateWithSuccess($data); } + /** + * Update a Projektarbeit by ID. + */ public function updateProjektarbeit() { $projektarbeit_id = $this->input->post('projektarbeit_id'); @@ -157,6 +168,9 @@ class Projektarbeit extends FHCAPI_Controller $this->terminateWithSuccess($data); } + /** + * Delete Projektarbeit by ID after validation. + */ public function deleteProjektarbeit() { $projektarbeit_id = $this->input->post('projektarbeit_id'); @@ -185,6 +199,9 @@ class Projektarbeit extends FHCAPI_Controller return $this->terminateWithSuccess(current(getData($result)) ? : null); } + /** + * Get all active projekt work types. + */ public function getTypenProjektarbeit() { $result = $this->ProjekttypModel->loadWhere(['aktiv' => true]); @@ -194,6 +211,9 @@ class Projektarbeit extends FHCAPI_Controller return $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } + /** + * Gets companies by search string. + */ public function getFirmen() { $searchString = $this->input->get('searchString'); @@ -208,6 +228,9 @@ class Projektarbeit extends FHCAPI_Controller return $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } + /** + * Get Lehrveranstaltungen by params, incling lehreinheiten for a specific Studiensemester.. + */ public function getLehrveranstaltungen() { $student_uid = $this->input->get('student_uid'); @@ -218,6 +241,7 @@ class Projektarbeit extends FHCAPI_Controller if (!isset($student_uid)) $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL); if (!isset($studiensemester_kurzbz)) $this->terminateWithError('Studiensemster missing', self::ERROR_TYPE_GENERAL); + // get Lvs $lvsResult = $this->LehrveranstaltungModel->getLvsForProjektarbeit($student_uid, $studiengang_kz, $additional_lehrveranstaltung_id); if (isError($lvsResult)) return $this->terminateWithError($lvsResult, self::ERROR_TYPE_GENERAL); @@ -226,6 +250,7 @@ class Projektarbeit extends FHCAPI_Controller foreach ($lvs as $lv) { + // add Lehreinheiten for each Lv for the semester $lehreinheiten = $this->LehreinheitModel->getLesForLv( $lv->lehrveranstaltung_id, $studiensemester_kurzbz ); @@ -250,8 +275,14 @@ class Projektarbeit extends FHCAPI_Controller return $this->terminateWithSuccess($lvs); } + /** + * Get all noten. + */ public function getNoten() { + $this->NoteModel->addOrder('notenwert', 'ASC'); + $this->NoteModel->addOrder('bezeichnung', 'ASC'); + $result = $this->NoteModel->load(); if (isError($result)) return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); @@ -260,9 +291,22 @@ class Projektarbeit extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Get all Studiensemester, sorted. + */ + public function getStudiensemester() + { + $this->StudiensemesterModel->addOrder('start', 'DESC'); + $result = $this->StudiensemesterModel->load(); + + if (isError($result)) return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); + + return $this->terminateWithSuccess(hasData($result) ? getData($result) : []); + } + + /** + * Validate Projektarbeit data. + * @param formData + * @return bool true if data valid */ private function _validate($formData) { @@ -293,9 +337,9 @@ class Projektarbeit extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Extract Projektarbeit data from passed form data. + * @param formData + * @return array */ private function _getProjektarbeitArr($formData) { @@ -317,9 +361,9 @@ class Projektarbeit extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Check if deletion of a Projektarbeit is possible. + * @param $projektarbeit_id + * @return object success if deletion possible, error otherwise. */ private function _validateDelete($projektarbeit_id) { @@ -340,6 +384,11 @@ class Projektarbeit extends FHCAPI_Controller return success(); } + /** + * Checks permissions for a student. + * @param $student_uid + * @return bool true if authorized + */ private function _hasBerechtigungForStudent($student_uid) { if (!$student_uid) diff --git a/application/controllers/api/frontend/v1/stv/Projektbetreuer.php b/application/controllers/api/frontend/v1/stv/Projektbetreuer.php index 98567ecde..904fa6167 100644 --- a/application/controllers/api/frontend/v1/stv/Projektbetreuer.php +++ b/application/controllers/api/frontend/v1/stv/Projektbetreuer.php @@ -3,7 +3,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); use \DateTime as DateTime; -use CI3_Events as Events; +use \CI3_Events as Events; class Projektbetreuer extends FHCAPI_Controller { @@ -43,6 +43,9 @@ class Projektbetreuer extends FHCAPI_Controller $this->load->library('PermissionLib'); } + /** + * Gets Projektbetreuer data for a Projektarbeit. + */ public function getProjektbetreuer() { $projektarbeit_id = $this->input->get('projektarbeit_id'); @@ -50,21 +53,30 @@ class Projektbetreuer extends FHCAPI_Controller if (!isset($projektarbeit_id)) $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Projektarbeit ID']), self::ERROR_TYPE_GENERAL); - $this->ProjektbetreuerModel->addSelect( - 'projektarbeit_id, person_id, nachname, vorname, note, punkte, round(stunden, 1) AS stunden, - stundensatz, betreuerart_kurzbz, vertrag_id, titelpre, titelpost' - ); - $this->ProjektbetreuerModel->addSelect("CASE - WHEN EXISTS - (SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid) WHERE person_id=pers.person_id) - THEN 'Mitarbeiter' - WHEN EXISTS - (SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_student ON(uid=student_uid) WHERE person_id=pers.person_id) - THEN 'Student' - ELSE 'Person' - END AS status"); - $this->ProjektbetreuerModel->addJoin('public.tbl_person pers', 'person_id'); - $result = $this->ProjektbetreuerModel->loadWhere(['projektarbeit_id' => $projektarbeit_id]); + $qry = " + SELECT * FROM ( + SELECT + projektarbeit_id, person_id, nachname, vorname, note, punkte, round(stunden, 1) AS stunden, + stundensatz, betreuerart_kurzbz, vertrag_id, titelpre, titelpost, + CASE + WHEN EXISTS + (SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid) WHERE person_id=pers.person_id) + THEN 'Mitarbeiter' + WHEN EXISTS + (SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_student ON(uid=student_uid) WHERE person_id=pers.person_id) + THEN 'Student' + ELSE 'Person' + END AS status + FROM + lehre.tbl_projektbetreuer + JOIN public.tbl_person pers USING (person_id) + WHERE + projektarbeit_id = ? + ) betreuer + ORDER BY + CASE WHEN status = 'Mitarbeiter' THEN 0 WHEN status = 'Person' THEN 1 ELSE 2 END"; + + $result = $this->ProjektbetreuerModel->execReadOnlyQuery($qry, [$projektarbeit_id]); if (isError($result)) $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); @@ -86,6 +98,7 @@ class Projektbetreuer extends FHCAPI_Controller //~ } //~ } + // add thesis download link (from external extension) foreach ($projektbetreuer as $pb) { $downloadLink = null; @@ -104,6 +117,9 @@ class Projektbetreuer extends FHCAPI_Controller $this->terminateWithSuccess($this->_addFullNameToBetreuer($projektbetreuer)); } + /** + * Saves (adds or updates) a single Projektbetreuer for a Projektarbeit. + */ public function saveProjektbetreuer() { $projektarbeit_id = $this->input->post('projektarbeit_id'); @@ -118,14 +134,36 @@ class Projektbetreuer extends FHCAPI_Controller if ($this->_validate($projektbetreuer) == false) $this->terminateWithValidationErrors($this->form_validation->error_array()); + // check if assessor has already been assigned + if (isset($projektbetreuer['person_id'])) + { + $this->ProjektbetreuerModel->addSelect('1'); + $betreuerRes = $this->ProjektbetreuerModel->loadWhere( + [ + 'person_id' => $projektbetreuer['person_id'], + 'projektarbeit_id' => $projektbetreuer['projektarbeit_id'], + 'betreuerart_kurzbz' => $projektbetreuer['betreuerart_kurzbz'] + ] + ); + + if (hasData($betreuerRes) + && (!isset($projektbetreuer['person_id_old']) || $projektbetreuer['person_id'] != $projektbetreuer['person_id_old'])) { + return $this->terminateWithError($this->p->t('projektarbeit', 'betreuerZugewiesen'), self::ERROR_TYPE_GENERAL); + } + } + $result = null; + $stunden = isset($projektbetreuer['stunden']) && !isEmptyString($projektbetreuer['stunden']) ? $projektbetreuer['stunden'] : null; + $stundensatz = + isset($projektbetreuer['stundensatz']) && !isEmptyString($projektbetreuer['stundensatz']) ? $projektbetreuer['stundensatz'] : null; + $betreuer = [ 'projektarbeit_id' => $projektarbeit_id, 'person_id' => $projektbetreuer['person_id'], 'note' => $projektbetreuer['note'], - 'stunden' => $projektbetreuer['stunden'], - 'stundensatz' => $projektbetreuer['stundensatz'], + 'stunden' => $stunden, + 'stundensatz' => $stundensatz, 'betreuerart_kurzbz' => $projektbetreuer['betreuerart_kurzbz'] ]; @@ -152,6 +190,9 @@ class Projektbetreuer extends FHCAPI_Controller $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } + /** + * Delete a Projektbetreuer assignment to a Projektarbeit. + */ public function deleteProjektbetreuer() { $projektarbeit_id = $this->input->post('projektarbeit_id'); @@ -159,21 +200,44 @@ class Projektbetreuer extends FHCAPI_Controller $betreuerart_kurzbz = $this->input->post('betreuerart_kurzbz'); if (!isset($projektarbeit_id) || !is_numeric($projektarbeit_id)) - return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> $this->p->t('projektarbeit', 'projektarbeit').' ID'], self::ERROR_TYPE_GENERAL)); + { + return $this->terminateWithError( + $this->p->t('ui', 'error_missingId', ['id'=> $this->p->t('projektarbeit', 'projektarbeit').' ID'], self::ERROR_TYPE_GENERAL) + ); + } if (!isset($person_id) || !is_numeric($person_id)) return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID'], self::ERROR_TYPE_GENERAL)); if (!isset($betreuerart_kurzbz)) - return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> $this->p->t('projektarbeit', 'betreuerart')], self::ERROR_TYPE_GENERAL)); + { + return $this->terminateWithError( + $this->p->t('ui', 'error_missingId', ['id'=> $this->p->t('projektarbeit', 'betreuerart')], self::ERROR_TYPE_GENERAL) + ); + } + // check permission if (!$this->ProjektarbeitModel->hasBerechtigungForProjektarbeit($projektarbeit_id)) return $this->_outputAuthError([$this->router->method => ['admin:rw', 'assistenz:rw']]); - $validate = $this->_validateDelete($projektarbeit_id, $person_id); + $validate = $this->_validateDelete($projektarbeit_id, $person_id, $betreuerart_kurzbz); if (isError($validate)) return $this->terminateWithError(getError($validate), self::ERROR_TYPE_GENERAL); + // check if there is a Projektarbeitsbeurteilung - if yes, it is handled (possibly deleted) by external extension. + $beurteilungDeleteSuccess = true; + + Events::trigger( + 'projektarbeitsbeurteilung_delete', + $projektarbeit_id, + function ($value) use (&$beurteilungDeleteSuccess) { + $beurteilungDeleteSuccess = $value; + } + ); + + // if there is still a Beurteilung, Projektarbeit cannot be deleted - return with error + if (!$beurteilungDeleteSuccess) return $this->terminateWithError($this->p->t('projektarbeit', 'error_paarbeitHatBeurteilung')); + $result = $this->ProjektbetreuerModel->delete( ['projektarbeit_id' => $projektarbeit_id, 'person_id' => $person_id, 'betreuerart_kurzbz' => $betreuerart_kurzbz] ); @@ -185,9 +249,12 @@ class Projektbetreuer extends FHCAPI_Controller $this->outputJson($result); } - return $this->terminateWithSuccess(current(getData($result)) ? : null); + return $this->terminateWithSuccess(getData($result)); } + /** + * Get all active Betreuerarten. + */ public function getBetreuerarten() { $result = $this->BetreuerartModel->loadWhere(['aktiv' => true]); @@ -197,6 +264,9 @@ class Projektbetreuer extends FHCAPI_Controller return $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } + /** + * Get all Noten. + */ public function getNoten() { $result = $this->NoteModel->load(); @@ -206,6 +276,9 @@ class Projektbetreuer extends FHCAPI_Controller return $this->terminateWithSuccess(hasData($result) ? getData($result) : []); } + /** + * Get default Stundensätze for an employee in a semester. + */ public function getDefaultStundensaetze() { $person_id = $this->input->get('person_id'); @@ -216,6 +289,9 @@ class Projektbetreuer extends FHCAPI_Controller return $this->terminateWithSuccess($result); } + /** + * Get all Projektbetreuer by search string. + */ public function getProjektbetreuerBySearchQuery() { $searchString = $this->input->get('searchString'); @@ -227,9 +303,23 @@ class Projektbetreuer extends FHCAPI_Controller if (isError($result)) return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - return $this->terminateWithSuccess(hasData($result) ? $this->_addFullNameToBetreuer(getData($result)) : []); + if (!hasData($result)) $this->terminateWithSuccess([]); + + $persons = $this->_addFullNameToBetreuer(getData($result)); + + // sort persons by type (employees first) + usort($persons, function ($a, $b) { + $statusRanks = ['Mitarbeiter' => 0, 'Person' => 1, 'Student' => 2]; + return (isset($statusRanks[$a->status]) ? $statusRanks[$a->status] : count($statusRanks) + 1) + - (isset($statusRanks[$b->status]) ? $statusRanks[$b->status] : count($statusRanks) + 1); + }); + + return $this->terminateWithSuccess($persons); } + /** + * Get person info by Id. + */ public function getPerson() { $person_id = $this->input->get('person_id'); @@ -255,9 +345,7 @@ class Projektbetreuer extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Validate list of Projektbetreuer. */ public function validateProjektbetreuer() { @@ -277,9 +365,9 @@ class Projektbetreuer extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Validation funciton for checking Projektbetreuer input. + * @param $formData Betreuer data + * @return bool true when data is valid */ private function _validate($formData) { @@ -306,26 +394,32 @@ class Projektbetreuer extends FHCAPI_Controller } /** - * - * @param - * @return object success or error + * Check possibility of deletion of a Projektbetreuer. + * @param projektarbeit_id + * @param person_id + * @param betreuerart_kurzbz + * @return object success when delete possible, error otherwise */ - private function _validateDelete($projektarbeit_id, $person_id) + private function _validateDelete($projektarbeit_id, $person_id, $betreuerart_kurzbz) { + // check if contract exists $this->ProjektbetreuerModel->addSelect('vertrag_id'); - $result = $this->ProjektbetreuerModel->loadWhere(['projektarbeit_id' => $projektarbeit_id, 'person_id' => $person_id]); + $result = $this->ProjektbetreuerModel->loadWhere( + ['projektarbeit_id' => $projektarbeit_id, 'person_id' => $person_id, 'betreuerart_kurzbz' => $betreuerart_kurzbz] + ); if (isError($result)) return $result; + // if contract exists, no deletion is possible if (hasData($result) && getData($result)[0]->vertrag_id != null) return error($this->p->t('projektarbeit', 'error_betreuerHatVertrag')); return success(); } /** - * - * @param - * @return object success or error + * Add full name to array with Betreuer. + * @param $betreuerArr + * @return array including Betreuer with their full names */ private function _addFullNameToBetreuer($betreuerArr) { diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index e490772db..09a9f18b1 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -1078,6 +1078,24 @@ class Status extends FHCAPI_Controller $this->terminateWithSuccess(true); } + protected function checkForCriticalChangesBis($oldstatus) + { + $changedFields = array(); + $allowedFields = array('anmerkung', 'statusgrund_id'); + $oldstatus_array = get_object_vars($oldstatus); + foreach($oldstatus_array as $key => $oldValue) + { + $newValue = $this->input->post($key); + if( $newValue !== $oldValue ) + { + $changedFields[] = $key; + } + } + $criticalFieldsChanged = array_diff($changedFields, $allowedFields); + $hasCriticalChangesBis = count($criticalFieldsChanged) > 0 ? true : false; + return $hasCriticalChangesBis; + } + /** * Updates a status entry * @@ -1102,6 +1120,7 @@ class Status extends FHCAPI_Controller $oldstatus = current($oldstatus); + $hasCriticalChangesBis = $this->checkForCriticalChangesBis($oldstatus); $isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'); $isBerechtigtBasisPrestudentstatus = $this->permissionlib->isBerechtigt('basis/prestudentstatus'); @@ -1112,7 +1131,6 @@ class Status extends FHCAPI_Controller $ausbildungssemester = $this->input->post('ausbildungssemester') ?: $oldstatus->ausbildungssemester; $datum = $this->input->post('datum') ?: $oldstatus->datum; - //Form Validation $this->load->library('form_validation'); @@ -1135,9 +1153,15 @@ class Status extends FHCAPI_Controller $this->p->t('global', 'datum'), [ 'is_valid_date', - ['meldestichtag_not_exceeded', function ($value) use ($isBerechtigtNoStudstatusCheck) { + ['meldestichtag_not_exceeded', function ($value) use ($isBerechtigtNoStudstatusCheck, $hasCriticalChangesBis){ if ($isBerechtigtNoStudstatusCheck) - return true; // Skip if access right says so + { + return true; // Skip if access right says so*/ + } + if (!$hasCriticalChangesBis) { + return true; // Skip if no critical changes were made + } + if (!$value) return true; // Error will be handled by the required statement above @@ -1341,6 +1365,7 @@ class Status extends FHCAPI_Controller 'updateamum' => date('c'), 'updatevon' => $authUID ]; + $nullableFields = ['statusgrund_id', 'anmerkung', 'rt_stufe']; foreach ([ 'orgform_kurzbz', 'anmerkung', @@ -1349,8 +1374,17 @@ class Status extends FHCAPI_Controller 'rt_stufe', 'statusgrund_id' ] as $key) - if ($this->input->post($key)) + { + if (in_array($key, $nullableFields)) + { + $updateData[$key] = ($this->input->post($key) === '') ? null : $this->input->post($key); + } + else if ($this->input->post($key)) + { $updateData[$key] = $this->input->post($key); + } + } + if ($this->input->post('bestaetigtam')) { $updateData['bestaetigtam'] = $this->input->post('bestaetigtam'); diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index f0172da8a..ad6883f94 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -37,7 +37,7 @@ class Student extends FHCAPI_Controller 'get' => ['admin:r', 'assistenz:r'], 'save' => ['admin:rw', 'assistenz:rw'], 'saveStudent' => ['admin:rw', 'assistenz:rw'], - 'check' => ['admin:rw', 'assistenz:rw'], + 'getPerson' => ['admin:rw', 'assistenz:rw'], 'add' => ['admin:rw', 'assistenz:rw'] // TODO(chris): extra permissions ]); @@ -159,9 +159,9 @@ class Student extends FHCAPI_Controller 'LEFT');*/ $result = $this->PrestudentModel->loadWhere(['tbl_prestudent.prestudent_id' => $prestudent_id]); - + $student = $this->getDataOrTerminateWithError($result); - + if (!$student) return show_404(); @@ -221,7 +221,7 @@ class Student extends FHCAPI_Controller ]); $this->load->library('UDFLib'); - + $result = $this->udflib->getCiValidations($this->PersonModel, $this->input->post()); $udf_field_validations = $this->getDataOrTerminateWithError($result); @@ -232,7 +232,7 @@ class Student extends FHCAPI_Controller $this->terminateWithValidationErrors($this->form_validation->error_array()); $result = $this->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]); - + $student = $this->getDataOrTerminateWithError($result); $uid = $student ? current($student)->student_uid : null; @@ -245,7 +245,6 @@ class Student extends FHCAPI_Controller $person_id = $person ? current($person)->person_id : null; - $array_allowed_props_lehrverband = ['verband', 'semester', 'gruppe']; $update_lehrverband = array(); foreach ($array_allowed_props_lehrverband as $prop) { @@ -305,7 +304,7 @@ class Student extends FHCAPI_Controller } $array_allowed_props_student = ['matrikelnr']; - if($this->isLaufendesSemester($studiensemester_kurzbz)) + if($this->isLaufendesSemester($studiensemester_kurzbz)) { $array_allowed_props_student = ['matrikelnr', 'verband', 'semester', 'gruppe']; } @@ -462,7 +461,7 @@ class Student extends FHCAPI_Controller return $this->save($student->prestudent_id, $studiensemester_kurzbz); } - public function check() + public function getPerson() { $this->load->library('form_validation'); @@ -480,21 +479,55 @@ class Student extends FHCAPI_Controller $this->load->model('person/Person_model', 'PersonModel'); + $this->PersonModel->addSelect( + 'person_id, vorname, nachname, vornamen, wahlname, gebdatum, staatsbuergerschaft, geburtsnation, sprache, anrede, + titelpost, titelpre, gebort, gebzeit, homepage, geschlecht, matr_nr, + aktiv, unruly, tbl_geschlecht.bezeichnung_mehrsprachig AS geschlecht_bezeichnung' + ); + $this->PersonModel->addJoin('public.tbl_geschlecht', 'geschlecht'); + if ($gebdatum) $this->PersonModel->db->where('gebdatum', (new DateTime($gebdatum))->format('Y-m-d')); if ($vorname && $nachname) { $this->PersonModel->db->or_group_start(); - $this->PersonModel->db->where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->db->escape($nachname) . ')', false); - $this->PersonModel->db->where('LOWER(vorname)', 'LOWER(' . $this->PersonModel->db->escape($vorname) . ')', false); + $this->PersonModel->db->where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->db->escape(trim($nachname)) . ')', false); + $this->PersonModel->db->where('LOWER(vorname)', 'LOWER(' . $this->PersonModel->db->escape(trim($vorname)) . ')', false); $this->PersonModel->db->group_end(); } elseif ($nachname) { - $this->PersonModel->db->or_where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->escape($nachname) . ')', false); + $this->PersonModel->db->or_where('LOWER(nachname)', 'LOWER(' . $this->PersonModel->escape(trim($nachname)) . ')', false); } $result = $this->PersonModel->load(); $data = $this->getDataOrTerminateWithError($result); + $this->load->model('person/Adresse_model', 'AdresseModel'); + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + + foreach ($data as $person) + { + // get adresses + $langIdx = $this->_getLanguageIndex() - 1; + $person->geschlecht_bezeichnung = isset($person->geschlecht_bezeichnung[$langIdx]) ? $person->geschlecht_bezeichnung[$langIdx] : ''; + + // get Adresse + $this->AdresseModel->addOrder('heimatadresse', 'DESC'); + $this->AdresseModel->addOrder('zustelladresse', 'DESC'); + $this->AdresseModel->addOrder('adresse_id', 'DESC'); + $result = $this->AdresseModel->loadWhere(['person_id' => $person->person_id]); + + $adressen = $this->getDataOrTerminateWithError($result); + + $person->adressen = $adressen; + + // get status + $result = $this->PrestudentstatusModel->getLastStatusPerson($person->person_id); + + $status = $this->getDataOrTerminateWithError($result); + + $person->status = $status; + } + $this->terminateWithSuccess($data); } @@ -508,71 +541,52 @@ class Student extends FHCAPI_Controller $_POST['ausbildungssemester'] = 0; } - $this->load->library('form_validation'); + $this->_validate(); - $this->form_validation->set_rules('nachname', 'Nachname', 'callback_requiredIfNotPersonId', [ - 'requiredIfNotPersonId' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'nachname')]) - ]); - $this->form_validation->set_rules('geschlecht', 'Geschlecht', 'callback_requiredIfNotPersonId', [ - 'requiredIfNotPersonId' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'geschlecht')]) - ]); - $this->form_validation->set_rules('gebdatum', 'Geburtsdatum', ['isValidDate', function($value) { return isValidDate($value); }], [ - 'isValidDate' => $this->p->t('ui', 'error_invalid_date') - ]); - $this->form_validation->set_rules('address[func]', 'Address', 'required|integer|less_than[2]|greater_than[-2]'); - $this->form_validation->set_rules('address[plz]', 'PLZ', 'callback_requiredIfAddressFunc', [ - 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'plz')]) - ]); - $this->form_validation->set_rules('address[gemeinde]', 'Gemeinde', 'callback_requiredIfAddressFunc', [ - 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'gemeinde')]) - ]); - $this->form_validation->set_rules('address[ort]', 'Ort', 'callback_requiredIfAddressFunc', [ - 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'ort')]) - ]); - $this->form_validation->set_rules('address[address]', 'Adresse', 'callback_requiredIfAddressFunc', [ - 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'adresse')]) - ]); - $this->form_validation->set_rules('email', 'E-Mail', 'valid_email'); - $this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'callback_requiredIfStudentFunc', [ - 'requiredIfStudentFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'studiengang')]) - ]); - $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'callback_requiredIfStudentFunc', [ - 'requiredIfStudentFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'studiensemester')]) - ]); - $this->form_validation->set_rules('ausbildungssemester', 'Ausbildungssemester', 'callback_requiredIfStudentFunc|integer|less_than[9]|greater_than[-1]', [ - 'requiredIfStudentFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'ausbildungssemester')]) - ]); - // TODO(chris): validate studienplan with studiengang, semester and orgform? - // TODO(chris): validate person_id, studiengang_kz, studiensemester_kurzbz, orgform_kurzbz, nation, gemeinde, ort, geschlecht? - - if (!$this->form_validation->run()) - $this->terminateWithValidationErrors($this->form_validation->error_array()); - - // TODO(chris): This should be in a library + $this->load->model('crm/Student_model', 'StudentModel'); $this->load->model('crm/Prestudent_model', 'PrestudentModel'); $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + $this->load->model('organisation/Lehrverband_model', 'LehrverbandModel'); + $this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel'); - $this->db->trans_start(); + $this->load->library('PrestudentLib'); - $result = $this->addInteressent(); + $errors = []; + $person_id = null; - $this->db->trans_complete(); + $this->db->trans_begin(); - if ($this->db->trans_status() === FALSE) - $this->terminateWithError('TODO(chris): TEXT', self::ERROR_TYPE_GENERAL); + $result = $this->_addPerson(); + if (isError($result)) $errors[] = getError($result); - $data = $this->getDataOrTerminateWithError($result); + if (hasData($result)) + { + $person_id = getData($result); + $result = $this->_addAdresse($person_id); + if (isError($result)) $errors[] = getError($result); + $result = $this->_addKontakt($person_id); + if (isError($result)) $errors[] = getError($result); + if (!$this->input->post('personOnly')) $result = $this->_addFirstPrestudentstatus($person_id); + if (isError($result)) $errors[] = getError($result); + } - $this->terminateWithSuccess($data); + if ($this->db->trans_status() === FALSE || !isEmptyArray($errors)) + { + $this->db->trans_rollback(); + $this->terminateWithError(isEmptyArray($errors) ? $this->p->t('stv', 'error_add_student') : $errors); + } + $this->db->trans_commit(); + + $this->terminateWithSuccess($person_id); } - protected function addInteressent() + private function _addPerson() { // Person anlegen wenn nötig $person_id = $this->input->post('person_id'); if (!$person_id) { $this->load->model('person/Person_model', 'PersonModel'); - + $data = [ 'nachname' => $this->input->post('nachname'), 'insertamum' => date('c'), @@ -595,19 +609,25 @@ class Student extends FHCAPI_Controller if ($this->input->post('geschlecht')) $data['geschlecht'] = $this->input->post('geschlecht'); if ($this->input->post('gebdatum')) - $data['gebdatum'] = (new DateTime($this->input->post('datum_obj')))->format('Y-m-d'); + $data['gebdatum'] = (new DateTime($this->input->post('gebdatum')))->format('Y-m-d'); if ($this->input->post('geburtsnation')) $data['geburtsnation'] = $this->input->post('geburtsnation'); if ($this->input->post('staatsbuergerschaft')) $data['staatsbuergerschaft'] = $this->input->post('staatsbuergerschaft'); - $result = $this->PersonModel->insert($data); - $person_id = $this->getDataOrTerminateWithError($result); + return $this->PersonModel->insert($data); } - // Addresse anlegen - $anlegen = $this->input->post('address[func]'); - if ($anlegen) { + return success($person_id); + } + + private function _addAdresse($person_id) + { + // Addresse anlegen? + $anlegen = $this->input->post('address[checked]'); + if ($anlegen === true) + { + // Adresse laden $this->load->model('person/Adresse_model', 'AdresseModel'); $data = [ @@ -619,52 +639,45 @@ class Student extends FHCAPI_Controller 'typ' => 'h', 'zustelladresse' => true, ]; - if ($anlegen < 0) { // Überschreiben + $this->AdresseModel->addSelect('adresse_id'); - $this->AdresseModel->addJoin('public.tbl_adressentyp', 'typ = adressentyp_kurzbz'); - $this->AdresseModel->addOrder('zustelladresse', 'DESC'); - $this->AdresseModel->addOrder('sort'); $result = $this->AdresseModel->loadWhere([ 'person_id' => $person_id ]); - $address = $this->getDataOrTerminateWithError($result); - if ($address) { - $address = current($address); - $data['updateamum'] = date('c'); - $data['updatevon'] = getAuthUID(); + if (isError($result)) return $result; + + // wenn neue Adresse, heimatadresse setzen + if (!hasData($result)) $data['heimatadresse'] = true; - $result = $this->AdresseModel->update($address->adresse_id, $data); - $this->getDataOrTerminateWithError($result); - } else { - //Wenn keine Adrese vorhanden ist dann eine neue Anlegen - $anlegen = 1; - $data['heimatadresse'] = true; - } - } - if ($anlegen > 0) { $data['person_id'] = $person_id; $data['insertamum'] = date('c'); $data['insertvon'] = getAuthUID(); - if (!isset($data['heimatadresse'])) - $data['heimatadresse'] = !$this->input->post('person_id'); - - $result = $this->AdresseModel->insert($data); - $this->getDataOrTerminateWithError($result); - } + + return $this->AdresseModel->insert($data); } - + + return success(null); + } + + private function _addKontakt($person_id) + { // Kontaktdaten $kontaktdaten = []; - foreach (['email', 'telefon', 'mobil'] as $k) { + + foreach (['email', 'telefon', 'mobil'] as $k) + { $v = $this->input->post($k); if ($v) $kontaktdaten[$k] = $v; } - if (count($kontaktdaten)) { + + if (count($kontaktdaten)) + { $this->load->model('person/Kontakt_model', 'KontaktModel'); - foreach ($kontaktdaten as $typ => $kontakt) { + foreach ($kontaktdaten as $typ => $kontakt) + { $data = [ 'person_id' => $person_id, 'kontakttyp' => $typ, @@ -674,87 +687,70 @@ class Student extends FHCAPI_Controller 'insertvon' => getAuthUID() ]; $result = $this->KontaktModel->insert($data); - $this->getDataOrTerminateWithError($result); + if (isError($result)) return $result; } } + return success(null); + } - $personOnly = $anlegen = $this->input->post('personOnly'); + private function _addFirstPrestudentstatus($person_id) + { + // Prestudent anlegen - if (!$personOnly) + // Anmerkung with Ausbildungsart + $studiengang_kz = $this->input->post('studiengang_kz'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); + $ausbildungsart = $this->input->post('ausbildungsart'); + $anmerkung = $this->input->post('anmerkungen'); + $foerderrelevant = null; + if ($ausbildungsart) + $anmerkung .= ' Ausbildungsart:' . $ausbildungsart; + + // Incomings und ausserordentliche sind bei Meldung nicht förderrelevant + $incoming = $this->input->post('incoming'); + if ($incoming || substr($studiengang_kz, 0, 1) == '9') + $foerderrelevant = false; + + // Prestudent speichern + $result = $this->prestudentlib->setPrestudent( + $person_id, + $studiengang_kz, + $this->input->post('letzteausbildung'), + $anmerkung, + $foerderrelevant + ); + if (isError($result)) return $result; + if (!hasData($result)) return error('Error when adding prestudent'); + + $prestudent_id = getData($result); + + // wenn Incoming, Incoming Daten hinzufügen + if ($incoming) { - // Prestudent anlegen - $data = [ - 'aufmerksamdurch_kurzbz' => 'k.A.', - 'person_id' => $person_id, - 'studiengang_kz' => $this->input->post('studiengang_kz'), - 'ausbildungcode' => $this->input->post('letzteausbildung'), - 'anmerkung' => $this->input->post('anmerkungen'), - 'reihungstestangetreten' => false, - 'bismelden' => true - ]; - $ausbildungsart = $this->input->post('ausbildungsart'); - if ($ausbildungsart) - $data['anmerkung'] .= ' Ausbildungsart:' . $ausbildungsart; - // Incomings und ausserordentliche sind bei Meldung nicht förderrelevant - $incoming = $this->input->post('incoming'); - if ($incoming || substr($data['studiengang_kz'], 0, 1) == '9') - $data['foerderrelevant'] = false; - // Wenn die Person schon im System erfasst ist, dann die ZGV des Datensatzes uebernehmen - $this->PrestudentModel->addOrder('zgvmas_code'); - $this->PrestudentModel->addOrder('zgv_code', 'DESC'); - $this->PrestudentModel->addLimit(1); - $result = $this->PrestudentModel->loadWhere([ - 'person_id' => $person_id - ]); - $prestudent = $this->getDataOrTerminateWithError($result); - if ($prestudent) { - $prestudent = current($prestudent); - if ($prestudent->zgv_code) { - $data['zgv_code'] = $prestudent->zgv_code; - $data['zgvort'] = $prestudent->zgvort; - $data['zgvdatum'] = $prestudent->zgvdatum; - - $data['zgvmas_code'] = $prestudent->zgvmas_code; - $data['zgvmaort'] = $prestudent->zgvmaort; - $data['zgvmadatum'] = $prestudent->zgvmadatum; - } - } - // Prestudent speichern - $result = $this->PrestudentModel->insert($data); - $prestudent_id = $this->getDataOrTerminateWithError($result); - - // Prestudent Rolle Anlegen - $data = [ - 'prestudent_id' => $prestudent_id, - 'status_kurzbz' => $incoming ? 'Incoming' : 'Interessent', - 'studiensemester_kurzbz' => $this->input->post('studiensemester_kurzbz'), - 'ausbildungssemester' => $this->input->post('ausbildungssemester') ?: 0, - 'orgform_kurzbz' => $this->input->post('orgform_kurzbz') ?: null, - 'studienplan_id' => $this->input->post('studienplan_id') ?: null, - 'datum' => date('Y-m-d'), - 'insertamum' => date('c'), - 'insertvon' => getAuthUID() - ]; - $result = $this->PrestudentstatusModel->insert($data); - $this->getDataOrTerminateWithError($result); - - if ($incoming) { - // TODO(chris): IMPLEMENT! - //Matrikelnummer und UID generieren - //Benutzerdatensatz anlegen - //Studentendatensatz anlegen - //StudentLehrverband anlegen - } + $statusResult = $this->prestudentlib->setFirstIncoming( + $prestudent_id, + $studiengang_kz, + $studiensemester_kurzbz, + $this->input->post('orgform_kurzbz'), + $this->input->post('studienplan_id') + ); } - // TODO(chris): DEBUG - /*$result = $this->PrestudentModel->loadWhere([ - 'pestudent_id' => 1 - ]); - if (isError($result)) { - return $result; - }*/ + else + { + // Prestudent Rolle Anlegen + $statusResult = $this->prestudentlib->setFirstStatus( + $prestudent_id, + $this->PrestudentstatusModel::STATUS_INTERESSENT, + $studiensemester_kurzbz, + $this->input->post('ausbildungssemester'), + $this->input->post('orgform_kurzbz'), + $this->input->post('studienplan_id') + ); + } + if (!hasData($statusResult)) return error('error when adding status'); + if (isError($statusResult)) return $statusResult; - return success($person_id); + return success($prestudent_id); } public function requiredIfNotPersonId($value) @@ -766,20 +762,84 @@ class Student extends FHCAPI_Controller public function requiredIfAddressFunc($value) { - if (!$_POST['address']['func'] || $_POST['address']['func'] == 0) + if (!isset($_POST['address']['checked']) || !$_POST['address']['checked']) return true; return !!$value; } public function requiredIfStudentFunc($value) { - if ($_POST['personOnly']) + if (isset($_POST['personOnly']) && $_POST['personOnly']) return true; return !!$value; } - public function isValidDate($value) + public function requiredIfStudentAndNotIncomingFunc($value) { - return isValidDate($value); + if ((isset($_POST['incoming']) && $_POST['incoming']) || $this->requiredIfStudentFunc($value)) + return true; + return !!$value; + } + + /** + * Validates input data. Terminates with validation errors, if invalid. + */ + private function _validate() + { + $this->load->library('form_validation'); + + $this->form_validation->set_rules('nachname', 'Nachname', 'callback_requiredIfNotPersonId', [ + 'requiredIfNotPersonId' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'nachname')]) + ]); + $this->form_validation->set_rules('geschlecht', 'Geschlecht', 'callback_requiredIfNotPersonId', [ + 'requiredIfNotPersonId' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'geschlecht')]) + ]); + $this->form_validation->set_rules('gebdatum', 'Geburtsdatum', ['isValidDate', function($value) { return isValidDate($value); }], [ + 'isValidDate' => $this->p->t('ui', 'error_invalid_date') + ]); + //$this->form_validation->set_rules('address[checked]', 'Address', 'required'); + $this->form_validation->set_rules('address[plz]', 'PLZ', 'callback_requiredIfAddressFunc', [ + 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'plz')]) + ]); + $this->form_validation->set_rules('address[gemeinde]', 'Gemeinde', 'callback_requiredIfAddressFunc', [ + 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'gemeinde')]) + ]); + $this->form_validation->set_rules('address[ort]', 'Ort', 'callback_requiredIfAddressFunc', [ + 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'ort')]) + ]); + $this->form_validation->set_rules('address[address]', 'Adresse', 'callback_requiredIfAddressFunc', [ + 'requiredIfAddressFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('person', 'adresse')]) + ]); + $this->form_validation->set_rules('email', 'E-Mail', 'valid_email'); + $this->form_validation->set_rules('studiengang_kz', 'Studiengang', 'callback_requiredIfStudentFunc', [ + 'requiredIfStudentFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'studiengang')]) + ]); + $this->form_validation->set_rules('studiensemester_kurzbz', 'Studiensemester', 'callback_requiredIfStudentFunc', [ + 'requiredIfStudentFunc' => $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'studiensemester')]) + ]); + $this->form_validation->set_rules( + 'ausbildungssemester', + 'Ausbildungssemester', + 'callback_requiredIfStudentAndNotIncomingFunc|integer|less_than[9]|greater_than[-1]', + [ + 'requiredIfStudentAndNotIncomingFunc' => + $this->p->t('ui', 'error_fieldRequired', ['field' => $this->p->t('lehre', 'ausbildungssemester')]), + ] + ); + // TODO(chris): validate studienplan with studiengang, semester and orgform? + // TODO(chris): validate person_id, studiengang_kz, studiensemester_kurzbz, orgform_kurzbz, nation, gemeinde, ort, geschlecht? + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + + private function _getLanguageIndex() + { + $this->load->model('system/Sprache_model', 'SpracheModel'); + $this->SpracheModel->addSelect('index'); + $result = $this->SpracheModel->loadWhere(array('sprache' => getUserLanguage())); + $this->addMeta('lang', getUserLanguage()); + + return hasData($result) ? getData($result)[0]->index : 1; } } diff --git a/application/controllers/api/frontend/v1/stv/Verband.php b/application/controllers/api/frontend/v1/stv/Verband.php index eb25a548b..32ef30a45 100644 --- a/application/controllers/api/frontend/v1/stv/Verband.php +++ b/application/controllers/api/frontend/v1/stv/Verband.php @@ -215,6 +215,7 @@ class Verband extends FHCAPI_Controller $this->StudienordnungModel->addDistinct(); $this->StudienordnungModel->addSelect("CONCAT(studiengang_kz, '/', p.orgform_kurzbz) AS link"); $this->StudienordnungModel->addSelect("p.orgform_kurzbz AS name"); + $this->StudienordnungModel->addSelect("studiengang_kz AS stg_kz"); $this->StudienordnungModel->addJoin('lehre.tbl_studienplan p', 'studienordnung_id'); diff --git a/application/controllers/jobs/AntragJob.php b/application/controllers/jobs/AntragJob.php index debcfe391..8dc4870ea 100644 --- a/application/controllers/jobs/AntragJob.php +++ b/application/controllers/jobs/AntragJob.php @@ -200,13 +200,14 @@ class AntragJob extends JOB_Controller } /** - * Send reminder to Assistant for Wiedereinstieg Unterbrecher + * Send reminder to Assistant and to Student for Wiedereinstieg Unterbrecher * */ public function sendReminderWiedereinstieg() { $now = new DateTime(); $modifier = $this->config->item('unterbrechung_job_remind_wiedereinstieg_date_modifier'); + if (!$modifier) return $this->logError('Konnte Job nicht starten: Config "unterbrechung_job_remind_wiedereinstieg_date_modifiers" nicht gesetzt'); @@ -230,6 +231,7 @@ class AntragJob extends JOB_Controller $antraege = getData($result) ?: []; $count = 0; + $countReminderStudent = 0; foreach ($antraege as $antrag) { $res = $this->StudierendenantragModel->getStgAndSem($antrag->studierendenantrag_id); @@ -257,10 +259,92 @@ class AntragJob extends JOB_Controller $data['UID'] = $student->student_uid; } - // NOTE(chris): Sancho mail - if(sendSanchoMail('Sancho_Mail_Antrag_U_Reminder', $data, $antrag->email, 'Reminder: Unterbrechung Wiedereinstieg')) + //Data für Email Student + $result = $this->PrestudentModel->load($antrag->prestudent_id); + $dataPrestudent = current(getData($result)); + $person_id = $dataPrestudent->person_id; + + $this->KontaktModel->addSelect('kontakt'); + + $result = $this->KontaktModel->loadWhere([ + 'person_id'=> $person_id, + 'zustellung' => true, + 'kontakttyp' => 'email' + ]); + + $email_student_privat = null; + $dataKontakt = getData($result); + if ($dataKontakt) { + $stud_private_zustell_emails = array_map(function($kontakt) { + return $kontakt->kontakt; + }, $dataKontakt); + $email_student_privat = implode(', ', $stud_private_zustell_emails); + } + + $email_student_FH = $this->StudentModel->getEmailFH($this->StudentModel->getUID($antrag->prestudent_id)); + + //studiensemester + $result = $this->StudiensemesterModel->getByDate($datum->format('Y-m-d')); + if (hasData($result)) { + $dataSem = current(getData($result)); + } + + $studiensemester = $dataSem->studiensemester_kurzbz; + $studsemShort = substr($studiensemester, 0, 2); + + if($studsemShort == "SS") + { + $data['studSemShort_Eng'] = "summer semester"; + $data['meldenBis'] = "15.1."; + $data['meldenBis_Eng'] = "January 15"; + } + elseif ($studsemShort == "WS") { + $data['studSemShort_Eng'] = "winter semester"; + $data['meldenBis'] = "1.8."; + $data['meldenBis_Eng'] = "August 1"; + } + else + { + $studsemShort = "SS/WS"; + $data['studSemShort_Eng'] = "summer/winter semester"; + $data['meldenBis'] = "15.1. (bei Einstieg ins SS) / 1.8. (bei Einstieg ins WS)"; + $data['meldenBis_Eng'] = "January 15 (for sommer semester enrollment) / August 1 (for winter semester enrollment)"; + } + + $data['studSemShort'] = $studsemShort; + + // NOTE(chris): Sancho mail Assistant + $sancho_assistant_sent = sendSanchoMail('Sancho_Mail_Antrag_U_Reminder', $data, $antrag->email, 'Reminder: Unterbrechung Wiedereinstieg'); + if($sancho_assistant_sent) { $count++; + } + else + { + $this->logError('Error: failed to send Assistant Reminder studierendenantrag_id: ' . $antrag->studierendenantrag_id); + } + //Mail to Student + $sancho_student_sent = sendSanchoMail( + 'Sancho_Mail_Antrag_U_Remind_Stud', + $data, + $email_student_FH, + 'Reminder: Unterbrechung Wiedereinstieg', + '', + '', + '', + $email_student_privat); + + if($sancho_student_sent) + { + $countReminderStudent++; + } + else + { + $this->logError('Error: failed to send Student Reminder studierendenantrag_id: ' . $antrag->studierendenantrag_id); + } + + if($sancho_assistant_sent && $sancho_student_sent) + { $this->StudierendenantragstatusModel->insert([ 'studierendenantrag_id' => $antrag->studierendenantrag_id, 'studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_REMINDERSENT, @@ -268,7 +352,7 @@ class AntragJob extends JOB_Controller ]); } } - $this->logInfo($count . ' Reminder gesendet - Ende Job sendReminderWiedereinstieg'); + $this->logInfo($count . ' Reminder an Assistenz und ' . $countReminderStudent . ' Reminder an Student gesendet - Ende Job sendReminderWiedereinstieg'); } /** diff --git a/application/libraries/PrestudentLib.php b/application/libraries/PrestudentLib.php index 2d795369f..28879fb47 100644 --- a/application/libraries/PrestudentLib.php +++ b/application/libraries/PrestudentLib.php @@ -35,6 +35,89 @@ class PrestudentLib $this->_ci->load->model('organisation/Studiengang_model', 'StudiengangModel'); } + /** + * Sets initial prestudent entry, no status yet. + * @return object success or error + */ + public function setPrestudent( + $person_id, + $studiengang_kz, + $ausbildungscode, + $anmerkung, + $foerderrelevant + ) + { + // Prestudent anlegen + $data = [ + 'aufmerksamdurch_kurzbz' => 'k.A.', + 'person_id' => $person_id, + 'studiengang_kz' => $studiengang_kz, + 'ausbildungcode' => $ausbildungscode, + 'anmerkung' => $anmerkung, + 'reihungstestangetreten' => false, + 'bismelden' => true, + 'foerderrelevant' => $foerderrelevant, + 'insertamum' => date('c'), + 'insertvon' => getAuthUID() + ]; + + // Wenn die Person schon im System erfasst ist, dann die ZGV des Datensatzes uebernehmen + $this->_ci->PrestudentModel->addSelect('public.tbl_prestudent.*, public.tbl_person.vorname, public.tbl_person.nachname'); + $this->_ci->PrestudentModel->addJoin('public.tbl_person', 'person_id'); + $this->_ci->PrestudentModel->addOrder('zgvmas_code'); + $this->_ci->PrestudentModel->addOrder('zgv_code', 'DESC'); + $this->_ci->PrestudentModel->addLimit(1); + $result = $this->_ci->PrestudentModel->loadWhere([ + 'person_id' => $person_id + ]); + + if (isError($result)) return $result; + + if (hasData($result)) { + $prestudent = getData($result)[0]; + if ($prestudent->zgv_code) { + $data['zgv_code'] = $prestudent->zgv_code; + $data['zgvort'] = $prestudent->zgvort; + $data['zgvdatum'] = $prestudent->zgvdatum; + + $data['zgvmas_code'] = $prestudent->zgvmas_code; + $data['zgvmaort'] = $prestudent->zgvmaort; + $data['zgvmadatum'] = $prestudent->zgvmadatum; + } + } + // Prestudent speichern + return $this->_ci->PrestudentModel->insert($data); + } + + /** + * Sets first status of a prestudent.! + * @return object success or error + */ + public function setFirstStatus( + $prestudent_id, + $status_kurzbz, + $studiensemester_kurzbz, + $ausbildungssemester = null, + $orgform_kurzbz = null, + $studienplan_id = null + ) + { + // Prestudent Rolle Anlegen + $data = [ + 'prestudent_id' => $prestudent_id, + 'status_kurzbz' => $status_kurzbz, + 'studiensemester_kurzbz' => $studiensemester_kurzbz, + 'ausbildungssemester' => $ausbildungssemester ?: 0, + 'orgform_kurzbz' => $orgform_kurzbz ?: null, + 'studienplan_id' => $studienplan_id ?: null, + 'datum' => date('Y-m-d'), + 'insertamum' => date('c'), + 'insertvon' => getAuthUID() + ]; + + return $this->_ci->PrestudentstatusModel->insert($data); + } + public function setAbbrecher( $prestudent_id, $studiensemester_kurzbz, @@ -889,6 +972,155 @@ class PrestudentLib ); } + /** + * Creates an incoming, saves necessary data for an incoming. + * @param $prestudent_id existing prestudent, for which incoming entry is created + * @param $studiengang_kz Studiengang assigned to incoming + * @param $studiensemester_kurzbz start semester for incoming + * @return object success if incoming successfully saved, or error + */ + public function setFirstIncoming($prestudent_id, $studiengang_kz, $studiensemester_kurzbz, $orgform_kurzbz, $studienplan_id) + { + // Verband and Ausbildungssemester for incoming + $authUID = getAuthUID(); + $incomingVerband = 'I'; + $incomingAusbildungssemester = '0'; + + // get prestudent + $this->_ci->PrestudentModel->addJoin('public.tbl_person p', 'person_id'); + $this->_ci->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz'); + $result = $this->_ci->PrestudentModel->load($prestudent_id); + + if (isError($result)) return $result; + if (!hasData($result)) return error('No prestudent'); + + $student_data = getData($result)[0]; + + $result = $this->setFirstStatus( + $prestudent_id, + $this->_ci->PrestudentstatusModel::STATUS_INCOMING, + $studiensemester_kurzbz, + $incomingAusbildungssemester, + $orgform_kurzbz, + $studienplan_id + ); + if (isError($result)) return $result; + if (!hasData($result)) return error('Error when adding prestudentstatus'); + + // generate Personenkennzeichen + $result = $this->_ci->StudentModel->generateMatrikelnummer2($studiengang_kz, $studiensemester_kurzbz); + if (isError($result)) return $result; + if (!hasData($result)) return error('No personenkennzeichen could be generated'); + + $personenkennzeichen = getData($result); + + $jahr = mb_substr($personenkennzeichen, 0, 2); + $stg = mb_substr($personenkennzeichen, 3, 4); + + $nachname_clean = mb_strtolower(sanitizeProblemChars($student_data->nachname)); + $vorname_clean = mb_strtolower(sanitizeProblemChars($student_data->vorname)); + $nachname_clean = str_replace(' ','_', $nachname_clean); + $vorname_clean = str_replace(' ','_', $vorname_clean); + + // get Studiengang data + $result = $this->_ci->StudiengangModel->load(ltrim($stg, '0')); + if (isError($result)) return $result; + if (!hasData($result)) return error('No Studiengang'); + + $stgObj = getData($result)[0]; + + // gernerate uid + $result = $this->_ci->StudentModel->generateUID($stgObj->kurzbz, $jahr, $stgObj->typ, $personenkennzeichen, $vorname_clean, $nachname_clean); + if (isError($result)) return $result; + if (!hasData($result)) return error("UID could not be generated"); + $uid = getData($result); + + //Benutzerdatensatz anlegen + $benutzer = [ + 'uid' => $uid, + 'person_id' => $student_data->person_id, + 'aktiv' => true, + 'aktivierungscode' => $this->_ci->BenutzerModel->generateActivationkey() + ]; + + // Generate Alias + $alias = ''; + if (!defined('GENERATE_ALIAS_STUDENT') || GENERATE_ALIAS_STUDENT === true) + { + $result = $this->_ci->BenutzerModel->generateAliasFromName($student_data->vorname, $student_data->nachname); + if (isError($result)) + return $result; + $alias = getData($result); + } + + $benutzer['alias'] = $alias; + $benutzer['insertamum'] = date('Y-m-d H:i:s'); + $benutzer['insertvon'] = $authUID; + + $result = $this->_ci->BenutzerModel->insert($benutzer); + + if (isError($result)) return $result; + + // Studentendatensatz anlegen + $student = [ + 'student_uid' => $uid, + 'matrikelnr' => $personenkennzeichen, + 'prestudent_id' => $prestudent_id, + 'studiengang_kz' => $studiengang_kz, + 'semester' => $incomingAusbildungssemester, + 'verband' => $incomingVerband, + 'gruppe' => ' ' + ]; + + $result = $this->_ci->LehrverbandModel->loadWhere([ + 'studiengang_kz' => $student['studiengang_kz'], + 'semester' => $student['semester'], + 'verband' => $student['verband'], + 'gruppe' => $student['gruppe'] + ]); + + if (isError($result)) return $result; + + if (!hasData($result)) + { + // Add Lehrverband if it does not exist + $result = $this->_ci->LehrverbandModel->insert([ + 'studiengang_kz' => $student_data->studiengang_kz, + 'semester' => $student['semester'], + 'verband' => $student['verband'], + 'gruppe' => $student['gruppe'], + 'bezeichnung' => 'Incoming', + 'aktiv' => true + ]); + + if (isError($result)) return $result; + } + + // add student + $student['insertamum'] = date('Y-m-d H:i:s'); + $student['insertvon'] = $authUID; + + $result = $this->_ci->StudentModel->insert($student); + if (isError($result)) return $result; + + // Add Studentlehrverband + $result = $this->_ci->StudentlehrverbandModel->insert([ + 'student_uid' => $uid, + 'studiensemester_kurzbz' => $studiensemester_kurzbz, + 'studiengang_kz' => $student_data->studiengang_kz, + 'semester' => $incomingAusbildungssemester, + 'verband' => $incomingVerband, + 'gruppe' => ' ', + 'insertamum' => date('Y-m-d H:i:s'), + 'insertvon' => $authUID + ]); + + if (isError($result)) + return $result; + + return success($prestudent_id); + } + protected function setBasic($authUID, $now, $status_kurzbz, $prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id = null) { $result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id); diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index de91319b9..c0ed8595e 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -290,7 +290,11 @@ class Prestudentstatus_model extends DB_Model */ public function getLastStatusPerson($person_id, $studiensemester_kurzbz = null) { - $query = 'SELECT * + $query = 'SELECT p.*, ps.*, s.*, + stg.kurzbz AS studiengang_kurzbz, stg.kurzbzlang AS studiengang_kurzbzlang, + UPPER(typ::varchar(1) || kurzbz) AS studiengang_kuerzel, + stg.typ AS studiengang_typ, stg.bezeichnung AS studiengang_bezeichnung, stg.english AS studiengang_bezeichnung_english, + stg.orgform_kurzbz AS studiengang_orgform FROM public.tbl_prestudent p JOIN ( SELECT DISTINCT ON(prestudent_id) * @@ -298,7 +302,8 @@ class Prestudentstatus_model extends DB_Model WHERE prestudent_id IN (SELECT prestudent_id FROM public.tbl_prestudent WHERE person_id = ?) ORDER BY prestudent_id, datum desc, insertamum desc ) ps USING(prestudent_id) - JOIN public.tbl_status USING(status_kurzbz)'; + JOIN public.tbl_status s USING(status_kurzbz) + JOIN public.tbl_studiengang stg USING (studiengang_kz)'; $parametersArray = array($person_id); diff --git a/application/models/crm/Student_model.php b/application/models/crm/Student_model.php index 19e57b6dc..3a5f5cfde 100644 --- a/application/models/crm/Student_model.php +++ b/application/models/crm/Student_model.php @@ -27,7 +27,7 @@ class Student_model extends DB_Model $this->addSelect('1'); $result = $this->loadWhere(array('student_uid' => $uid)); - + if(hasData($result)) { @@ -169,7 +169,7 @@ class Student_model extends DB_Model $max = 0; if ($matrikelnrres && hasData($matrikelnrres)) { - $max = mb_substr($matrikelnrres->retval[0]->matrikelnr, 7); + $max = mb_substr(getData($matrikelnrres)[0]->matrikelnr, 7); if (!is_numeric($max)) { $max = (int)$max; } diff --git a/application/models/education/Projektarbeit_model.php b/application/models/education/Projektarbeit_model.php index c5d66b103..ea16b5587 100644 --- a/application/models/education/Projektarbeit_model.php +++ b/application/models/education/Projektarbeit_model.php @@ -24,17 +24,28 @@ class Projektarbeit_model extends DB_Model public function getProjektarbeit($student_uid, $studiengang_kz = null, $studiensemester_kurzbz = null, $projekttyp = null, $final = null) { $qry = "SELECT - tbl_projektarbeit.*, tbl_projekttyp.bezeichnung, + pa.*, tbl_projekttyp.bezeichnung, tbl_lehreinheit.studiensemester_kurzbz, tbl_lehrveranstaltung.lehrveranstaltung_id, - tbl_firma.name AS firma_name + tbl_firma.name AS firma_name, + ( + SELECT + STRING_AGG(trim(COALESCE(titelpre,'')||' '||COALESCE(vorname,'')||' '||COALESCE(nachname,'')||' '||COALESCE(titelpost,'')), ', ') + FROM + lehre.tbl_projektbetreuer + JOIN public.tbl_person USING (person_id) + WHERE + projektarbeit_id = pa.projektarbeit_id + AND student_uid = pa.student_uid + GROUP BY projektarbeit_id + ) AS projektbetreuer FROM - lehre.tbl_projektarbeit + lehre.tbl_projektarbeit pa JOIN lehre.tbl_projekttyp USING (projekttyp_kurzbz) JOIN lehre.tbl_lehreinheit USING (lehreinheit_id) JOIN lehre.tbl_lehrveranstaltung USING (lehrveranstaltung_id) LEFT JOIN public.tbl_firma USING (firma_id) WHERE - tbl_projektarbeit.student_uid = ?"; + pa.student_uid = ?"; $params = array($student_uid); diff --git a/application/models/person/Profil_update_model.php b/application/models/person/Profil_update_model.php index 31005c4b7..039810537 100644 --- a/application/models/person/Profil_update_model.php +++ b/application/models/person/Profil_update_model.php @@ -135,7 +135,8 @@ class Profil_update_model extends DB_Model attachment_id, UPPER(public.tbl_studiengang.typ || public.tbl_studiengang.kurzbz) AS studiengang, COALESCE(of.orgform_kurzbz, public.tbl_studiengang.orgform_kurzbz) AS orgform, - NULL as oezuordnung + NULL as oezuordnung, + tbl_student.semester FROM public.tbl_profil_update JOIN public.tbl_profil_update_status ON public.tbl_profil_update_status.status_kurzbz = public.tbl_profil_update.status JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid diff --git a/application/models/ressource/Stundensatz_model.php b/application/models/ressource/Stundensatz_model.php index c8ee367d8..2a7418924 100644 --- a/application/models/ressource/Stundensatz_model.php +++ b/application/models/ressource/Stundensatz_model.php @@ -47,7 +47,6 @@ class Stundensatz_model extends DB_Model { $this->load->config('stv'); - $useFixangestelltStundensatz = $this->config->item('tabs')['projektarbeit']['lvLektroinnenzuteilungFixangestelltStundensatz']; $defaultStundensatz = $this->config->item('tabs')['projektarbeit']['defaultProjektbetreuerStundensatz']; $stundensatz = ''; @@ -63,7 +62,7 @@ class Stundensatz_model extends DB_Model { $studiensemester = getData($result)[0]; - if (isset($useFixangestelltStundensatz) && !$useFixangestelltStundensatz) + if (defined('FAS_LV_LEKTORINNENZUTEILUNG_FIXANGESTELLT_STUNDENSATZ') && !FAS_LV_LEKTORINNENZUTEILUNG_FIXANGESTELLT_STUNDENSATZ) { // load Mitarbeiter $params = [$person_id]; @@ -83,19 +82,30 @@ class Stundensatz_model extends DB_Model if (hasData($result)) { - foreach (getData($result) as $ma) - { - if (!$ma->fixangestellt) - { - $stundensatzRes = $this->getStundensatzByDatum( - $ma->mitarbeiter_uid, $studiensemester->start, $studiensemester->ende, 'lehre' - ); + $ma = getData($result)[0]; - if (hasData($stundensatzRes)) - $stundensatz = getData($stundensatzRes)[0]->stundensatz; - else - $stundensatz = '0.00'; - } + $this->load->model('vertragsbestandteil/Dienstverhaeltnis_model','DienstverhaeltnisModel'); + $echterdv_result = $this->DienstverhaeltnisModel->existsDienstverhaeltnis( + $ma->mitarbeiter_uid, + $studiensemester->start, + $studiensemester->ende, + 'echterdv' + ); + + if (hasData($echterdv_result)) + { + $stundensatz = null; + } + else + { + $stundensatzRes = $this->getStundensatzByDatum( + $ma->mitarbeiter_uid, $studiensemester->start, $studiensemester->ende, 'lehre' + ); + + if (hasData($stundensatzRes)) + $stundensatz = getData($stundensatzRes)[0]->stundensatz; + else + $stundensatz = '0.00'; } } else diff --git a/application/views/Nachrichten.php b/application/views/Nachrichten.php index cf34bfd53..0d0e8e707 100644 --- a/application/views/Nachrichten.php +++ b/application/views/Nachrichten.php @@ -40,6 +40,10 @@ $configArray = [ cis-root="= CIS_ROOT; ?>" :permissions="= htmlspecialchars(json_encode($permissions)); ?>" :config="= htmlspecialchars(json_encode($configArray)); ?>" + + :id ="= htmlspecialchars(json_encode($ids)); ?>" + type-id ="= htmlspecialchars($typeid); ?>" + > diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index f24a302cc..37bedbdcb 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -360,4 +360,8 @@ define('SANCHO_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); // footer image for eigene Mails define('SANCHO_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); + +// Gibt an, ob in der StudVW der Status vorgerueckt werden kann +define('STATUS_VORRUECKEN_ANZEIGEN', true); + ?> diff --git a/public/js/api/factory/messages/messages.js b/public/js/api/factory/messages/messages.js index c6d4b67b6..b7b21dd8a 100644 --- a/public/js/api/factory/messages/messages.js +++ b/public/js/api/factory/messages/messages.js @@ -38,16 +38,18 @@ export default { url: 'api/frontend/v1/messages/messages/getMsgVarsLoggedInUser/' }; }, - getMessageVarsPerson(userParams){ + getMessageVarsPerson(ids, type_id){ return { method: 'post', - url: 'api/frontend/v1/messages/messages/getMessageVarsPerson/' + userParams.id + '/' + userParams.type_id + url: 'api/frontend/v1/messages/messages/getMessageVarsPerson/' + type_id, + params: {ids} }; }, - getMsgVarsPrestudent(userParams){ + getMsgVarsPrestudent(ids, type_id){ return { method: 'post', - url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + userParams.id + '/' + userParams.type_id + url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + type_id, + params: {ids} }; }, getPersonId(params){ @@ -56,28 +58,23 @@ export default { url: 'api/frontend/v1/messages/messages/getPersonId/' + params.id + '/' + params.type_id }; }, - getUid(userParams){ - return { - method: 'get', - url: 'api/frontend/v1/messages/messages/getUid/' + userParams.id + '/' + userParams.type_id - }; - }, getDataVorlage(vorlage_kurzbz){ return { method: 'get', url: 'api/frontend/v1/messages/messages/getDataVorlage/' + vorlage_kurzbz }; }, - getNameOfDefaultRecipient(params){ - return { - method: 'get', - url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipient/' + params.id + '/' + params.type_id - }; - }, - getPreviewText(userParams, params){ + getNameOfDefaultRecipients(ids, type_id){ return { method: 'post', - url: 'api/frontend/v1/messages/messages/getPreviewText/' + userParams.id + '/' + userParams.type_id, + url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipients/' + type_id, + params: {ids} + }; + }, + getPreviewText(type_id, params){ + return { + method: 'post', + url: 'api/frontend/v1/messages/messages/getPreviewText/' + type_id, params }; }, @@ -87,17 +84,10 @@ export default { url: 'api/frontend/v1/messages/messages/getReplyData/' + messageId }; }, - sendMessageFromModalContext(id, params) { + sendMessage(type_id, params) { return { method: 'post', - url: 'api/frontend/v1/messages/messages/sendMessage/' + id, - params - }; - }, - sendMessage(id, params) { - return { - method: 'post', - url: 'api/frontend/v1/messages/messages/sendMessage/' + id, + url: 'api/frontend/v1/messages/messages/sendMessage/' + type_id, params }; }, diff --git a/public/js/api/factory/studienplan.js b/public/js/api/factory/studienplan.js new file mode 100644 index 000000000..550a5211c --- /dev/null +++ b/public/js/api/factory/studienplan.js @@ -0,0 +1,11 @@ +export default { + + getStudienplaeneBySemester(studiengang_kz, studiensemester_kurzbz, ausbildungssemester, orgform_kurzbz) + { + return { + method: 'get', + url: 'api/frontend/v1/organisation/studienplan/getBySemester', + params: { studiengang_kz, studiensemester_kurzbz, ausbildungssemester, orgform_kurzbz }, + }; + } +} \ No newline at end of file diff --git a/public/js/api/factory/studiensemester.js b/public/js/api/factory/studiensemester.js index 82a4ee5cc..7fe4a22d3 100644 --- a/public/js/api/factory/studiensemester.js +++ b/public/js/api/factory/studiensemester.js @@ -21,5 +21,13 @@ export default { method: 'get', url: '/api/frontend/v1/organisation/Studiensemester/getAllStudiensemesterAndAktOrNext', }; + }, + getAll(order = null, start = null) + { + return { + method: 'get', + url: 'api/frontend/v1/organisation/studiensemester/getAll', + params: { order, start } + }; } }; \ No newline at end of file diff --git a/public/js/api/factory/stv/mobility.js b/public/js/api/factory/stv/mobility.js index fc4fd17b4..fcff30954 100644 --- a/public/js/api/factory/stv/mobility.js +++ b/public/js/api/factory/stv/mobility.js @@ -101,7 +101,7 @@ export default { deleteMobilityPurpose(params) { return { method: 'post', - url: 'api/frontend/v1/stv/mobility/deleteMobilityPurpose/', + url: 'api/frontend/v1/stv/mobility/deleteMobilityPurpose/' + params.bisio_id, params }; }, diff --git a/public/js/api/factory/stv/projektarbeit.js b/public/js/api/factory/stv/projektarbeit.js index 4412f1842..e9b3e7efc 100644 --- a/public/js/api/factory/stv/projektarbeit.js +++ b/public/js/api/factory/stv/projektarbeit.js @@ -49,6 +49,12 @@ export default { url: 'api/frontend/v1/stv/projektarbeit/getNoten' }; }, + getStudiensemester() { + return { + method: 'get', + url: 'api/frontend/v1/stv/projektarbeit/getStudiensemester' + }; + }, loadProjektarbeit(projektarbeit_id) { return { method: 'get', diff --git a/public/js/api/factory/stv/students.js b/public/js/api/factory/stv/students.js index cae2f31b2..c17e32ff9 100644 --- a/public/js/api/factory/stv/students.js +++ b/public/js/api/factory/stv/students.js @@ -60,10 +60,10 @@ export default { url: 'api/frontend/v1/stv/students/' + relative_path }; }, - check(params) { + getPerson(params) { return { method: 'post', - url: 'api/frontend/v1/stv/student/check', + url: 'api/frontend/v1/stv/student/getPerson', params }; }, diff --git a/public/js/apps/Nachrichten.js b/public/js/apps/Nachrichten.js index 84b9ddee5..ab9baf084 100644 --- a/public/js/apps/Nachrichten.js +++ b/public/js/apps/Nachrichten.js @@ -1,14 +1,15 @@ import NewMessage from "../components/Messages/Details/NewMessage/NewDiv.js"; -import Phrasen from "../plugin/Phrasen.js"; +import Phrasen from "../plugins/Phrasen.js"; const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router; const router = VueRouter.createRouter({ history: VueRouter.createWebHistory(), routes: [ - { path: `/${ciPath}/NeueNachricht/:id/:typeId`, component: NewMessage }, - { path: `/${ciPath}/NeueNachricht/:id/:typeId/:messageId`, component: NewMessage }, + { path: `/${ciPath}/NeueNachricht`, component: NewMessage, props: true }, + { path: `/${ciPath}/NeueNachricht/:id/:typeId`, component: NewMessage, props: true }, + { path: `/${ciPath}/NeueNachricht/:id/:typeId/:messageId`, component: NewMessage, props: true }, ] }); diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index 745f53002..9798ba7a4 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -46,7 +46,6 @@ export default { loading: false, filter: "Pending", profil_update_id: Number(this.id), - }; }, computed: { @@ -60,6 +59,10 @@ export default { }, profilUpdateOptions: function () { return { + persistence: { + columns: ["width", "visible", "frozen"], + }, + persistenceID: 'cis-profilupdate-2025121702', ajaxURL: 'dummy', ajaxRequestFunc: (url, config, params) => { return this.$api.call(ApiProfilUpdate.getProfilUpdateWithPermission(params.filter)); @@ -205,7 +208,7 @@ export default { //responsive:0, }, { - title: this.$p.t("lehre", "studiengang") + ' (' + this.$p.t("profil", "studentIn") + ')', + title: this.$p.t("profil", "stg_short") + ' (' + this.$p.t("profil", "studentIn") + ')', field: "studiengang", minWidth: 50, resizable: true, @@ -213,8 +216,14 @@ export default { headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"}, //responsive:0, }, - { - title: this.$p.t("lehre", "organisationsform") + ' (' + this.$p.t("profil", "studentIn") + ')', + { + title: this.$p.t("profil", "sem_short") + ' (' + this.$p.t("profil", "studentIn") + ')', + field: "semester", + headerFilter: "list", + headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"} + }, + { + title: this.$p.t("profil", "orgform_short") + ' (' + this.$p.t("profil", "studentIn") + ')', field: "orgform", minWidth: 50, resizable: true, @@ -222,8 +231,8 @@ export default { headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"}, //responsive:0, }, - { - title: this.$p.t("lehre", "organisationseinheit") + ' (' + this.$p.t("profil", "mitarbeiterIn") + ')', + { + title: this.$p.t("profil", "orgeinheit_short") + ' (' + this.$p.t("profil", "mitarbeiterIn") + ')', field: "oezuordnung", minWidth: 200, resizable: true, @@ -231,7 +240,7 @@ export default { headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"}, //responsive:0, }, - { + { title: this.$p.t("profilUpdate", "Topic"), field: "topic", resizable: true, @@ -240,7 +249,7 @@ export default { headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"}, //responsive:0, }, - { + { title: this.$p.t("profilUpdate", "insertamum"), field: "insertamum_iso", resizable: true, @@ -251,7 +260,7 @@ export default { formatterParams: this.datetimeFormatterParams(), //responsive:0, }, - { + { title: this.$p.t("profilUpdate", "Status"), field: "status_translated", hozAlign: "center", @@ -273,7 +282,6 @@ export default { } return `