mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
start to implement validation
This commit is contained in:
@@ -20,9 +20,14 @@ abstract class Vertragsbestandteil implements \JsonSerializable
|
||||
|
||||
protected $gehaltsbestandteile;
|
||||
|
||||
protected $isvalid;
|
||||
protected $validationerrors;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->gehaltsbestandteile = array();
|
||||
$this->isvalid = false;
|
||||
$this->validationerrors = array();
|
||||
}
|
||||
|
||||
public function hydrateByStdClass($data)
|
||||
@@ -203,5 +208,19 @@ EOTXT;
|
||||
// can be overridden in childs
|
||||
}
|
||||
|
||||
public function isValid()
|
||||
{
|
||||
return $this->isvalid;
|
||||
}
|
||||
|
||||
public function getValidationErrors()
|
||||
{
|
||||
return $this->validationerrors;
|
||||
}
|
||||
|
||||
public function validate() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public abstract function toStdClass();
|
||||
}
|
||||
|
||||
@@ -101,4 +101,14 @@ EOTXT;
|
||||
'insertvon' => getAuthUID()
|
||||
);
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
if( (inval($this->benutzerfunktion_id) < 1)
|
||||
&& ($this->benutzerfunktiondata === NULL) ) {
|
||||
$this->isvalid = false;
|
||||
$this->validationerrors[] = 'Eine bestehende Funktion oder eine '
|
||||
. 'Funktion und eine Organisationseinheit müssen ausgewählt sein.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user