diff --git a/application/controllers/components/stv/Prestudent.php b/application/controllers/components/stv/Prestudent.php index 1a47b2162..093126272 100644 --- a/application/controllers/components/stv/Prestudent.php +++ b/application/controllers/components/stv/Prestudent.php @@ -16,9 +16,9 @@ class Prestudent extends FHC_Controller $this->load->library('PermissionLib'); // Load language phrases - /* $this->loadPhrases([ - 'ui' - ]);*/ + $this->loadPhrases([ + 'ui', 'studierendenantrag' + ]); } public function get($prestudent_id) @@ -44,20 +44,6 @@ class Prestudent extends FHC_Controller $this->load->library('form_validation'); $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - //Todo(manu) Validierungen - -/* $result = $this->PrestudentModel->loadWhere(['prestudent_id' =>$prestudent_id]); - if (isError($result)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($result)); - } elseif (!hasData($result)) { - return $this->outputJson(getError($result)); - } else { - $prestudentData = current(getData($result)); - } - - var_dump($prestudentData);*/ - //get Studiengang von prestudent_id $this->load->model('crm/Prestudent_model', 'PrestudentModel'); $result = $this->PrestudentModel->load([ @@ -74,13 +60,25 @@ class Prestudent extends FHC_Controller if (!$this->permissionlib->isBerechtigt('admin', 'suid', $stg) && !$this->permissionlib->isBerechtigt('assistenz', 'suid', $stg)) { - $result = "Sie haben keine Schreibrechte fuer diesen Studiengang!"; + $result = $this->p->t('lehre','error_keineSchreibrechte'); $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson($result); } + //TODO(Manu) neuer API Controller $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); + + //Form validation + $this->form_validation->set_rules('priorisierung', 'Priorisierung', 'numeric', [ + 'numeric' => $this->p->t('ui','error_fieldNotNumeric',['field' => 'Priorisierung']) + ]); + + if ($this->form_validation->run() == false) + { + return $this->outputJsonError($this->form_validation->error_array()); + } + $deltaData = $_POST; if(!$prestudent_id) @@ -147,11 +145,11 @@ class Prestudent extends FHC_Controller } $update_prestudent_encoded = array_map('utf8_decode_if_string', $update_prestudent); - if (count($update_prestudent) && $prestudent_id === null) { $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST); - // TODO(manu): phrase - return $this->outputJson("Kein/e PrestudentIn vorhanden!"); + // TODO(manu): check phrase + //return $this->outputJson("Kein/e PrestudentIn vorhanden!"); + return $this->outputJson($this->p->t('studierendenantrag','error_no_prestudent', $prestudent_id)); } if (count($update_prestudent)) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index 008e581fa..3c33c7d55 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -116,8 +116,11 @@ export default { }); } }).catch(error => { - this.statusMsg = 'Error in Catch'; - this.$fhcAlert.alertError('Fehler bei Speicherroutine aufgetreten'); + if (error.response && error.response.data) { + this.$fhcAlert.alertError(error.response.data); + } else { + this.$fhcAlert.alertError("Fehler bei Speicherroutine aufgetreten"); + } }).finally(() => { window.scrollTo(0, 0); }); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js index 78c004538..54a42bba8 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/History.js @@ -22,6 +22,7 @@ export default{ {title:"UID", field:"student_uid"}, {title:"Status", field:"status"} ], + // tabulatorEvents: [], layout: 'fitDataFill', layoutColumnsOnNewData: false, height: 'auto', @@ -32,8 +33,10 @@ export default{ async mounted(){ await this.$p.loadCategory(['lehre']); + let cm = this.$refs.table.tabulator.columnManager; + cm.getColumnByField('orgform_kurzbz').component.updateDefinition({ - title: this.$p.t('lehre', 'Organisationsform') + title: this.$p.t('lehre', 'organisationsform') }); cm.getColumnByField('bezeichnung').component.updateDefinition({ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 79eec07cc..22b64a393 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -375,7 +375,11 @@ export default{ } else { - const errorData = result.data.retval; +/* const errorData = result.data.retval; + Object.entries(errorData).forEach(entry => { + const [key, value] = entry; + this.$fhcAlert.alertError(value); + });*/ this.$fhcAlert.alertError('Kein Status mit Id ' + status_id + ' gefunden'); } /* return result;*/ diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index cc09201d5..8f53c4bf6 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -21991,7 +21991,7 @@ array( ), array( 'app' => 'core', - 'category' => 'studierendenantrag', + 'category' => 'studierendenantrag',q 'phrase' => 'error_no_prestudent', 'insertvon' => 'system', 'phrases' => array( @@ -25886,6 +25886,25 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'error_keineSchreibrechte', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Sie haben keine Schreibrechte fuer diesen Studiengang!', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'You do not have writing rights for this course!', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );