mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
fix freitext anmerkung, add validation to vbfreitext
This commit is contained in:
@@ -192,6 +192,12 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
unset($vars['CI']);
|
||||
|
||||
// TODO cleanup workaroung for vb freitext where db column is anmerkung and formfield is freitext
|
||||
if( isset($vars['anmerkung']) ) {
|
||||
$vars['freitext'] = $vars['anmerkung'];
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class VertragsbestandteilFreitext extends Vertragsbestandteil
|
||||
isset($data->freitexttyp_kurzbz) && $this->setFreitexttypKurzbz($data->freitexttyp_kurzbz);
|
||||
isset($data->titel) && $this->setTitel($data->titel);
|
||||
isset($data->freitext) && $this->setAnmerkung($data->freitext);
|
||||
isset($data->anmerkung) && $this->setAnmerkung($data->anmerkung);
|
||||
}
|
||||
|
||||
public function toStdClass(): \stdClass
|
||||
@@ -109,6 +110,18 @@ EOTXT;
|
||||
|
||||
public function validate()
|
||||
{
|
||||
if( empty($this->freitexttyp_kurzbz) ) {
|
||||
$this->validationerrors[] = 'Bitte einen gültigen Freitexttyp auswählen.';
|
||||
}
|
||||
|
||||
if( empty($this->titel) ) {
|
||||
$this->validationerrors[] = 'Bitte einen Titel angeben.';
|
||||
}
|
||||
|
||||
if( empty($this->anmerkung) ) {
|
||||
$this->validationerrors[] = 'Bitte eine Beschreibung eingeben.';
|
||||
}
|
||||
|
||||
return parent::validate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user