Phrases History and Status, Formvalidation Prestudent

This commit is contained in:
ma0068
2024-03-25 09:09:40 +01:00
parent 1b3c052c12
commit b907f01ebb
5 changed files with 53 additions and 26 deletions
@@ -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))
@@ -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);
});
@@ -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({
@@ -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;*/
+20 -1
View File
@@ -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'
)
)
),
);