mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Update response/error handling
This commit is contained in:
@@ -100,7 +100,8 @@ class Notiz extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//Überprüfung ob type übergeben wurde (entweder Funktions- oder Postparameter)
|
||||
//Überprüfung ob type übergeben wurde (via Funktions- oder Postparameter)
|
||||
$type = null;
|
||||
if ($paramTyp)
|
||||
$type = $paramTyp;
|
||||
if(isset($_POST['typeId']))
|
||||
@@ -108,8 +109,10 @@ class Notiz extends FHC_Controller
|
||||
|
||||
if(!$type)
|
||||
{
|
||||
//Todo(manu) return error
|
||||
var_dump("ERROR no type");
|
||||
$result = error('kein Type für ID vorhanden', EXIT_ERROR);
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
|
||||
//Form Validation
|
||||
@@ -126,7 +129,7 @@ class Notiz extends FHC_Controller
|
||||
$erledigt = $this->input->post('erledigt');
|
||||
$verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : $uid;
|
||||
$bearbeiter_uid = isset($_POST['bearbeiter']) ? $_POST['bearbeiter'] : null;
|
||||
//$type = $this->input->post('typeId');
|
||||
$type = $this->input->post('typeId');
|
||||
$start = $this->input->post('von');
|
||||
$ende = $this->input->post('bis');
|
||||
|
||||
|
||||
@@ -156,14 +156,21 @@ class Notiz_model extends DB_Model
|
||||
$this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel');
|
||||
|
||||
//check if valid type
|
||||
$isValidType = $this->NotizzuordnungModel->isValidType($type);
|
||||
$result = $this->NotizzuordnungModel->isValidType($type);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
$result = error($result->retval, EXIT_ERROR);
|
||||
return $result;
|
||||
}
|
||||
/*
|
||||
if(!$isValidType)
|
||||
{
|
||||
//Todo manu (correct return to controller)
|
||||
$msg = "datatype " . $type . " not implemented for notes";
|
||||
return error($msg, EXIT_ERROR);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
@@ -14,7 +14,6 @@ class Notizzuordnung_model extends DB_Model
|
||||
|
||||
public function isValidType($type)
|
||||
{
|
||||
//var_dump($type);
|
||||
$validTypes = [];
|
||||
|
||||
$qry = "
|
||||
@@ -22,24 +21,25 @@ class Notizzuordnung_model extends DB_Model
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'tbl_notizzuordnung'
|
||||
AND column_name not in ('notizzuordnung_id', 'notiz_id')
|
||||
";
|
||||
|
||||
$type_arr = $this->execQuery($qry);
|
||||
$type_arr = $type_arr->retval;
|
||||
|
||||
foreach ($type_arr as $t) {
|
||||
foreach ($type_arr as $t)
|
||||
{
|
||||
$validTypes[] = $t->column_name;
|
||||
}
|
||||
|
||||
if (in_array($type, $validTypes))
|
||||
{
|
||||
// var_dump($type . " is IN ARRAY");
|
||||
return true;
|
||||
$result = success('Type of Id is valid');
|
||||
}
|
||||
else
|
||||
{
|
||||
//var_dump($type . " is NOT IN ARRAY");
|
||||
return false;
|
||||
$result = error('Type of Id is not valid');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ export default {
|
||||
multiupload: true,
|
||||
mitarbeiter: [],
|
||||
filteredMitarbeiter: [],
|
||||
/* filteredFirmen: []*/
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -50,14 +49,6 @@ export default {
|
||||
this.$emit('update:text', value);
|
||||
}
|
||||
},
|
||||
/* intLastChange: {
|
||||
get() {
|
||||
return this.lastChange;
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:lastChange', value);
|
||||
}
|
||||
},*/
|
||||
intVon: {
|
||||
get() {
|
||||
return this.von;
|
||||
@@ -128,7 +119,6 @@ export default {
|
||||
reset() {
|
||||
this.$refs.form.reset();
|
||||
this.intAnhang = null;
|
||||
//this.$emit('update:anhang', []);
|
||||
},
|
||||
|
||||
search(event) {
|
||||
@@ -143,7 +133,8 @@ export default {
|
||||
|
||||
template: `
|
||||
<div class="notiz-notiz">
|
||||
<span v-for="(anhang,index) in intAnhang"> {{anhang.name}} {{index}}<br></span>
|
||||
<!-- <p>testausgaben child</p>
|
||||
<span v-for="(anhang,index) in intAnhang"> {{anhang.name}} {{index}}<br></span>-->
|
||||
<form ref="form" @submit.prevent class="row">
|
||||
<div>
|
||||
<div class="row mb-3">
|
||||
@@ -240,7 +231,6 @@ export default {
|
||||
<div class="row mb-3">
|
||||
<label for="lastChange" class="form-label col-sm-2 small">letzte Änderung</label>
|
||||
<div class="col-sm-7">
|
||||
<!-- <input v-model="lastChange" >-->
|
||||
<p class="small">{{this.lastChange}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -150,7 +150,9 @@ export default {
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$fhcAlert.alertError('Fehler bei Speicherroutine aufgetreten');
|
||||
if (error.response) {
|
||||
this.$fhcAlert.alertError(error.response.data);
|
||||
}
|
||||
}).finally(() => {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
@@ -210,7 +212,6 @@ export default {
|
||||
},
|
||||
resetFormData(){
|
||||
this.$refs.form.reset();
|
||||
//sicherstellen, dass über props nur leere felder übergeben werden
|
||||
this.formData = {
|
||||
typeId: 'person_id',
|
||||
titel: null,
|
||||
|
||||
Reference in New Issue
Block a user