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());