UDFs Prestudent aktivieren

This commit is contained in:
cgfhtw
2024-08-13 11:29:24 +02:00
parent 761ec96662
commit 3d07aa3bd0
3 changed files with 28 additions and 3 deletions
@@ -57,9 +57,19 @@ class Prestudent extends FHCAPI_Controller
public function updatePrestudent($prestudent_id)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
// UDF
$this->load->library('UDFLib');
$result = $this->udflib->getCiValidations($this->PrestudentModel, $this->input->post());
$udf_field_validations = $this->getDataOrTerminateWithError($result);
//Form validation
$this->load->library('form_validation');
$this->form_validation->set_rules($udf_field_validations);
$this->form_validation->set_rules('priorisierung', 'Priorisierung', 'numeric', [
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Priorisierung'])
]);
@@ -105,6 +115,14 @@ class Prestudent extends FHCAPI_Controller
'standort_code'
];
// add UDFs
$result = $this->udflib->getDefinitionForModel($this->PrestudentModel);
$definitions = $this->getDataOrTerminateWithError($result);
foreach ($definitions as $def)
$array_allowed_props_prestudent[] = $def['name'];
$update_prestudent = array();
foreach ($array_allowed_props_prestudent as $prop)
{
@@ -143,9 +143,9 @@ class Student extends FHCAPI_Controller
$result = $this->udflib->getCiValidations($this->PersonModel, $this->input->post());
//TODO(Manu) check with Chris: input number not allowed
$field_validations = $this->getDataOrTerminateWithError($result);
$udf_field_validations = $this->getDataOrTerminateWithError($result);
$this->form_validation->set_rules($field_validations);
$this->form_validation->set_rules($udf_field_validations);
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
@@ -2,11 +2,14 @@ import FormForm from '../../../Form/Form.js';
import FormInput from '../../../Form/Input.js';
import TblHistory from "./Prestudent/History.js";
import CoreUdf from '../../../Udf/Udf.js';
export default {
components: {
FormForm,
FormInput,
TblHistory
TblHistory,
CoreUdf
},
inject: {
lists: {
@@ -98,6 +101,9 @@ export default {
})
.catch(this.$fhcAlert.handleSystemError);
},
udfsLoaded(udfs) {
this.initialFormData = {...(this.initialFormData || {}), ...udfs};
},
updatePrestudent(){
this.$refs.form
.post('api/frontend/v1/stv/prestudent/updatePrestudent/' + this.modelValue.prestudent_id, this.deltaArray)
@@ -505,6 +511,7 @@ export default {
>
</form-input>
</div>
<core-udf @load="udfsLoaded" v-model="data" class="row-cols-3 g-3 mb-3" ci-model="crm/prestudent" :pk="{prestudent_id:modelValue.prestudent_id}"></core-udf>
</fieldset>
</form-form>
<div>