From 1fb019b7959f6f981e88e8c9b012001172014737 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 12 Apr 2024 10:28:39 +0200 Subject: [PATCH 01/10] Search by person --- .../controllers/components/stv/Students.php | 79 ++++++++++++++++++- public/js/apps/Studentenverwaltung.js | 3 +- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/application/controllers/components/stv/Students.php b/application/controllers/components/stv/Students.php index 3d22075cc..9bd2df73f 100644 --- a/application/controllers/components/stv/Students.php +++ b/application/controllers/components/stv/Students.php @@ -38,7 +38,8 @@ class Students extends FHC_Controller * /(studiengang_kz)/(org_form)/(semester)/(verband)/(gruppe) * => getStudents * /uid/(student_uid) => getStudent - * /prestudent/(prestudent_id) => getPrestudent + * /prestudent/(prestudent_id) => getPrestudent + * /person/(person_id) => getPerson * * @param string $method * @param array $params (optional) @@ -75,6 +76,9 @@ class Students extends FHC_Controller if ($method == 'prestudent' && $count == 1) return $this->getPrestudent($params[0]); + if ($method == 'person' && $count == 1) + return $this->getPerson($params[0]); + if (is_numeric($params[0])) { $sem = $params[0]; if ($count == 3 && $params[1] == 'grp') { @@ -577,4 +581,77 @@ class Students extends FHC_Controller $this->outputJson(getData($result) ?: []); } } + + /** + * @param integer $person_id + * + * @return void + */ + protected function getPerson($person_id) + { + $studiensemester_kurzbz = $this->variablelib->getVar('semester_aktuell'); + + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->PrestudentModel->addJoin('public.tbl_person p', 'person_id'); + $this->PrestudentModel->addJoin('public.tbl_student s', 'prestudent_id'); + $this->PrestudentModel->addJoin('public.tbl_benutzer b', 's.student_uid=b.uid'); + $this->PrestudentModel->addJoin( + 'public.tbl_studentlehrverband v', + 'v.student_uid=s.student_uid AND v.studiensemester_kurzbz=' . $this->PrestudentModel->escape($studiensemester_kurzbz), + 'LEFT' + ); + + $this->PrestudentModel->addSelect('p.person_id'); + $this->PrestudentModel->addSelect('s.prestudent_id'); + $this->PrestudentModel->addSelect('b.uid'); + $this->PrestudentModel->addSelect('titelpre'); + $this->PrestudentModel->addSelect('titelpost'); + $this->PrestudentModel->addSelect('vorname'); + $this->PrestudentModel->addSelect('wahlname'); + $this->PrestudentModel->addSelect('vornamen'); + $this->PrestudentModel->addSelect('geschlecht'); + $this->PrestudentModel->addSelect('nachname'); + $this->PrestudentModel->addSelect('gebdatum'); + $this->PrestudentModel->addSelect('tbl_prestudent.anmerkung'); + $this->PrestudentModel->addSelect('ersatzkennzeichen'); + $this->PrestudentModel->addSelect('svnr'); + $this->PrestudentModel->addSelect('s.matrikelnr'); + $this->PrestudentModel->addSelect('p.anmerkung AS anmerkungen'); + $this->PrestudentModel->addSelect('v.semester'); + $this->PrestudentModel->addSelect('v.verband'); + $this->PrestudentModel->addSelect('v.gruppe'); + $this->PrestudentModel->addSelect('tbl_prestudent.studiengang_kz'); + $this->PrestudentModel->addSelect('aufmerksamdurch_kurzbz'); + $this->PrestudentModel->addSelect('mentor'); + $this->PrestudentModel->addSelect('b.aktiv AS bnaktiv'); + $this->PrestudentModel->addSelect( + "(SELECT kontakt FROM public.tbl_kontakt WHERE kontakttyp='email' AND person_id=p.person_id AND zustellung LIMIT 1) AS email_privat", + false + ); + $this->PrestudentModel->addSelect( + "(SELECT rt_gesamtpunkte AS punkte FROM public.tbl_prestudent WHERE prestudent_id=s.prestudent_id) AS punkte", + false + ); + $this->PrestudentModel->addSelect('tbl_prestudent.dual'); + $this->PrestudentModel->addSelect('tbl_prestudent.reihungstest_id'); + $this->PrestudentModel->addSelect('tbl_prestudent.anmeldungreihungstest'); + $this->PrestudentModel->addSelect('p.matr_nr'); + $this->PrestudentModel->addSelect('tbl_prestudent.gsstudientyp_kurzbz'); + $this->PrestudentModel->addSelect('tbl_prestudent.aufnahmegruppe_kurzbz'); + $this->PrestudentModel->addSelect('tbl_prestudent.priorisierung'); + $this->PrestudentModel->addSelect('p.zugangscode'); + $this->PrestudentModel->addSelect('p.bpk'); + + $result = $this->PrestudentModel->loadWhere([ + 'p.person_id' => $person_id + ]); + + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson(getError($result)); + } else { + $this->outputJson(getData($result) ?: []); + } + } } diff --git a/public/js/apps/Studentenverwaltung.js b/public/js/apps/Studentenverwaltung.js index dc3e7522b..a282a45e3 100644 --- a/public/js/apps/Studentenverwaltung.js +++ b/public/js/apps/Studentenverwaltung.js @@ -34,7 +34,8 @@ import(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_route { path: `/${ciPath}/studentenverwaltung`, component: FhcStudentenverwaltung }, { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id`, component: FhcStudentenverwaltung }, { path: `/${ciPath}/studentenverwaltung/prestudent/:prestudent_id/:tab`, component: FhcStudentenverwaltung }, - { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung } + { path: `/${ciPath}/studentenverwaltung/student/:id`, component: FhcStudentenverwaltung }, + { path: `/${ciPath}/studentenverwaltung/person/:person_id`, component: FhcStudentenverwaltung } ] }); From 054ef5d00fd9d9033e9a30d599d76df63f182f3b Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 12 Apr 2024 10:29:06 +0200 Subject: [PATCH 02/10] Bugfix Api: clearValidation --- public/js/plugin/FhcApi.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/js/plugin/FhcApi.js b/public/js/plugin/FhcApi.js index bacd27d43..32440ea80 100644 --- a/public/js/plugin/FhcApi.js +++ b/public/js/plugin/FhcApi.js @@ -156,7 +156,6 @@ export default { const $fhcAlert = app.config.globalProperties.$fhcAlert; if (form) { - form.clearValidation(); form.setFeedback(false, error.messages); return false; } From 10a6d374f17ed76f84bb0da891fae37ace1aba29 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 12 Apr 2024 10:29:57 +0200 Subject: [PATCH 03/10] FHC-Core-SAP Phrases --- system/phrasesupdate.php | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 3f7952ea1..abeb972a5 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -26532,6 +26532,47 @@ array( ) ) ), + // FHC-Core-SAP + array( + 'app' => 'core', + 'category' => 'sap', + 'phrase' => 'error_noBuchung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Die Buchungsnr #{buchungsnr} is ungültig', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'The Buchungnr #{buchungsnr} is not valid', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'sap', + 'phrase' => 'error_buchungLocked', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Die Buchung wurde bereits übertragen und darf nicht geändert werden', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'The Buchung was already submitted and can not be changed', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 44d60e5f5230680a0499604b6a21a96ef2152863 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 12 Apr 2024 10:31:22 +0200 Subject: [PATCH 04/10] Validation Stg Permissions --- application/helpers/hlp_common_helper.php | 42 ++++++++++++++++++- .../language/english/form_validation_lang.php | 5 ++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php index 688fae965..40aed007c 100644 --- a/application/helpers/hlp_common_helper.php +++ b/application/helpers/hlp_common_helper.php @@ -449,14 +449,52 @@ function is_valid_date($dateString) function has_write_permissions($value, $permissions = '') { if (!$permissions) - $permissions = $value; // TODO(chris): ?? + $permissions = $value; $permissions = explode(',', $permissions); $CI =& get_instance(); + $CI->load->library('AuthLib'); $CI->load->library('PermissionLib'); + return $CI->permissionlib->hasAtLeastOne( $permissions, 'sometable', - 'w' + PermissionLib::WRITE_RIGHT ); } + +/** + * check if has permissions for a studiengang_kz + */ +function has_permissions_for_stg($studiengang_kz, $permissions = '') +{ + if (!$permissions) + return false; + $permissions = explode(',', $permissions); + + $CI =& get_instance(); + $CI->load->library('AuthLib'); + $CI->load->library('PermissionLib'); + + foreach ($permissions as $perm) { + if (strpos($perm, PermissionLib::PERMISSION_SEPARATOR) === false) { + $CI->addError( + 'The given permission does not use the correct format', + FHCAPI_Controller::ERROR_TYPE_GENERAL + ); + return false; + } + + list($perm, $accesstype) = explode(PermissionLib::PERMISSION_SEPARATOR, $perm); + $at = ''; + if (strpos($accesstype, PermissionLib::READ_RIGHT) !== false) + $at = PermissionLib::SELECT_RIGHT; // S + if (strpos($accesstype, PermissionLib::WRITE_RIGHT) !== false) + $at .= PermissionLib::REPLACE_RIGHT.PermissionLib::DELETE_RIGHT; // UID + + if ($CI->permissionlib->isBerechtigt($perm, $at, $studiengang_kz)) + return true; + } + + return false; +} diff --git a/application/language/english/form_validation_lang.php b/application/language/english/form_validation_lang.php index 9e942f8e5..b8918a721 100644 --- a/application/language/english/form_validation_lang.php +++ b/application/language/english/form_validation_lang.php @@ -36,7 +36,8 @@ * @since Version 1.0.0 * @filesource */ -defined('BASEPATH') OR exit('No direct script access allowed'); +if (!defined('BASEPATH')) exit('No direct script access allowed'); $lang['form_validation_has_write_permissions'] = 'You have no rights to edit {field} field.'; -$lang['form_validation_is_valid_date'] = 'The date format is invalid or out of range.'; \ No newline at end of file +$lang['form_validation_is_valid_date'] = 'The date format is invalid or out of range.'; +$lang['form_validation_has_permissions_for_stg'] = 'You have no rights for stg {field}.'; From e32bf2df57e40b6daa5bb27d0483b405fbdfa8c5 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Fri, 12 Apr 2024 10:33:40 +0200 Subject: [PATCH 05/10] BsModal: send event objects on emit --- public/js/components/Bootstrap/Modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/components/Bootstrap/Modal.js b/public/js/components/Bootstrap/Modal.js index 453cc0b48..831a8929c 100644 --- a/public/js/components/Bootstrap/Modal.js +++ b/public/js/components/Bootstrap/Modal.js @@ -93,7 +93,7 @@ export default { document.body.appendChild(wrapper); }); }, - template: `