mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'feature-25562/PV21_Vertraege_Encryption_Merge'
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2022 fhcomplete.org
|
||||
*
|
||||
@@ -36,6 +37,7 @@ class FilterCmptLib
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
const SESSION_TIMEOUT = 'sessionTimeout';
|
||||
const SESSION_ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
|
||||
// Session dataset elements
|
||||
const SESSION_DATASET = 'dataset';
|
||||
@@ -62,6 +64,7 @@ class FilterCmptLib
|
||||
|
||||
// ...to specify permissions that are needed to use this FilterCmpt
|
||||
const REQUIRED_PERMISSIONS = 'requiredPermissions';
|
||||
const ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
|
||||
// ...stament to retrieve the dataset
|
||||
const QUERY = 'query';
|
||||
@@ -102,6 +105,7 @@ class FilterCmptLib
|
||||
private $_filterKurzbz;
|
||||
private $_query;
|
||||
private $_requiredPermissions;
|
||||
private $_encryptedColumns;
|
||||
private $_reloadDataset;
|
||||
private $_sessionTimeout;
|
||||
|
||||
@@ -717,6 +721,7 @@ class FilterCmptLib
|
||||
$this->_filterKurzbz = null;
|
||||
$this->_query = null;
|
||||
$this->_requiredPermissions = null;
|
||||
$this->_encryptedColumns = null;
|
||||
|
||||
$this->_reloadDataset = true; // by default the dataset is NOT cached in session
|
||||
$this->_sessionTimeout = FilterCmptLib::SESSION_DEFAULT_TIMEOUT;
|
||||
@@ -727,6 +732,12 @@ class FilterCmptLib
|
||||
$this->_requiredPermissions = $filterCmptArray[FilterCmptLib::REQUIRED_PERMISSIONS];
|
||||
}
|
||||
|
||||
// Retrieved the encrypted columns parameter if present
|
||||
if (isset($filterCmptArray[FilterCmptLib::ENCRYPTED_COLUMNS]))
|
||||
{
|
||||
$this->_encryptedColumns = $filterCmptArray[FilterCmptLib::ENCRYPTED_COLUMNS];
|
||||
}
|
||||
|
||||
// Parameters needed to retrieve univocally a filter from DB
|
||||
if (isset($filterCmptArray[FilterCmptLib::APP]))
|
||||
{
|
||||
@@ -1129,7 +1140,7 @@ class FilterCmptLib
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Execute the given SQL statement suppressing error messages
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery);
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery, null, $this->_encryptedColumns);
|
||||
}
|
||||
|
||||
return $dataset;
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2023 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
@@ -16,6 +33,7 @@ class FilterWidgetLib
|
||||
const SESSION_SELECTED_FIELDS = 'selectedFields';
|
||||
const SESSION_COLUMNS_ALIASES = 'columnsAliases';
|
||||
const SESSION_ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const SESSION_ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_FILTERS = 'filters';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
@@ -56,6 +74,7 @@ class FilterWidgetLib
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const CHECKBOXES = 'checkboxes';
|
||||
const COLUMNS_ALIASES = 'columnsAliases';
|
||||
const ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
|
||||
// ...to format/mark records of a dataset
|
||||
const FORMAT_ROW = 'formatRow';
|
||||
@@ -367,7 +386,7 @@ class FilterWidgetLib
|
||||
/**
|
||||
* Retrieves the dataset from the DB
|
||||
*/
|
||||
public function getDataset($datasetQuery)
|
||||
public function getDataset($datasetQuery, $encryptedColumns)
|
||||
{
|
||||
$dataset = null;
|
||||
|
||||
@@ -376,7 +395,7 @@ class FilterWidgetLib
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Execute the given SQL statement suppressing error messages
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery);
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery, null, $encryptedColumns);
|
||||
}
|
||||
|
||||
return $dataset;
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2023 fhcomplete.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
@@ -16,6 +33,7 @@ class TableWidgetLib
|
||||
const SESSION_FIELDS = 'fields';
|
||||
const SESSION_COLUMNS_ALIASES = 'columnsAliases';
|
||||
const SESSION_ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const SESSION_ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
@@ -49,6 +67,7 @@ class TableWidgetLib
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const CHECKBOXES = 'checkboxes';
|
||||
const COLUMNS_ALIASES = 'columnsAliases';
|
||||
const ENCRYPTED_COLUMNS = 'encryptedColumns';
|
||||
|
||||
// ...to format/mark records of a dataset
|
||||
const FORMAT_ROW = 'formatRow';
|
||||
@@ -177,7 +196,7 @@ class TableWidgetLib
|
||||
/**
|
||||
* Retrieves the dataset from the DB
|
||||
*/
|
||||
public function getDataset($datasetQuery)
|
||||
public function getDataset($datasetQuery, $encryptedColumns)
|
||||
{
|
||||
$dataset = null;
|
||||
|
||||
@@ -186,7 +205,7 @@ class TableWidgetLib
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Execute the given SQL statement suppressing error messages
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery);
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery, null, $encryptedColumns);
|
||||
}
|
||||
|
||||
return $dataset;
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace vertragsbestandteil;
|
||||
|
||||
const TYPE_ECHT = 'echterdv';
|
||||
const TYPE_STUDENTISCHE_HILFSKRAFT = 'studentischehilfskr';
|
||||
const TYPE_FREI = 'freierdv';
|
||||
const TYPE_EXTERN = 'externerlehrender';
|
||||
const TYPE_GAST = 'gastlektor';
|
||||
const TYPE_ECHT_FREI = 'echterfreier';
|
||||
const TYPE_WERKVERTRAG = 'werkvertrag';
|
||||
const TYPE_UEBERLASSUNG = 'ueberlassungsvertrag';
|
||||
|
||||
class Dienstverhaeltnis {
|
||||
/** @var integer */
|
||||
protected $dienstverhaeltnis_id;
|
||||
/** @var integer */
|
||||
protected $unternehmen; // TODO link zu orgeinheit
|
||||
/** @var string */
|
||||
protected $vertragsart_kurzbz;
|
||||
protected $gueltig_ab;
|
||||
protected $gueltig_bis;
|
||||
|
||||
public function toStdClass(): \stdClass
|
||||
{
|
||||
$tmp = array(
|
||||
'dienstverhaeltnis_id' => $this->getDienstverhaeltnisId(),
|
||||
'vertragsart_kurzbz' => $this->getVertragsartKurzbz(),
|
||||
'unternehmen' => $this->getUnternehmen(),
|
||||
'gueltig_ab' => $this->getGueltigAb(),
|
||||
'gueltig_bis' => $this->getGueltigBis(),
|
||||
);
|
||||
|
||||
$tmp = array_filter($tmp, function($v) {
|
||||
return !is_null($v);
|
||||
});
|
||||
|
||||
return (object) $tmp;
|
||||
}
|
||||
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$txt = <<<EOTXT
|
||||
dienstverhaeltnis_id: {$this->getDienstverhaeltnisId()}
|
||||
vertragsart_kurzbz: {$this->getVertragsartKurzbz()}
|
||||
gueltig_ab: {$this->getGueltigAb()}
|
||||
gueltig_bis: {$this->getGueltigBis()}
|
||||
|
||||
EOTXT;
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of dienstverhaeltnis_id
|
||||
*/
|
||||
public function getDienstverhaeltnisId()
|
||||
{
|
||||
return $this->dienstverhaeltnis_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of dienstverhaeltnis_id
|
||||
*/
|
||||
public function setDienstverhaeltnisId($dienstverhaeltnis_id): self
|
||||
{
|
||||
$this->dienstverhaeltnis_id = $dienstverhaeltnis_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of unternehmen
|
||||
*/
|
||||
public function getUnternehmen()
|
||||
{
|
||||
return $this->unternehmen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of unternehmen
|
||||
*/
|
||||
public function setUnternehmen($unternehmen): self
|
||||
{
|
||||
$this->unternehmen = $unternehmen;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of vertragsart_kurzbz
|
||||
*/
|
||||
public function getVertragsartKurzbz()
|
||||
{
|
||||
return $this->vertragsart_kurzbz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of vertragsart_kurzbz
|
||||
*/
|
||||
public function setVertragsartKurzbz($vertragsart_kurzbz): self
|
||||
{
|
||||
$this->vertragsart_kurzbz = $vertragsart_kurzbz;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of gueltig_ab
|
||||
*/
|
||||
public function getGueltigAb()
|
||||
{
|
||||
return $this->gueltig_ab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of gueltig_ab
|
||||
*/
|
||||
public function setGueltigAb($gueltig_ab): self
|
||||
{
|
||||
$this->gueltig_ab = $gueltig_ab;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of gueltig_bis
|
||||
*/
|
||||
public function getGueltigBis()
|
||||
{
|
||||
return $this->gueltig_bis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of gueltig_bis
|
||||
*/
|
||||
public function setGueltigBis($gueltig_bis): self
|
||||
{
|
||||
$this->gueltig_bis = $gueltig_bis;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,9 @@ class VertragsbestandteilFactory
|
||||
const VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG = 'zeitaufzeichnung';
|
||||
const VERTRAGSBESTANDTEIL_LEHRE = 'lehre';
|
||||
|
||||
public static function getVertragsbestandteil($data)
|
||||
public static function getVertragsbestandteil($data)
|
||||
{
|
||||
$vertragsbestandteiltyp_kurzbz = isset($data->vertragsbestandteiltyp_kurzbz)
|
||||
$vertragsbestandteiltyp_kurzbz = isset($data->vertragsbestandteiltyp_kurzbz)
|
||||
? $data->vertragsbestandteiltyp_kurzbz : false;
|
||||
if( false === $vertragsbestandteiltyp_kurzbz )
|
||||
{
|
||||
@@ -51,6 +51,36 @@ class VertragsbestandteilFactory
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST:
|
||||
$vertragsbestandteil = new VertragsbestandteilKuendigungsfrist();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_FREITEXT:
|
||||
$vertragsbestandteil = new VertragsbestandteilFreitext();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG:
|
||||
$vertragsbestandteil = new VertragsbestandteilZeitaufzeichnung();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_BEFRISTUNG:
|
||||
$vertragsbestandteil = new VertragsbestandteilBefristung();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_KARENZ:
|
||||
$vertragsbestandteil = new VertragsbestandteilKarenz();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH:
|
||||
$vertragsbestandteil = new VertragsbestandteilUrlaubsanspruch();
|
||||
$vertragsbestandteil->hydrateByStdClass($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Unknown vertragsbestandteiltyp_kurzbz '
|
||||
. $vertragsbestandteiltyp_kurzbz);
|
||||
@@ -59,7 +89,7 @@ class VertragsbestandteilFactory
|
||||
return $vertragsbestandteil;
|
||||
}
|
||||
|
||||
public static function getVertragsbestandteilDBModel($vertragsbestandteil_kurzbz)
|
||||
public static function getVertragsbestandteilDBModel($vertragsbestandteil_kurzbz): \DB_model
|
||||
{
|
||||
$CI = get_instance();
|
||||
|
||||
@@ -73,19 +103,49 @@ class VertragsbestandteilFactory
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_FUNKTION:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilFunktion_model',
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilFunktion_model',
|
||||
'VertragsbestandteilFunktion_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilFunktion_model;
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_GEHALT:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilGehalt_model',
|
||||
'VertragsbestandteilGehalt_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilGehalt_model;
|
||||
$CI->load->model('vertragsbestandteil/Gehaltsbestandteil_model',
|
||||
'Gehaltsbestandteil_model');
|
||||
$vertragsbestandteildbmodel = $CI->Gehaltsbestandteil_model;
|
||||
break;
|
||||
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_FREITEXT:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilFreitext_model',
|
||||
'VertragsbestandteilFreitext_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilFreitext_model;
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilKuendigungsfrist_model',
|
||||
'VertragsbestandteilKuendigungsfrist_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilKuendigungsfrist_model;
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_KARENZ:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilKarenz_model',
|
||||
'VertragsbestandteilKarenz_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilKarenz_model;
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilZeitaufzeichnung_model',
|
||||
'VertragsbestandteilZeitaufzeichnung_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilZeitaufzeichnung_model;
|
||||
break;
|
||||
|
||||
case self::VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH:
|
||||
$CI->load->model('vertragsbestandteil/VertragsbestandteilUrlaubsanspruch_model',
|
||||
'VertragsbestandteilUrlaubsanspruch_model');
|
||||
$vertragsbestandteildbmodel = $CI->VertragsbestandteilUrlaubsanspruch_model;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Unknown vertragsbestandteil_kurzbz '
|
||||
throw new Exception('Unknown vertragsbestandteil_kurzbz '
|
||||
. $vertragsbestandteil_kurzbz);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ use vertragsbestandteil\VertragsbestandteilFactory;
|
||||
class VertragsbestandteilLib
|
||||
{
|
||||
protected $CI;
|
||||
/** @var Vertragsbestandteil_model */
|
||||
protected $VertragsbestandteilModel;
|
||||
|
||||
public function __construct()
|
||||
@@ -25,10 +26,29 @@ class VertragsbestandteilLib
|
||||
$this->VertragsbestandteilModel = $this->CI->VertragsbestandteilModel;
|
||||
}
|
||||
|
||||
public function handleGUIData($guidata, $employeeUID, $userUID)
|
||||
{
|
||||
$guiHandler = new GUIHandler($employeeUID, $userUID);
|
||||
$ret = false;
|
||||
try {
|
||||
$ret = $guiHandler->handle($guidata, $employeeUID, $userUID);
|
||||
} catch (Exception $ex)
|
||||
{
|
||||
log_message('debug', "Error handling json data from GUI. " . $ex->getMessage());
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null)
|
||||
{
|
||||
return $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag);
|
||||
}
|
||||
|
||||
public function fetchVertragsbestandteil($vertragsbestandteil_id)
|
||||
{
|
||||
return $this->VertragsbestandteilModel->getVertragsbestandteil($vertragsbestandteil_id);
|
||||
}
|
||||
|
||||
public function storeVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil)
|
||||
{
|
||||
@@ -57,7 +77,8 @@ class VertragsbestandteilLib
|
||||
}
|
||||
}
|
||||
|
||||
protected function insertVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil)
|
||||
protected function insertVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil,
|
||||
Vertragsbestandteil $vertragsbestandteil_secondary = null /* i.e. Gehaltsbestandteil connected to Stunden*/)
|
||||
{
|
||||
$ret = $this->VertragsbestandteilModel->insert($vertragsbestandteil->baseToStdClass());
|
||||
if( hasData($ret) )
|
||||
@@ -78,6 +99,34 @@ class VertragsbestandteilLib
|
||||
throw new Exception('error updating vertragsbestandteil '
|
||||
. $vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
|
||||
}
|
||||
|
||||
if ($vertragsbestandteil_secondary == null) return;
|
||||
|
||||
if (!is_array($vertragsbestandteil_secondary))
|
||||
{
|
||||
$vertragsbestandteil_secondary = [$vertragsbestandteil_secondary];
|
||||
}
|
||||
|
||||
foreach ($vertragsbestandteil_secondary as $vb)
|
||||
{
|
||||
$specialisedModel = VertragsbestandteilFactory::getVertragsbestandteilDBModel(
|
||||
$vb->getVertragsbestandteiltyp_kurzbz());
|
||||
|
||||
if ($specialisedModel instanceof IEncryption)
|
||||
{
|
||||
$retspecial = $specialisedModel->insert($vb->toStdClass(), $specialisedModel->getEncryptedColumns());
|
||||
} else
|
||||
{
|
||||
$retspecial = $specialisedModel->insert($vb->toStdClass());
|
||||
}
|
||||
|
||||
if(isError($retspecial) )
|
||||
{
|
||||
throw new Exception('error updating secondary vertragsbestandteil '
|
||||
. $vb->getVertragsbestandteiltyp_kurzbz());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function updateVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil)
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/JSONData.php';
|
||||
|
||||
abstract class AbstractBestandteil {
|
||||
|
||||
use JSONData;
|
||||
|
||||
/** @var string type of vertragsbestandteil (i.e. vertragsbestandteilstunden) */
|
||||
protected $type;
|
||||
/**
|
||||
* @var object might contain id and some data needed by the GUI (Error-Messages).
|
||||
* Contents depend heavily on type of vertragsbestandteil */
|
||||
protected $guioptions;
|
||||
/** @var object container for the real data */
|
||||
protected $data;
|
||||
|
||||
abstract public function getTypeString(): string;
|
||||
abstract public function mapJSON(&$decoded);
|
||||
|
||||
/**
|
||||
* check type string ('vertragsbestandteilstunden', etc.)
|
||||
*/
|
||||
public function checkType(&$decoded)
|
||||
{
|
||||
var_dump($decoded['type']);
|
||||
if (!isset($decoded['type']) || (isset($decoded['type']) && $decoded['type'] !== $this->getTypeString()))
|
||||
{
|
||||
throw new \Exception('wrong type string: "'.$decoded['type'].'" should be "'.$this->getTypeString().'"');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of type
|
||||
*/
|
||||
public function setType($type): self
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of guioptions
|
||||
*/
|
||||
public function getGuioptions()
|
||||
{
|
||||
return $this->guioptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of guioptions
|
||||
*/
|
||||
public function setGuioptions($guioptions): self
|
||||
{
|
||||
$this->guioptions = $guioptions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of data
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of data
|
||||
*/
|
||||
public function setData($data): self
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractBestandteil.php";
|
||||
|
||||
/**
|
||||
* Wrapper for Vertragsbestandteil in JSON schema produced by the GUI.
|
||||
* Example:
|
||||
* ```{ "bb09324f-19f6-41d2-a371-388ef8fdb49e": {
|
||||
* "type": "vertragsbestandteil",
|
||||
* "guioptions": {
|
||||
* "id": "bb09324f-19f6-41d2-a371-388ef8fdb49e",
|
||||
* "infos": [
|
||||
* "test info 1",
|
||||
* "test info 2"
|
||||
* ],
|
||||
* "errors": [
|
||||
* "test error 1",
|
||||
* "test error 2"
|
||||
* ]
|
||||
* },
|
||||
* "data": {
|
||||
* "stunden": "38,5",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "ignore"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2011",
|
||||
* "gueltig_bis": "31.12.2014"
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* },
|
||||
* "gbs": [
|
||||
* {
|
||||
* "type": "gehaltsbestandteil",
|
||||
* "guioptions": {
|
||||
* "infos": [
|
||||
* "test info 1",
|
||||
* "test info 2"
|
||||
* ],
|
||||
* "errors": [
|
||||
* "test error 1",
|
||||
* "test error 2"
|
||||
* ]
|
||||
* },
|
||||
* "data": {
|
||||
* "gehaltstyp": "",
|
||||
* "betrag": "3333",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "ignore"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2011",
|
||||
* "gueltig_bis": "31.12.2014"
|
||||
* }
|
||||
* },
|
||||
* "valorisierung": ""
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* }```
|
||||
*/
|
||||
abstract class AbstractGUIVertragsbestandteil extends AbstractBestandteil
|
||||
{
|
||||
|
||||
/** @var string hashkey */
|
||||
protected $uuid;
|
||||
|
||||
/** @var boolean does this vertragsbestandteil have a GBS array? */
|
||||
protected $hasGBS = false;
|
||||
/** @var array gehaltsbestandteile connected to current vertragsbestandteil */
|
||||
protected $gbs;
|
||||
|
||||
/** @var VertragsbestandteilLib */
|
||||
protected $vbsLib;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->vbsLib = new VertragsbestandteilLib();
|
||||
}
|
||||
|
||||
abstract public function generateVertragsbestandteil($id);
|
||||
|
||||
/**
|
||||
* Get the value of uuid
|
||||
*/
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of uuid
|
||||
*/
|
||||
public function setUuid($uuid): self
|
||||
{
|
||||
$this->uuid = $uuid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of hasGBS
|
||||
*/
|
||||
public function getHasGBS()
|
||||
{
|
||||
return $this->hasGBS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of hasGBS
|
||||
*/
|
||||
public function setHasGBS($hasGBS): self
|
||||
{
|
||||
$this->hasGBS = $hasGBS;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of gbs
|
||||
*/
|
||||
public function getGbs()
|
||||
{
|
||||
return $this->gbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of gbs
|
||||
*/
|
||||
public function setGbs($gbs): self
|
||||
{
|
||||
$this->gbs = $gbs;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractBestandteil.php";
|
||||
|
||||
class FormData extends AbstractBestandteil {
|
||||
|
||||
const TYPE_STRING = "formdata";
|
||||
|
||||
/** @var array GUI data */
|
||||
protected $children;
|
||||
/** @var array */
|
||||
protected $vbs = [];
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return FormData::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* read JSON and turn it into data structure
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
// preserve gui data
|
||||
$this->mapChildren($decoded);
|
||||
// data contains DV
|
||||
$this->mapData($decoded);
|
||||
// vbs array
|
||||
$this->mapVbs($decoded);
|
||||
}
|
||||
|
||||
public function generateJSON()
|
||||
{
|
||||
$json = json_encode([
|
||||
"children" => $this->children,
|
||||
"data" => $this->generateDvJSON(),
|
||||
"vbs" => $this->generateVbsJSON()
|
||||
]);
|
||||
return $json;
|
||||
}
|
||||
|
||||
private function mapChildren(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'children'))
|
||||
{
|
||||
throw new \Exception('missing children');
|
||||
}
|
||||
$this->getJSONData($this->data['children'], $decodedData, 'children');
|
||||
}
|
||||
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
|
||||
$this->getJSONDataInt($this->data['dienstverhaeltnisid'], $decodedData, 'dienstverhaeltnisid');
|
||||
$this->getJSONData($this->data['unternehmen'], $decodedData, 'unternehmen');
|
||||
$this->getJSONData($this->data['vertragsart_kurzbz'], $decodedData, 'vertragsart_kurzbz');
|
||||
$this->getJSONData($this->data['gueltigkeit'], $decodedData, 'gueltigkeit');
|
||||
}
|
||||
|
||||
private function generateDvJSON()
|
||||
{
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
|
||||
private function mapVbs(&$decoded)
|
||||
{
|
||||
if (!$this->getJSONData($this->vbs, $decoded, 'vbs'))
|
||||
{
|
||||
throw new \Exception('missing vbs');
|
||||
}
|
||||
//$this->getJSONData($this->vbs, $decodedData, 'vbs');
|
||||
}
|
||||
|
||||
private function generateVbsJSON()
|
||||
{
|
||||
return json_encode($this->vbs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of children
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of vbs
|
||||
*/
|
||||
public function getVbs()
|
||||
{
|
||||
return $this->vbs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
|
||||
require_once __DIR__ . "/AbstractBestandteil.php";
|
||||
require_once __DIR__ . "/GUIGueltigkeit.php";
|
||||
|
||||
/**
|
||||
* {
|
||||
* "type": "gehaltsbestandteil",
|
||||
* "guioptions": {
|
||||
* "id": "66246b54-9a42-43e8-b6d3-a541688ebb6e",
|
||||
* "removeable": true
|
||||
* },
|
||||
* "data": {
|
||||
* "gehaltstyp": "zulage",
|
||||
* "betrag": "100",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2011",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* },
|
||||
* "valorisierung": ""
|
||||
* }
|
||||
*/
|
||||
class GUIGehaltsbestandteil extends AbstractBestandteil {
|
||||
|
||||
const TYPE_STRING = "gehaltsbestandteil";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilStunden::TYPE_STRING;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => true];
|
||||
$this->data = [ "gehaltstyp" => "",
|
||||
"betrag" => "",
|
||||
"gueltigkeit" => [
|
||||
"guioptions" => ["sharedstatemode" => "reflect"],
|
||||
"data" => ["gueltig_ab" => "", "gueltig_bis" => ""]
|
||||
],
|
||||
"valorisierung" => true
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIGehaltsbestandteil::TYPE_STRING;
|
||||
}
|
||||
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
//$decoded = json_decode($jsondata);
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
}
|
||||
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONData($this->data['id'], $decodedData, 'id');
|
||||
$this->getJSONData($this->data['gehaltstyp'], $decodedData, 'gehaltstyp');
|
||||
$this->getJSONDataInt($this->data['betrag'], $decodedData, 'betrag');
|
||||
$gueltigkeit = new GUIGueltigkeit();
|
||||
$gueltigkeit->mapJSON($decodedData['gueltigkeit']);
|
||||
$this->data['gueltigkeit'] = $gueltigkeit;
|
||||
$this->getJSONData($this->data['valorisierung'], $decodedData, 'valorisierung');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/JSONData.php';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class GUIGueltigkeit implements JsonSerializable {
|
||||
|
||||
use JSONData;
|
||||
|
||||
/** @var array */
|
||||
protected $guioptions;
|
||||
/** @var array */
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* ```
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "",
|
||||
* "gueltig_bis": ""
|
||||
* }```
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->mapGuioptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
}
|
||||
|
||||
private function mapGuioptions(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedData, 'guioptions');
|
||||
}
|
||||
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONData($this->data['gueltig_ab'], $decodedData, 'gueltig_ab');
|
||||
$this->getJSONData($this->data['gueltig_bis'], $decodedData, 'gueltig_bis');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of guioptions
|
||||
*/
|
||||
public function getGuioptions()
|
||||
{
|
||||
return $this->guioptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of data
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return ["guioptions" => $this->guioptions,
|
||||
"data" => $this->data];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use PhpParser\Node\Expr;
|
||||
|
||||
require_once __DIR__ . '/FormData.php';
|
||||
|
||||
/**
|
||||
* GUIHandler takes JSON from GUI and manages the process of
|
||||
* storing the data to the database
|
||||
* TODO convert to controller
|
||||
*/
|
||||
class GUIHandler
|
||||
{
|
||||
|
||||
protected $employeeUID;
|
||||
protected $userUID;
|
||||
protected $CI;
|
||||
|
||||
public function __construct($employeeUID, $userUID)
|
||||
{
|
||||
$this->employeeUID = $employeeUID;
|
||||
$this->userUID = $userUID;
|
||||
$this->CI = get_instance();
|
||||
$this->CI->load->model('vertragsbestandteil/Dienstverhaeltnis_model',
|
||||
'Dienstverhaeltnis_model');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* main entry (called from VetragsbestandteilLib)
|
||||
* @param string $guidata JSON submitted by editor
|
||||
* @param string $employeeUID uid of the employee
|
||||
* @param string $userUID uid of the user currently editing the employee data
|
||||
* @return string JSON for GUI client
|
||||
*/
|
||||
public function handle($guidata)
|
||||
{
|
||||
$decoded = json_decode($guidata, true);
|
||||
$formDataMapper = new FormData();
|
||||
$formDataMapper->mapJSON($decoded);
|
||||
|
||||
// DV
|
||||
$dvData = $formDataMapper->getData();
|
||||
$this->handleDV($dvData);
|
||||
|
||||
// VBS
|
||||
$vbsList = $formDataMapper->getVbs();
|
||||
|
||||
foreach ($vbsList as $vbsID => $vbs) {
|
||||
$this->handleVBS($dvData['dienstverhaeltnis_id'] ,$vbs);
|
||||
}
|
||||
|
||||
return $formDataMapper->generateJSON();
|
||||
}
|
||||
|
||||
/**
|
||||
* dienstverhaeltnisid
|
||||
* unternehmen
|
||||
* vertragsart_kurzbz
|
||||
* gueltigkeit
|
||||
*/
|
||||
private function handleDV(&$dv)
|
||||
{
|
||||
$dienstverhaeltnisid = $dv['dienstverhaeltnisid'];
|
||||
|
||||
if (isset($dienstverhaeltnisid) && intval($dienstverhaeltnisid > 0))
|
||||
{
|
||||
// DV exists
|
||||
$ret = $this->updateDV($dv);
|
||||
} else {
|
||||
// DV is new
|
||||
$ret = $this->insertDV($dv);
|
||||
// write back new id
|
||||
$dv['dienstverhaeltnisid'] = $ret['dienstverhaeltnis_id'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function handleVBS($vbs)
|
||||
{
|
||||
$vbsMapper = GUIHandlerFactory::getGUIHandler($vbs['type']);
|
||||
$vbsMapper->mapJSON($vbs);
|
||||
$vbsData = $vbsMapper->getData();
|
||||
|
||||
// merge GUI-Data with DB-Data
|
||||
$vbsInstance = $vbsMapper->generateVertragsbestandteil($vbsData['id']);
|
||||
|
||||
// TODO Validate?
|
||||
|
||||
// store
|
||||
$this->VertragsbestandteilLib->store($vbsInstance);
|
||||
|
||||
// GBS
|
||||
/*
|
||||
foreach ($vbsMapper->getGbs() as $gbs)
|
||||
{
|
||||
$gbsData = $gbs->getData();
|
||||
$this->handleGBS($gbsData);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
// GBS without connection to VBS
|
||||
private static function handleGBS($gbs)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// DV does not have a dedicated handler
|
||||
|
||||
private function insertDV($dvJSON)
|
||||
{
|
||||
$now = new DateTime();
|
||||
$dvJSON['insertvon'] = $this->userUID;
|
||||
$dvJSON['insertamum'] = $now->format(DateTime::ATOM);
|
||||
|
||||
$result = $this->CI->Dienstverhaeltnis_model->insert($dvJSON);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
throw Exception($result->msg);
|
||||
}
|
||||
|
||||
$record = $this->CI->Dienstverhaeltnis_model->load($result->retval);
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
private function updateDV($dvJSON)
|
||||
{
|
||||
$now = new DateTime();
|
||||
$dvJSON['updatevon'] = getAuthUID();
|
||||
$dvJSON['updateamum'] = $now->format(DateTime::ATOM);
|
||||
|
||||
unset($dvJSON['insertamum']);
|
||||
unset($dvJSON['insertvon']);
|
||||
|
||||
|
||||
$result = $this->CI->Dienstverhaeltnis_model->update($dvJSON['kontakt_id'], $dvJSON);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
$record = $this->CI->Dienstverhaeltnis_model->load($result->retval);
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
private function deleteDV($dv_id)
|
||||
{
|
||||
$result = $this->CI->Dienstverhaeltnis_model->delete($dv_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
|
||||
return success($dv_id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class GUIHandlerFactory {
|
||||
|
||||
public static function getGUIHandler($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case GUIVertragsbestandteilStunden::TYPE_STRING:
|
||||
return new GUIVertragsbestandteilStunden();
|
||||
break;
|
||||
case GUIVertragsbestandteilFunktion::TYPE_STRING:
|
||||
return new GUIVertragsbestandteilFunktion();
|
||||
break;
|
||||
case GUIVertragsbestandteilKuendigungsfrist::TYPE_STRING:
|
||||
return new GUIVertragsbestandteilKuendigungsfrist();
|
||||
break;
|
||||
case GUIVertragsbestandteilZeitaufzeichnung::TYPE_STRING:
|
||||
return new GUIVertragsbestandteilZeitaufzeichnung();
|
||||
break;
|
||||
case GUIVertragsbestandteilZusatzvereinbarung::TYPE_STRING:
|
||||
return new GUIVertragsbestandteilZusatzvereinbarung();
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
throw new \Exception('type not found: '.$type);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractGUIVertragsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGehaltsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGueltigkeit.php";
|
||||
|
||||
class GUIVertragsbestandteilFunktion extends AbstractGUIVertragsbestandteil implements JsonSerializable
|
||||
{
|
||||
const TYPE_STRING = "vertragsbestandteilfunktion";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilFunktion::TYPE_STRING;
|
||||
$this->hasGBS = true;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => false];
|
||||
$this->data = ["funktion" => "Leitung",
|
||||
"orget" => "",
|
||||
"gueltigkeit" => [
|
||||
"guioptions" => ["sharedstatemode" => "reflect"],
|
||||
"data" => ["gueltig_ab" => "", "gueltig_bis" => ""]
|
||||
]
|
||||
];
|
||||
$this->gbs = [];
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIVertragsbestandteilFunktion::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse JSON into object
|
||||
* @param string $jsondata
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
$this->mapGBS($decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* ["id" => null,
|
||||
* "infos" => [],
|
||||
* "errors" => [],
|
||||
* "removeable" => true
|
||||
* ]
|
||||
* @param mixed $decoded decoded JSON data (use associative array)
|
||||
*/
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONDataBool($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
/**
|
||||
* {
|
||||
* "funktion": "Leitung",
|
||||
* "orget": "sdf",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONData($this->data['funktion'], $decodedData, 'funktion');
|
||||
$this->getJSONData($this->data['orget'], $decodedData, 'orget');
|
||||
$gueltigkeit = new GUIGueltigkeit();
|
||||
$gueltigkeit->mapJSON($decodedData['gueltigkeit']);
|
||||
$this->data['gueltigkeit'] = $gueltigkeit;
|
||||
}
|
||||
|
||||
private function mapGBS(&$decoded)
|
||||
{
|
||||
//echo "gbs: ";var_dump($decoded);
|
||||
$decodedGbsList = [];
|
||||
if (!$this->getJSONData($decodedGbsList, $decoded, 'gbs'))
|
||||
{
|
||||
throw new \Exception('missing gbs');
|
||||
}
|
||||
$guiGBS = null;
|
||||
foreach ($decodedGbsList as $decodedGbs) {
|
||||
$guiGBS = new GUIGehaltsbestandteil();
|
||||
$guiGBS->mapJSON($decodedGbs);
|
||||
$this->gbs[] = $guiGBS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function generateVertragsbestandteil($id) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
"type" => $this->type,
|
||||
"guioptions" => $this->guioptions,
|
||||
"data" => $this->data,
|
||||
"gbs" => $this->gbs];
|
||||
}
|
||||
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractGUIVertragsbestandteil.php";
|
||||
|
||||
/**
|
||||
* "type": "vertragsbestandteilkuendigungsfrist",
|
||||
* "guioptions": {
|
||||
* "id": "c71a803d-b8be-4fbc-82f1-381e1d01df2e",
|
||||
* "removeable": true
|
||||
* },
|
||||
* "data": {
|
||||
* "arbeitgeber_frist": "8",
|
||||
* "arbeitnehmer_frist": "4",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2011",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
class GUIVertragsbestandteilKuendigungsfrist extends AbstractGUIVertragsbestandteil implements JsonSerializable
|
||||
{
|
||||
const TYPE_STRING = "vertragsbestandteilkuendigungsfrist";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilKuendigungsfrist::TYPE_STRING;
|
||||
$this->hasGBS = false;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => true];
|
||||
$this->data = ["arbeitnehmer_frist" => "",
|
||||
"arbeitgeber_frist" => "",
|
||||
"gueltigkeit" => [
|
||||
"guioptions" => ["sharedstatemode" => "reflect"],
|
||||
"data" => ["gueltig_ab" => "", "gueltig_bis" => ""]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIVertragsbestandteilKuendigungsfrist::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse JSON into object
|
||||
* @param string $jsondata
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* ["id" => null,
|
||||
* "infos" => [],
|
||||
* "errors" => [],
|
||||
* "removeable" => true
|
||||
* ]
|
||||
* @param mixed $decoded decoded JSON data (use associative array)
|
||||
*/
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONDataBool($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONDataInt($this->data['arbeitnehmer_frist'], $decodedData, 'arbeitnehmer_frist');
|
||||
$this->getJSONDataInt($this->data['arbeitgeber_frist'], $decodedData, 'arbeitgeber_frist');
|
||||
$this->getJSONData($this->data['gueltigkeit'], $decodedData, 'gueltigkeit');
|
||||
}
|
||||
|
||||
private function mapGBS()
|
||||
{
|
||||
$decodedGbsList = [];
|
||||
if (!$this->getJSONData($decodedGbsList, $decoded, 'gbs'))
|
||||
{
|
||||
throw new \Exception('missing gbs');
|
||||
}
|
||||
$guiGBS = null;
|
||||
foreach ($decodedGbsList as $decodedGbs) {
|
||||
$guiGBS = new GUIGehaltsbestandteil();
|
||||
$guiGBS->mapJSON($decodedGbs);
|
||||
}
|
||||
}
|
||||
|
||||
public function generateVertragsbestandteil($id) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
"type" => $this->type,
|
||||
"guioptions" => $this->guioptions,
|
||||
"data" => $this->data];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
use vertragsbestandteil\VertragsbestandteilFactory;
|
||||
|
||||
require_once __DIR__ . "/AbstractGUIVertragsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGehaltsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGueltigkeit.php";
|
||||
|
||||
class GUIVertragsbestandteilStunden extends AbstractGUIVertragsbestandteil implements JsonSerializable
|
||||
{
|
||||
const TYPE_STRING = "vertragsbestandteilstunden";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilStunden::TYPE_STRING;
|
||||
$this->hasGBS = true;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => true];
|
||||
$this->data = ["stunden" => "",
|
||||
"gueltigkeit" => [
|
||||
"guioptions" => ["sharedstatemode" => "reflect"],
|
||||
"data" => ["gueltig_ab" => "", "gueltig_bis" => ""]
|
||||
]
|
||||
];
|
||||
$this->gbs = [];
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIVertragsbestandteilStunden::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse JSON into object
|
||||
* @param string $jsondata
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
$this->mapGBS($decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* ["id" => null,
|
||||
* "infos" => [],
|
||||
* "errors" => [],
|
||||
* "removeable" => true
|
||||
* ]
|
||||
* @param mixed $decoded decoded JSON data (use associative array)
|
||||
*/
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONDataBool($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
/**
|
||||
* {
|
||||
* "stunden": "38,5",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2011",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONDataFloat($this->data['stunden'], $decodedData, 'stunden');
|
||||
$gueltigkeit = new GUIGueltigkeit();
|
||||
$gueltigkeit->mapJSON($decodedData['gueltigkeit']);
|
||||
$this->data['gueltigkeit'] = $gueltigkeit;
|
||||
}
|
||||
|
||||
private function mapGBS(&$decoded)
|
||||
{
|
||||
$decodedGbsList = [];
|
||||
if (!$this->getJSONData($decodedGbsList, $decoded, 'gbs'))
|
||||
{
|
||||
throw new \Exception('missing gbs');
|
||||
}
|
||||
$guiGBS = null;
|
||||
foreach ($decodedGbsList as $decodedGbs) {
|
||||
$guiGBS = new GUIGehaltsbestandteil();
|
||||
$guiGBS->mapJSON($decodedGbs);
|
||||
$this->gbs[] = $guiGBS;
|
||||
}
|
||||
}
|
||||
|
||||
public function generateVertragsbestandteil($id)
|
||||
{
|
||||
$vbs = null;
|
||||
if (isset($vbsData['id']) && $vbsData['id'] > 0)
|
||||
{
|
||||
// load VBS
|
||||
$vbs = $this->vbsLib->fetchVertragsbestandteil($vbsData['id']);
|
||||
} else {
|
||||
$vbs = new vertragsbestandteil\VertragsbestandteilStunden();
|
||||
}
|
||||
// merge
|
||||
$vbs->setWochenstunden($this->data['stunden']);
|
||||
$vbs->setVon($this->data['gueltigkeit']->getData()['gueltig_ab']);
|
||||
$vbs->setBis($this->data['gueltigkeit']->getData()['gueltig_bis']);
|
||||
return $vbs;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
"type" => $this->type,
|
||||
"guioptions" => $this->guioptions,
|
||||
"data" => $this->data,
|
||||
"gbs" => $this->gbs];
|
||||
}
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractGUIVertragsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGehaltsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGueltigkeit.php";
|
||||
|
||||
/**
|
||||
* ```
|
||||
* "type": "vertragsbestandteilzeitaufzeichnung",
|
||||
* "guioptions": {
|
||||
* "id": "484f7166-7792-4cc7-b906-0db09c65bbf4",
|
||||
* "removeable": true
|
||||
* },
|
||||
* "data": {
|
||||
* "zeitaufzeichnung": true,
|
||||
* "azgrelevant": false,
|
||||
* "homeoffice": true,
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2010",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
class GUIVertragsbestandteilZeitaufzeichnung extends AbstractGUIVertragsbestandteil implements JsonSerializable
|
||||
{
|
||||
const TYPE_STRING = "vertragsbestandteilzeitaufzeichnung";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilZeitaufzeichnung::TYPE_STRING;
|
||||
$this->hasGBS = false;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => true];
|
||||
$this->data = null;
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIVertragsbestandteilZeitaufzeichnung::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse JSON into object
|
||||
* @param string $jsondata
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* ["id" => null,
|
||||
* "infos" => [],
|
||||
* "errors" => [],
|
||||
* "removeable" => true
|
||||
* ]
|
||||
* @param mixed $decoded decoded JSON data (use associative array)
|
||||
*/
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONDataBool($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONDataBool($this->data['zeitaufzeichnung'], $decodedData, 'zeitaufzeichnung');
|
||||
$this->getJSONDataBool($this->data['azgrelevant'], $decodedData, 'azgrelevant');
|
||||
$this->getJSONDataBool($this->data['homeoffice'], $decodedData, 'homeoffice');
|
||||
$gueltigkeit = new GUIGueltigkeit();
|
||||
$gueltigkeit->mapJSON($decodedData['gueltigkeit']);
|
||||
$this->data['gueltigkeit'] = $gueltigkeit;
|
||||
}
|
||||
|
||||
public function generateVertragsbestandteil($id) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
"type" => $this->type,
|
||||
"guioptions" => $this->guioptions,
|
||||
"data" => $this->data];
|
||||
}
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . "/AbstractGUIVertragsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGehaltsbestandteil.php";
|
||||
require_once __DIR__ . "/GUIGueltigkeit.php";
|
||||
|
||||
/**
|
||||
* ```
|
||||
* "type": "vertragsbestandteilfreitext",
|
||||
* "guioptions": {
|
||||
* "id": "b168a3bb-d0e2-407f-8192-525a5ab59b22",
|
||||
* "removeable": true
|
||||
* },
|
||||
* "data": {
|
||||
* "freitexttyp": "allin",
|
||||
* "titel": "Lorem ipsum ",
|
||||
* "freitext": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \nAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. ",
|
||||
* "kuendigungsrelevant": "",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2010",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* "gbs": []```
|
||||
*/
|
||||
class GUIVertragsbestandteilZusatzvereinbarung extends AbstractGUIVertragsbestandteil implements JsonSerializable
|
||||
{
|
||||
const TYPE_STRING = "vertragsbestandteilfreitext";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = GUIVertragsbestandteilZusatzvereinbarung::TYPE_STRING;
|
||||
$this->hasGBS = true;
|
||||
$this-> guioptions = ["id" => null, "infos" => [], "errors" => [], "removeable" => true];
|
||||
$this->data = null;
|
||||
$this->gbs = [];
|
||||
}
|
||||
|
||||
public function getTypeString(): string
|
||||
{
|
||||
return GUIVertragsbestandteilZusatzvereinbarung::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse JSON into object
|
||||
* @param string $jsondata
|
||||
*/
|
||||
public function mapJSON(&$decoded)
|
||||
{
|
||||
$this->checkType($decoded);
|
||||
$this->mapGUIOptions($decoded);
|
||||
$this->mapData($decoded);
|
||||
$this->mapGBS($decoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* ["id" => null,
|
||||
* "infos" => [],
|
||||
* "errors" => [],
|
||||
* "removeable" => true
|
||||
* ]
|
||||
* @param mixed $decoded decoded JSON data (use associative array)
|
||||
*/
|
||||
private function mapGUIOptions(&$decoded)
|
||||
{
|
||||
$decodedGUIOptions = null;
|
||||
if (!$this->getJSONData($decodedGUIOptions, $decoded, 'guioptions'))
|
||||
{
|
||||
throw new \Exception('missing guioptions');
|
||||
}
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'id');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'infos');
|
||||
$this->getJSONData($this->guioptions, $decodedGUIOptions, 'errors');
|
||||
$this->getJSONDataBool($this->guioptions, $decodedGUIOptions, 'removable');
|
||||
}
|
||||
|
||||
/**
|
||||
* {
|
||||
* "freitexttyp": "allin",
|
||||
* "titel": "Lorem ipsum ",
|
||||
* "freitext": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. \nAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. ",
|
||||
* "kuendigungsrelevant": "",
|
||||
* "gueltigkeit": {
|
||||
* "guioptions": {
|
||||
* "sharedstatemode": "reflect"
|
||||
* },
|
||||
* "data": {
|
||||
* "gueltig_ab": "1.1.2010",
|
||||
* "gueltig_bis": ""
|
||||
* }
|
||||
*/
|
||||
private function mapData(&$decoded)
|
||||
{
|
||||
$decodedData = null;
|
||||
if (!$this->getJSONData($decodedData, $decoded, 'data'))
|
||||
{
|
||||
throw new \Exception('missing data');
|
||||
}
|
||||
$this->getJSONDataString($this->data['freitexttyp'], $decodedData, 'freitexttyp');
|
||||
$this->getJSONDataString($this->data['titel'], $decodedData, 'titel');
|
||||
$this->getJSONDataString($this->data['freitext'], $decodedData, 'freitext');
|
||||
$gueltigkeit = new GUIGueltigkeit();
|
||||
$gueltigkeit->mapJSON($decodedData['gueltigkeit']);
|
||||
$this->data['gueltigkeit'] = $gueltigkeit;
|
||||
}
|
||||
|
||||
private function mapGBS(&$decoded)
|
||||
{
|
||||
$decodedGbsList = [];
|
||||
if (!$this->getJSONData($decodedGbsList, $decoded, 'gbs'))
|
||||
{
|
||||
throw new \Exception('missing gbs');
|
||||
}
|
||||
$guiGBS = null;
|
||||
foreach ($decodedGbsList as $decodedGbs) {
|
||||
$guiGBS = new GUIGehaltsbestandteil();
|
||||
$guiGBS->mapJSON($decodedGbs);
|
||||
$this->gbs[] = $guiGBS;
|
||||
}
|
||||
}
|
||||
|
||||
public function generateVertragsbestandteil($id) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return [
|
||||
"type" => $this->type,
|
||||
"guioptions" => $this->guioptions,
|
||||
"data" => $this->data,
|
||||
"gbs" => $this->gbs];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
trait JSONData {
|
||||
protected function getJSONData(&$target, &$decoded, $attributeName)
|
||||
{
|
||||
if (isset($decoded[$attributeName]))
|
||||
{
|
||||
$target = $decoded[$attributeName];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getJSONDataString(&$target, &$decoded, $attributeName)
|
||||
{
|
||||
if (isset($decoded[$attributeName]))
|
||||
{
|
||||
$target = filter_var($decoded[$attributeName], FILTER_SANITIZE_STRING);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getJSONDataInt(&$target, &$decoded, $attributeName)
|
||||
{
|
||||
if (isset($decoded[$attributeName]) && filter_var($decoded[$attributeName], FILTER_VALIDATE_INT))
|
||||
{
|
||||
$target = filter_var($decoded[$attributeName], FILTER_VALIDATE_INT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getJSONDataFloat(&$target, &$decoded, $attributeName)
|
||||
{
|
||||
if (isset($decoded[$attributeName]) && filter_var($decoded[$attributeName], FILTER_VALIDATE_FLOAT))
|
||||
{
|
||||
$target = filter_var($decoded[$attributeName], FILTER_VALIDATE_FLOAT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getJSONDataBool(&$target, &$decoded, $attributeName)
|
||||
{
|
||||
if (isset($decoded[$attributeName]) && filter_var($decoded[$attributeName], FILTER_VALIDATE_BOOL))
|
||||
{
|
||||
$target = filter_var($decoded[$attributeName], FILTER_VALIDATE_BOOL);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user