Merge branch 'feature-25562/PV21_Vertraege_Encryption_Merge'

This commit is contained in:
Werner Masik
2023-03-28 20:12:40 +02:00
parent 279ddddfc8
commit c52cd05436
42 changed files with 3812 additions and 52 deletions
+29
View File
@@ -0,0 +1,29 @@
<?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');
// NOTE: if database encryption is _not_ used then leave this array empty!
$config['encryption_passwords'] = array(
// 'password name 1' => 'password 1'
// 'password name 2' => 'password 2'
// 'password name ...' => 'password ...'
// 'password name N' => 'password N'
);
+287 -19
View File
@@ -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');
/**
@@ -27,6 +44,15 @@ class DB_Model extends CI_Model
const PGSQL_INT8_TYPE = 'int8';
const PGSQL_FLOAT4_TYPE = 'float4';
const PGSQL_FLOAT8_TYPE = 'float8';
const PGSQL_BYTEA_TYPE = 'bytea';
// Name of the config entry containing an array of password that can be used to encrypt/decrypt
const CRYPT_CONF_PASSWORDS = 'encryption_passwords';
const CRYPT_CAST = 'cast';
const CRYPT_PASSWORD_NAME = 'passwordName';
const CRYPT_SELECT_TEMPLATE = 'PGP_SYM_DECRYPT(%s, \'%s\')::%s AS %s';
const CRYPT_WHERE_TEMPLATE = 'PGP_SYM_DECRYPT(%s, \'%s\')::%s';
const CRYPT_WRITE_TEMPLATE = 'PGP_SYM_ENCRYPT(\'%s\', \'%s\')';
protected $dbTable; // Name of the DB-Table for CI-Insert, -Update, ...
protected $pk; // Name of the PrimaryKey for DB-Update, Load, ...
@@ -36,7 +62,7 @@ class DB_Model extends CI_Model
private $executedQueryMetaData;
private $executedQueryListFields;
private $debugMode;
private $debugMode; // Debug mode enable (true) or disabled (false)
/**
* Constructor
@@ -46,20 +72,23 @@ class DB_Model extends CI_Model
// Call parent constructor
parent::__construct();
// Set properties
$this->hasSequence = true;
// Loads DB conns and confs
// Loads DB connections and configs
$this->load->database($dbtype);
// Loads the DB config to encrypt/decrypt data
$this->config->load('db_crypt');
// Set properties
$this->hasSequence = true;
$this->debugMode = isset($this->db->db_debug) && $this->db->db_debug === true;
// Loads UDF model
$this->load->model('system/UDF_model', 'UDFModel');
// Loads the UDF library
$this->load->library('UDFLib');
// Loads the logs library
$this->load->library('LogLib');
$this->debugMode = isset($this->db->db_debug) && $this->db->db_debug === true;
}
// ------------------------------------------------------------------------------------------
@@ -85,7 +114,7 @@ class DB_Model extends CI_Model
* @param array $data DataArray for Insert
* @return array
*/
public function insert($data)
public function insert($data, $encryptedColumns = null)
{
// Check class properties
if (is_null($this->dbTable)) return error('The given database table name is not valid', EXIT_MODEL);
@@ -93,6 +122,9 @@ class DB_Model extends CI_Model
// If this table has UDF and the validation of them is ok
if (isError($validate = $this->_prepareUDFsWrite($data, $this->dbTable))) return $validate;
// Add the pgp_sym_eccrypt postgresql function to the set clause if needed
$this->_addEncrypt($encryptedColumns, $data);
// DB-INSERT
$insert = $this->db->insert($this->dbTable, $data);
@@ -135,7 +167,7 @@ class DB_Model extends CI_Model
* @param array $data DataArray for Insert
* @return array
*/
public function update($id, $data)
public function update($id, $data, $encryptedColumns = null)
{
// Check class properties
if (is_null($this->pk)) return error('The given primary key is not valid', EXIT_MODEL);
@@ -161,6 +193,9 @@ class DB_Model extends CI_Model
$this->db->where($tmpId);
// Add the pgp_sym_eccrypt postgresql function to the set clause if needed
$this->_addEncrypt($encryptedColumns, $data);
// DB-UPDATE
$update = $this->db->update($this->dbTable, $data);
@@ -224,7 +259,7 @@ class DB_Model extends CI_Model
* @param string $id ID (Primary Key) for SELECT ... WHERE
* @return array
*/
public function load($id = null)
public function load($id = null, $encryptedColumns = null)
{
// Check class properties
if (is_null($this->pk)) return error('The given primary key is not valid', EXIT_MODEL);
@@ -245,7 +280,7 @@ class DB_Model extends CI_Model
$tmpId = array($this->pk => $id);
}
return $this->loadWhere($tmpId);
return $this->loadWhere($tmpId, $encryptedColumns);
}
/**
@@ -253,11 +288,14 @@ class DB_Model extends CI_Model
*
* @return array
*/
public function loadWhere($where = null)
public function loadWhere($where = null, $encryptedColumns = null)
{
// Check class properties
if (is_null($this->dbTable)) return error('The given database table name is not valid', EXIT_MODEL);
// Add the pgp_sym_decrypt postgresql function to the select and where clause if needed
$this->_addDecryptLoad($encryptedColumns, $where);
// Execute query
$result = $this->db->get_where($this->dbTable, $where);
@@ -265,7 +303,7 @@ class DB_Model extends CI_Model
if ($result)
{
return success($this->_toPhp($result));
return success($this->_toPhp($result, $encryptedColumns));
}
else
{
@@ -758,7 +796,7 @@ class DB_Model extends CI_Model
/**
* Like execQuery, but it allows only to perform queries to read data
*/
public function execReadOnlyQuery($query, $parametersArray = null)
public function execReadOnlyQuery($query, $parametersArray = null, $encryptedColumns = null)
{
$result = error('You are allowed to run only query for reading data'); //
$cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); //
@@ -775,7 +813,7 @@ class DB_Model extends CI_Model
{
$queryToExec = str_replace(';', '', $query); //
$result = $this->execQuery($queryToExec, $parametersArray);
$result = $this->execQuery($queryToExec, $parametersArray, $encryptedColumns);
}
return $result;
@@ -790,13 +828,16 @@ class DB_Model extends CI_Model
* boolean if the query is of the write type (INSERT, UPDATE, DELETE...)
* array that represents DB data
*/
protected function execQuery($query, $parametersArray = null)
protected function execQuery($query, $parametersArray = null, $encryptedColumns = null)
{
$result = null;
// If the query is empty don't lose time
if (!isEmptyString($query))
{
// Add the pgp_sym_decrypt postgresql function to the given query
$this->_addDecryptQuery($encryptedColumns, $query);
// If there are parameters to bind to the query
if (is_array($parametersArray) && count($parametersArray) > 0)
{
@@ -812,7 +853,7 @@ class DB_Model extends CI_Model
// If no errors occurred
if ($resultDB)
{
$result = success($this->_toPhp($resultDB));
$result = success($this->_toPhp($resultDB, $encryptedColumns));
}
else
{
@@ -851,6 +892,215 @@ class DB_Model extends CI_Model
// ------------------------------------------------------------------------------------------
// Private methods
//
//
/**
* To add the pgp_sym_encrypt function to the set clause where needed
*/
private function _addEncrypt($encryptedColumns, &$data)
{
$tmpData = array(); // Temporary array used to copy not encrypted columns
// For each column that is going to be inserted/updated
foreach ($data as $column => $value)
{
// If the current column is in the list of the columns to be encrypted
// and contains the password name element
if (array_key_exists($column, $encryptedColumns)
&& array_key_exists(self::CRYPT_PASSWORD_NAME, $encryptedColumns[$column]))
{
// Password to encrypt data
$encryptionPassword = $this->config->item(self::CRYPT_CONF_PASSWORDS)[
$encryptedColumns[$column][self::CRYPT_PASSWORD_NAME]
];
// Add the encrypted column to the set clause without escaping
$this->db->set(
$column,
sprintf(
self::CRYPT_WRITE_TEMPLATE,
$value,
$encryptionPassword
),
false // no escaping
);
}
else // otherwise copy this element as it is
{
$tmpData[$column] = $value;
}
}
$data = $tmpData; // this array does not contain encrypted columns
}
/**
* To add the pgp_sym_decrypt function to the given query
*/
private function _addDecryptQuery($encryptedColumns, &$query)
{
// If it is request to get encrypted columns
if (!isEmptyArray($encryptedColumns))
{
// For each requested encrypted column
foreach ($encryptedColumns as $encryptedColumn => $definition)
{
// If the requested encrypted column is well defined
if (!isEmptyArray($definition)
&& array_key_exists(self::CRYPT_CAST, $definition)
&& array_key_exists(self::CRYPT_PASSWORD_NAME, $definition))
{
// And if exists the wanted password to decrypt in the configs
if (array_key_exists(
$definition[self::CRYPT_PASSWORD_NAME],
$this->config->item(self::CRYPT_CONF_PASSWORDS))
)
{
// Password to decrypt data
$decryptionPassword = $this->config->item(self::CRYPT_CONF_PASSWORDS)[
$definition[self::CRYPT_PASSWORD_NAME]
];
// Find and replace all the occurrences of the provided encrypted columns
// with the postgresql decryption function
$query = str_replace(
$encryptedColumn,
sprintf(
self::CRYPT_WHERE_TEMPLATE,
$encryptedColumn,
$decryptionPassword,
$definition[self::CRYPT_CAST]
),
$query
);
}
}
}
}
}
/**
* To add the pgp_sym_decrypt function to the select and where clause where needed
*/
private function _addDecryptLoad($encryptedColumns, &$where)
{
// If it is request to get encrypted columns
if (!isEmptyArray($encryptedColumns))
{
// For each requested encrypted column
foreach ($encryptedColumns as $encryptedColumn => $definition)
{
// If the requested encrypted column is well defined
if (!isEmptyArray($definition)
&& array_key_exists(self::CRYPT_CAST, $definition)
&& array_key_exists(self::CRYPT_PASSWORD_NAME, $definition))
{
// And if exists the wanted password to decrypt in the configs
if (array_key_exists(
$definition[self::CRYPT_PASSWORD_NAME],
$this->config->item(self::CRYPT_CONF_PASSWORDS))
)
{
// Password to decrypt data
$decryptionPassword = $this->config->item(self::CRYPT_CONF_PASSWORDS)[
$definition[self::CRYPT_PASSWORD_NAME]
];
// -----------------------------------------
// SELECT
// Add to the select clause the column to be decrypted
// NOTE: this is going to override any previously added column with the same name
$this->addSelect(
sprintf(
self::CRYPT_SELECT_TEMPLATE,
$encryptedColumn,
$decryptionPassword,
$definition[self::CRYPT_CAST],
$encryptedColumn
)
);
// -----------------------------------------
// WHERE
// If the where parameter is a valid array
if (!isEmptyArray($where))
{
$tmpWhere = array();
// For each condition of the where clause
foreach ($where as $column => $condition)
{
$operator = null; // operator not found in the column name
// Custom operators with 2 chars
if (strpos($column, '>=') != false
|| strpos($column, '<=') != false
|| strpos($column, '!=') != false
|| strpos($column, '<>') != false
)
{
$operator = ' '.substr(trim($column), -2).' ';
}
// Custom operators with 1 chars
elseif (strpos($column, '>') != false
|| strpos($column, '<') != false
|| strpos($column, '=') != false
)
{
$operator = ' '.substr(trim($column), -1).' ';
}
else // default operator
{
$operator = ' = ';
}
// If the column from the where clause is the same from the encrypted columns definition
if (trim($column) == $encryptedColumn
|| ($operator != null && substr(trim($column), 0, strlen(trim($column)) - 2) == $encryptedColumn)
)
{
// Then rename the column using the postgresql decryption function
$tmpWhere[
sprintf(
self::CRYPT_WHERE_TEMPLATE,
$encryptedColumn,
$decryptionPassword,
$definition[self::CRYPT_CAST]
).$operator
] = $condition;
}
else // otherwise copy the column as it is
{
$tmpWhere[$column] = $condition;
}
}
$where = $tmpWhere; // replace with the new where
}
// Otherwise if the where parameter is a valid string
elseif (!isEmptyString($where))
{
// Find and replace all the occurrences of the provided encrypted columns
// with the postgresql decryption function
$where = str_replace(
$encryptedColumn,
sprintf(
self::CRYPT_WHERE_TEMPLATE,
$encryptedColumn,
$decryptionPassword,
$definition[self::CRYPT_CAST]
),
$where
);
}
}
}
}
}
}
/**
* Invalid ID
@@ -895,7 +1145,7 @@ class DB_Model extends CI_Model
* - A FALSE value on failure
* - Otherwise an object filled with data on success
*/
private function _toPhp($result)
private function _toPhp($result, $encryptedColumns = null)
{
$udfs = false; // if UDFs are inside the given result set
$toPhp = $result; // if there is nothing to convert then return the result from DB
@@ -911,7 +1161,9 @@ class DB_Model extends CI_Model
// Looking for booleans, arrays and UDFs
foreach ($this->executedQueryMetaData as $eqmd)
{
// If array type, boolean type OR a UDF
// If array type, boolean type, numeric type
// Or bytea type
// Or UDF type
if (strpos($eqmd->type, DB_Model::PGSQL_ARRAY_TYPE) !== false
|| $eqmd->type == DB_Model::PGSQL_BOOLEAN_TYPE
|| $eqmd->type == DB_Model::PGSQL_INT2_TYPE
@@ -919,6 +1171,7 @@ class DB_Model extends CI_Model
|| $eqmd->type == DB_Model::PGSQL_INT8_TYPE
|| $eqmd->type == DB_Model::PGSQL_FLOAT4_TYPE
|| $eqmd->type == DB_Model::PGSQL_FLOAT8_TYPE
|| $eqmd->type == DB_Model::PGSQL_BYTEA_TYPE
|| $this->udflib->isUDFColumn($eqmd->name, $eqmd->type))
{
// If UDFs are inside this result set
@@ -981,6 +1234,21 @@ class DB_Model extends CI_Model
{
$resultElement->{$toBeConverted->name} = $this->pgFloatPhp($resultElement->{$toBeConverted->name});
}
// Byte A type
elseif ($toBeConverted->type == DB_Model::PGSQL_BYTEA_TYPE)
{
// If encrypted columns are defined
// and if the byte a column is defined as encrypted column
if (!isEmptyArray($encryptedColumns)
&& array_key_exists($toBeConverted->name, $encryptedColumns))
{
// keep the column
}
else // otherwise remove the column from the result
{
unset($resultElement->{$toBeConverted->name});
}
}
}
}
}
+12 -1
View File
@@ -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;
+21 -2
View File
@@ -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;
+21 -2
View File
@@ -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];
}
}
@@ -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];
}
}
@@ -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];
}
}
@@ -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;
}
}
@@ -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/>.
*/
class Person_model extends DB_Model
{
/**
@@ -8,6 +25,7 @@ class Person_model extends DB_Model
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_person';
$this->pk = 'person_id';
@@ -336,3 +354,4 @@ class Person_model extends DB_Model
return $this->execQuery($qry, array($person_id, $person_id, $person_id));
}
}
+18 -1
View File
@@ -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/>.
*/
class PersonLog_model extends DB_Model
{
/**
@@ -17,7 +34,7 @@ class PersonLog_model extends DB_Model
* @param array $data Data of Log Entry to save.
* @return success object if true
*/
public function insert($data)
public function insert($data, $encryptedColumns = null)
{
$result = $this->db->insert($this->dbTable, $data);
if ($result)
@@ -1,8 +1,8 @@
<?php
require_once __DIR__ . '/IEncryption.php';
class Gehaltsbestandteil_model extends DB_Model
class Gehaltsbestandteil_model extends DB_Model implements IEncryption
{
public function __construct()
@@ -10,14 +10,15 @@ class Gehaltsbestandteil_model extends DB_Model
parent::__construct();
$this->dbTable = 'hr.tbl_gehaltsbestandteil';
$this->pk = 'gehaltsbestandteil_id';
$encryptionkey_filename = APPPATH.'config/extensions/FHC-Core-Personalverwaltung/keys.config.inc.php';
require($encryptionkey_filename);
}
public function getEncryptedColumns(): array
{
return ['grundbetrag' => 'ENCRYPTIONKEY', 'betrag_valorisiert' => 'ENCRYPTIONKEY'];
}
public function getCurrentGBTByDV($dienstverhaeltnis_id)
{
$result = null;
$qry = "
SELECT
gehaltsbestandteil_id,
@@ -28,8 +29,8 @@ class Gehaltsbestandteil_model extends DB_Model
gehaltstyp_kurzbz,
valorisierungssperre,
valorisieren,
pgp_sym_decrypt(grundbetrag,?) grundbetrag,
pgp_sym_decrypt(betrag_valorisiert,?) betrag_valorisiert,
grundbetrag,
betrag_valorisiert,
gt.bezeichnung as gehaltstyp_bezeichnung
FROM hr.tbl_gehaltsbestandteil gbt JOIN hr.tbl_gehaltstyp gt using(gehaltstyp_kurzbz)
WHERE gbt.dienstverhaeltnis_id=? AND
@@ -37,7 +38,7 @@ class Gehaltsbestandteil_model extends DB_Model
ORDER BY gt.sort
";
return $this->execQuery($qry, array(ENCRYPTIONKEY, ENCRYPTIONKEY, $dienstverhaeltnis_id));
return $this->execQuery($qry, array($dienstverhaeltnis_id), $this->getEncryptedColumns());
}
@@ -0,0 +1,7 @@
<?php
interface IEncryption {
public function getEncryptedColumns(): array;
}
@@ -0,0 +1,14 @@
<?php
class VertragsbestandteilKuendigungsfrist_model extends DB_Model
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_vertragsbestandteil_kuendigungsfrist';
$this->pk = 'vertragsbestandteil_id';
}
}
@@ -53,7 +53,7 @@ class Vertragsbestandteil_model extends DB_Model
EOSQL;
// echo $sql . "\n\n";
$query = $this->db->query($sql);
$query = $this->db->query($sql); // TODO add decryption
$vertragsbestandteile = array();
foreach( $query->result() as $row ) {
@@ -69,4 +69,48 @@ EOSQL;
return $vertragsbestandteile;
}
public function getVertragsbestandteil($id)
{
$sql = <<<EOSQL
SELECT
v.*,
s.wochenstunden, s.karenz,
f.benutzerfunktion_id, f.anmerkung, f. kuendigungsrelevant,
g.von as gehalt_von, g.bis as gehalt_bis, g.dienstverhaeltnis_id as gehalt_dienstverhaeltnis_id, g.grundbetrag,
g.betrag_valorisiert,g.valorisieren,gehaltstyp_kurzbz,valorisierungssperre
FROM
hr.tbl_vertragsbestandteil v
LEFT JOIN
hr.tbl_vertragsbestandteil_stunden s USING(vertragsbestandteil_id)
LEFT JOIN
hr.tbl_vertragsbestandteil_funktion f USING(vertragsbestandteil_id)
LEFT JOIN
hr.tbl_gehaltsbestandteil g USING(vertragsbestandteil_id)
WHERE
v.vertragsbestandteil_id = {$this->escape($id)}
;
EOSQL;
// echo $sql . "\n\n";
$query = $this->db->query($sql);
$vertragsbestandteil = array();
try
{
$vertragsbestandteile = VertragsbestandteilFactory::getVertragsbestandteil($row); // TODO add decryption
}
catch (Exception $ex)
{
echo $ex->getMessage() . "\n";
}
return $vertragsbestandteil;
}
}
+31 -2
View File
@@ -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/>.
*/
/**
* To filter data using a SQL statement
*/
@@ -59,6 +76,8 @@ class FilterWidget extends Widget
private $_sessionTimeout; // session expiring time
private $_encryptedColumns; // contains info about encrypted columns
private static $_FilterWidgetInstance; // static property that contains the instance of itself
/**
@@ -195,6 +214,7 @@ class FilterWidget extends Widget
$this->_formatRow = null;
$this->_markRow = null;
$this->_checkboxes = null;
$this->_encryptedColumns = null;
$this->_hideOptions = null;
$this->_hideSelectFields = null;
$this->_hideSelectFilters = null;
@@ -252,6 +272,14 @@ class FilterWidget extends Widget
$this->_additionalColumns = $args[FilterWidgetLib::ADDITIONAL_COLUMNS];
}
// Parameter is used to define the ecrypted columns
if (isset($args[FilterWidgetLib::ENCRYPTED_COLUMNS])
&& is_array($args[FilterWidgetLib::ENCRYPTED_COLUMNS])
&& count($args[FilterWidgetLib::ENCRYPTED_COLUMNS]) > 0)
{
$this->_encryptedColumns = $args[FilterWidgetLib::ENCRYPTED_COLUMNS];
}
// Parameter is used to add use aliases for the columns fo the dataset
if (isset($args[FilterWidgetLib::COLUMNS_ALIASES])
&& is_array($args[FilterWidgetLib::COLUMNS_ALIASES])
@@ -441,7 +469,7 @@ class FilterWidget extends Widget
);
// Then retrieve dataset from DB
$dataset = $this->filterwidgetlib->getDataset($datasetQuery);
$dataset = $this->filterwidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -476,7 +504,7 @@ class FilterWidget extends Widget
$datasetQuery = $this->filterwidgetlib->generateDatasetQuery($this->_query, $parsedFilterJson->filters);
// Then retrieve dataset from DB
$dataset = $this->filterwidgetlib->getDataset($datasetQuery);
$dataset = $this->filterwidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Try to load the name of the filter using the PhrasesLib
$filterName = $this->filterwidgetlib->getFilterName($parsedFilterJson);
@@ -497,6 +525,7 @@ class FilterWidget extends Widget
FilterWidgetLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns), // all the selected fields
FilterWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
FilterWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
FilterWidgetLib::SESSION_ENCRYPTED_COLUMNS => $this->_encryptedColumns, // encrypted columns
FilterWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
FilterWidgetLib::SESSION_FILTERS => $parsedFilterJson->filters, // all the filters used to filter the dataset
FilterWidgetLib::SESSION_METADATA => $this->FiltersModel->getExecutedQueryMetaData(), // the metadata of the dataset
+31 -2
View File
@@ -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/>.
*/
/**
* To display a table that shows data retriev by a SQL statement
*/
@@ -40,6 +57,8 @@ class TableWidget extends Widget
private $_sessionTimeout; // session expiring time
private $_encryptedColumns; // contains info about encrypted columns
private static $_TableWidgetInstance; // static property that contains the instance of itself
/**
@@ -127,6 +146,7 @@ class TableWidget extends Widget
$this->_datasetRepresentationOptions = null;
$this->_datasetRepFieldsDefs = null;
$this->_sessionTimeout = TableWidgetLib::SESSION_DEFAULT_TIMEOUT;
$this->_encryptedColumns = null;
// Retrieved the required permissions parameter if present
if (isset($args[TableWidgetLib::REQUIRED_PERMISSIONS]))
@@ -206,6 +226,14 @@ class TableWidget extends Widget
{
$this->_sessionTimeout = $args[TableWidgetLib::SESSION_TIMEOUT];
}
// Parameter is used to define the ecrypted columns
if (isset($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& is_array($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& count($args[TableWidgetLib::ENCRYPTED_COLUMNS]) > 0)
{
$this->_encryptedColumns = $args[TableWidgetLib::ENCRYPTED_COLUMNS];
}
}
/**
@@ -288,7 +316,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -310,7 +338,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -324,6 +352,7 @@ class TableWidget extends Widget
TableWidgetLib::SESSION_FIELDS => $this->tablewidgetlib->getExecutedQueryListFields(), // all the fields of the dataset
TableWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
TableWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
TableWidgetLib::SESSION_ENCRYPTED_COLUMNS => $this->_encryptedColumns, // encrypted columns
TableWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
TableWidgetLib::SESSION_METADATA => $this->tablewidgetlib->getExecutedQueryMetaData(), // the metadata of the dataset
TableWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this table
+3 -2
View File
@@ -425,11 +425,12 @@
"config": {
"bin-dir": "vendor/bin"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.6.*",
"phpmd/phpmd": "2.*",
"phpmetrics/phpmetrics": "2.*",
"sebastian/phpcpd": "3.*"
"sebastian/phpcpd": "3.*",
"phpunit/phpunit": "^6"
}
}
+4 -1
View File
@@ -18,10 +18,13 @@
* Authors: Werner Masik <werner@gefi.at>,
*/
use PHPUnit\Framework\TestCase;
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/functions.inc.php');
class FunctionsTest extends PHPUnit_Framework_TestCase
class FunctionsTest extends TestCase
{
public function setUp()
@@ -0,0 +1,40 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class FormDataTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/stunden01.json');
$formDataMapper = new FormData();
$decoded = json_decode($jsondata, true);
$formDataMapper->mapJSON($decoded);
// Dienstverhaeltnis
$dataDV = $formDataMapper->getData();
$this->assertNotEmpty($dataDV);
$this->assertNotEmpty($dataDV['unternehmen']);
$this->assertEquals('fhtw', $dataDV['unternehmen']);
$this->assertNull($dataDV['dienstverhaeltnisid']);
$this->assertNotEmpty($dataDV['vertragsart_kurzbz']);
$this->assertEquals('echterDV', $dataDV['vertragsart_kurzbz']);
$this->assertNotEmpty($dataDV['gueltigkeit']);
$this->assertNotEmpty($dataDV['gueltigkeit']['guioptions']);
$this->assertNotEmpty($dataDV['gueltigkeit']['data']);
$this->assertNotEmpty($dataDV['gueltigkeit']['data']['gueltig_ab']);
// Vertragsbestandteile
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
}
}
@@ -0,0 +1,39 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilFunktion.php";
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class GUIVertragsbestandteilFunktionTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/funktion01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['fc5f4ab8-4652-40e4-9ac3-e76bbf7310af']);
$vbsMapper = new GUIVertragsbestandteilFunktion();
$vbsMapper->mapJSON($vbs['fc5f4ab8-4652-40e4-9ac3-e76bbf7310af']);
$vbsData=$vbsMapper->getData();
$this->assertNotEmpty($vbsData['funktion']);
$this->assertEquals('Leitung', $vbsData['funktion']);
// GBS
$this->assertEmpty($vbsMapper->getGbs());
}
}
@@ -0,0 +1,36 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilKuendigungsfrist.php";
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class GUIVertragsbestandteilKuendigungsfristTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/kuendigungsfrist01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['6ae61b45-99a8-406b-b583-9f0353dd834f']);
$vbsMapper = new GUIVertragsbestandteilKuendigungsfrist();
$vbsMapper->mapJSON($vbs['6ae61b45-99a8-406b-b583-9f0353dd834f']);
$vbsData=$vbsMapper->getData();
$this->assertNotEmpty($vbsData['arbeitgeber_frist']);
$this->assertNotEmpty($vbsData['arbeitnehmer_frist']);
}
}
@@ -0,0 +1,77 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilStunden.php";
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class GUIVertragsbestandteilStundenTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/stunden01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['73a60d69-cbd5-40f0-bcb1-ed0ccdd4a9fd']);
$vbsMapper = new GUIVertragsbestandteilStunden();
$vbsMapper->mapJSON($vbs['73a60d69-cbd5-40f0-bcb1-ed0ccdd4a9fd']);
$vbsData=$vbsMapper->getData();
var_dump($vbsData);
$this->assertNotEmpty($vbsData['stunden']);
$this->assertEquals(38.5, $vbsData['stunden']);
// GBS
$this->assertNotEmpty($vbsMapper->getGbs());
foreach ($vbsMapper->getGbs() as $gbs)
{
$this->assertNotEmpty($gbs->getData());
$gbsData = $gbs->getData();
$this->assertNotEmpty($gbsData['gehaltstyp']);
$this->assertNotEmpty($gbsData['betrag']);
$this->assertNotEmpty($gbsData['gueltigkeit']);
$this->assertNotEmpty($gbsData['valorisierung']);
}
}
public function testMapJSON_02()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/funktion01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['98704748-0ef0-4a70-94b7-5d8e719c2b3e']);
$vbsMapper = new GUIVertragsbestandteilStunden();
$vbsMapper->mapJSON($vbs['98704748-0ef0-4a70-94b7-5d8e719c2b3e']);
$vbsData=$vbsMapper->getData();
$this->assertNotEmpty($vbsData['stunden']);
$this->assertEquals(38.5, $vbsData['stunden']);
$this->assertNotEmpty($vbsData['gueltigkeit']->getData());
// GBS
$this->assertNotEmpty($vbsMapper->getGbs());
foreach ($vbsMapper->getGbs() as $gbs)
{
$this->assertNotEmpty($gbs->getData());
$gbsData = $gbs->getData();
$this->assertNotEmpty($gbsData['gehaltstyp']);
$this->assertNotEmpty($gbsData['betrag']);
$this->assertNotEmpty($gbsData['gueltigkeit']);
$this->assertEmpty($gbsData['valorisierung']);
$this->assertNotEmpty($gbsData['gueltigkeit']->getData());
}
}
}
@@ -0,0 +1,39 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZeitaufzeichnung.php";
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class GUIVertragsbestandteilZeitaufzeichnungTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/zeitaufzeichnung01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['7625d25d-8fd9-476b-94a6-4fbb72c147d4']);
$vbsMapper = new GUIVertragsbestandteilZeitaufzeichnung();
$vbsMapper->mapJSON($vbs['7625d25d-8fd9-476b-94a6-4fbb72c147d4']);
$vbsData=$vbsMapper->getData();
$this->assertNotEmpty($vbsData['zeitaufzeichnung']);
$this->assertTrue($vbsData['zeitaufzeichnung']);
$this->assertEmpty($vbsData['azgrelevant']);
$this->assertNotEmpty($vbsData['homeoffice']);
$this->assertTrue($vbsData['homeoffice']);
}
}
@@ -0,0 +1,41 @@
<?php
require_once "application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZusatzvereinbarung.php";
require_once "application/libraries/vertragsbestandteil/gui/FormData.php";
use PHPUnit\Framework\TestCase;
class GUIVertragsbestandteilZusatzvereinbarungTest extends TestCase
{
public function setUp()
{
error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
}
public function testMapJSON_01()
{
$jsondata = file_get_contents('./system/UnitTests/vertragsbestandteil/gui/zusatz01.json');
$decoded = json_decode($jsondata, true);
$formDataMapper = new FormData();
$formDataMapper->mapJSON($decoded);
// VBS
$vbs = $formDataMapper->getVbs();
$this->assertNotEmpty($vbs);
$this->assertNotEmpty($vbs['b168a3bb-d0e2-407f-8192-525a5ab59b22']);
$vbsMapper = new GUIVertragsbestandteilZusatzvereinbarung();
$vbsMapper->mapJSON($vbs['b168a3bb-d0e2-407f-8192-525a5ab59b22']);
$vbsData=$vbsMapper->getData();
$this->assertNotEmpty($vbsData['freitexttyp']);
$this->assertEquals('allin', $vbsData['freitexttyp']);
$this->assertNotEmpty($vbsData['titel']);
$this->assertEquals('Lorem ipsum', $vbsData['titel']);
// GBS
$this->assertEmpty($vbsMapper->getGbs());
}
}
@@ -0,0 +1,241 @@
{
"type": "formdata",
"children": [
{
"type": "tabs",
"guioptions": {},
"children": [
{
"type": "tab",
"guioptions": {
"title": "Allgemein",
"id": "allgemein"
},
"children": [
{
"type": "dv",
"guioptions": {},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist"
},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Befristung",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext",
"childdefaults": {
"guioptions": {
"canhavegehaltsbestandteile": false,
"disabled": [
"freitexttyp"
],
"hidden": [
"titel",
"freitext"
]
},
"data": {
"freitexttyp": "befristung",
"titel": "Befristung",
"freitext": "befristeter Dienstvertrag"
}
}
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Arbeitszeit & Basisgehalt",
"id": "arbeitszeit"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Arbeitszeit",
"vertragsbestandteiltyp": "vertragsbestandteilstunden",
"errors": [
"test1",
"test2"
],
"infos": []
},
"children": [
"98704748-0ef0-4a70-94b7-5d8e719c2b3e"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zeitaufzeichnung",
"vertragsbestandteiltyp": "vertragsbestandteilzeitaufzeichnung",
"errors": [],
"infos": []
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Funktionen",
"id": "funktionen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Funktion",
"vertragsbestandteiltyp": "vertragsbestandteilfunktion",
"errors": [],
"infos": []
},
"children": [
"fc5f4ab8-4652-40e4-9ac3-e76bbf7310af"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Zusatzvereinbarungen",
"id": "zusatzvereinbarungen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zusatzvereinbarungen",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext"
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Sonstiges",
"id": "sonstiges"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist",
"errors": [],
"infos": []
},
"children": []
}
]
}
]
}
],
"data": {
"dienstverhaeltnisid": null,
"unternehmen": "fhtw",
"vertragsart_kurzbz": "echterDV",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "set"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"vbs": {
"98704748-0ef0-4a70-94b7-5d8e719c2b3e": {
"type": "vertragsbestandteilstunden",
"guioptions": {
"id": "98704748-0ef0-4a70-94b7-5d8e719c2b3e",
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"stunden": 38.5,
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"gehaltstyp": "grund",
"betrag": "3500",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
},
"valorisierung": ""
}
}
]
},
"fc5f4ab8-4652-40e4-9ac3-e76bbf7310af": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "fc5f4ab8-4652-40e4-9ac3-e76bbf7310af"
},
"data": {
"funktion": "Leitung",
"orget": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"gbs": []
}
}
}
@@ -0,0 +1,263 @@
{
"type": "formdata",
"children": [
{
"type": "tabs",
"guioptions": {},
"children": [
{
"type": "tab",
"guioptions": {
"title": "Allgemein",
"id": "allgemein"
},
"children": [
{
"type": "dv",
"guioptions": {},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist"
},
"children": [
"6ae61b45-99a8-406b-b583-9f0353dd834f"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Befristung",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext",
"childdefaults": {
"guioptions": {
"canhavegehaltsbestandteile": false,
"disabled": [
"freitexttyp"
],
"hidden": [
"titel",
"freitext"
]
},
"data": {
"freitexttyp": "befristung",
"titel": "Befristung",
"freitext": "befristeter Dienstvertrag"
}
}
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Arbeitszeit & Basisgehalt",
"id": "arbeitszeit"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Arbeitszeit",
"vertragsbestandteiltyp": "vertragsbestandteilstunden",
"errors": [
"test1",
"test2"
],
"infos": []
},
"children": [
"98704748-0ef0-4a70-94b7-5d8e719c2b3e"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zeitaufzeichnung",
"vertragsbestandteiltyp": "vertragsbestandteilzeitaufzeichnung",
"errors": [],
"infos": []
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Funktionen",
"id": "funktionen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Funktion",
"vertragsbestandteiltyp": "vertragsbestandteilfunktion",
"errors": [],
"infos": []
},
"children": [
"fc5f4ab8-4652-40e4-9ac3-e76bbf7310af"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Zusatzvereinbarungen",
"id": "zusatzvereinbarungen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zusatzvereinbarungen",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext"
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Sonstiges",
"id": "sonstiges"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist",
"errors": [],
"infos": []
},
"children": []
}
]
}
]
}
],
"data": {
"dienstverhaeltnisid": null,
"unternehmen": "fhtw",
"vertragsart_kurzbz": "echterDV",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "set"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"vbs": {
"98704748-0ef0-4a70-94b7-5d8e719c2b3e": {
"type": "vertragsbestandteilstunden",
"guioptions": {
"id": "98704748-0ef0-4a70-94b7-5d8e719c2b3e",
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"stunden": "38,5",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"gehaltstyp": "grund",
"betrag": "3500",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
},
"valorisierung": ""
}
}
]
},
"fc5f4ab8-4652-40e4-9ac3-e76bbf7310af": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "fc5f4ab8-4652-40e4-9ac3-e76bbf7310af"
},
"data": {
"funktion": "Leitung",
"orget": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
},
"gbs": []
},
"6ae61b45-99a8-406b-b583-9f0353dd834f": {
"type": "vertragsbestandteilkuendigungsfrist",
"guioptions": {
"id": "6ae61b45-99a8-406b-b583-9f0353dd834f",
"removeable": true
},
"data": {
"arbeitgeber_frist": "8",
"arbeitnehmer_frist": "4",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2001",
"gueltig_bis": ""
}
}
}
}
}
}
@@ -0,0 +1,241 @@
{
"type": "formdata",
"children": [
{
"type": "tabs",
"guioptions": {},
"children": [
{
"type": "tab",
"guioptions": {
"title": "Allgemein",
"id": "allgemein"
},
"children": [
{
"type": "dv",
"guioptions": {},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist"
},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Befristung",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext",
"childdefaults": {
"guioptions": {
"canhavegehaltsbestandteile": false,
"disabled": [
"freitexttyp"
],
"hidden": [
"titel",
"freitext"
]
},
"data": {
"freitexttyp": "befristung",
"titel": "Befristung",
"freitext": "befristeter Dienstvertrag"
}
}
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Arbeitszeit & Basisgehalt",
"id": "arbeitszeit"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Arbeitszeit",
"vertragsbestandteiltyp": "vertragsbestandteilstunden",
"errors": [
"test1",
"test2"
],
"infos": []
},
"children": [
"73a60d69-cbd5-40f0-bcb1-ed0ccdd4a9fd"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zeitaufzeichnung",
"vertragsbestandteiltyp": "vertragsbestandteilzeitaufzeichnung",
"errors": [],
"infos": []
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Funktionen",
"id": "funktionen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Funktion",
"vertragsbestandteiltyp": "vertragsbestandteilfunktion",
"errors": [],
"infos": []
},
"children": [
"a0e35f18-e4d9-4dc3-8001-1b689360782a"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Zusatzvereinbarungen",
"id": "zusatzvereinbarungen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zusatzvereinbarungen",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext"
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Sonstiges",
"id": "sonstiges"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist",
"errors": [],
"infos": []
},
"children": []
}
]
}
]
}
],
"data": {
"dienstverhaeltnisid": null,
"unternehmen": "fhtw",
"vertragsart_kurzbz": "echterDV",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "set"
},
"data": {
"gueltig_ab": "1.1.2011",
"gueltig_bis": ""
}
}
},
"vbs": {
"73a60d69-cbd5-40f0-bcb1-ed0ccdd4a9fd": {
"type": "vertragsbestandteilstunden",
"guioptions": {
"id": "73a60d69-cbd5-40f0-bcb1-ed0ccdd4a9fd",
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"stunden": 38.5,
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2011",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"gehaltstyp": "grund",
"betrag": "3334",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2011",
"gueltig_bis": ""
}
},
"valorisierung": true
}
}
]
},
"a0e35f18-e4d9-4dc3-8001-1b689360782a": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "a0e35f18-e4d9-4dc3-8001-1b689360782a"
},
"data": {
"funktion": "Leitung",
"orget": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2011",
"gueltig_bis": ""
}
}
},
"gbs": []
}
}
}
@@ -0,0 +1,264 @@
{
"type": "formdata",
"children": [
{
"type": "tabs",
"guioptions": {},
"children": [
{
"type": "tab",
"guioptions": {
"title": "Allgemein",
"id": "allgemein"
},
"children": [
{
"type": "dv",
"guioptions": {},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist"
},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Befristung",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext",
"childdefaults": {
"guioptions": {
"canhavegehaltsbestandteile": false,
"disabled": [
"freitexttyp"
],
"hidden": [
"titel",
"freitext"
]
},
"data": {
"freitexttyp": "befristung",
"titel": "Befristung",
"freitext": "befristeter Dienstvertrag"
}
}
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Arbeitszeit & Basisgehalt",
"id": "arbeitszeit"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Arbeitszeit",
"vertragsbestandteiltyp": "vertragsbestandteilstunden",
"errors": [
"test1",
"test2"
],
"infos": []
},
"children": [
"439336ad-05ee-4b2a-9a0c-df7dc1c7245e"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zeitaufzeichnung",
"vertragsbestandteiltyp": "vertragsbestandteilzeitaufzeichnung",
"errors": [],
"infos": []
},
"children": [
"7625d25d-8fd9-476b-94a6-4fbb72c147d4"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Funktionen",
"id": "funktionen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Funktion",
"vertragsbestandteiltyp": "vertragsbestandteilfunktion",
"errors": [],
"infos": []
},
"children": [
"81c92565-82fe-40ec-ad35-454c3218fb3b"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Zusatzvereinbarungen",
"id": "zusatzvereinbarungen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zusatzvereinbarungen",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext"
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Sonstiges",
"id": "sonstiges"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist",
"errors": [],
"infos": []
},
"children": []
}
]
}
]
}
],
"data": {
"dienstverhaeltnisid": null,
"unternehmen": "",
"vertragsart_kurzbz": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "set"
},
"data": {
"gueltig_ab": "",
"gueltig_bis": ""
}
}
},
"vbs": {
"439336ad-05ee-4b2a-9a0c-df7dc1c7245e": {
"type": "vertragsbestandteilstunden",
"guioptions": {
"id": "439336ad-05ee-4b2a-9a0c-df7dc1c7245e",
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"stunden": "38,5",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"gehaltstyp": "",
"betrag": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "",
"gueltig_bis": ""
}
},
"valorisierung": true
}
}
]
},
"81c92565-82fe-40ec-ad35-454c3218fb3b": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "81c92565-82fe-40ec-ad35-454c3218fb3b"
},
"data": {
"funktion": "Leitung",
"orget": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "",
"gueltig_bis": ""
}
}
},
"gbs": []
},
"7625d25d-8fd9-476b-94a6-4fbb72c147d4": {
"type": "vertragsbestandteilzeitaufzeichnung",
"guioptions": {
"id": "7625d25d-8fd9-476b-94a6-4fbb72c147d4",
"removeable": true
},
"data": {
"zeitaufzeichnung": true,
"azgrelevant": "",
"homeoffice": true,
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "",
"gueltig_bis": ""
}
}
}
}
}
}
@@ -0,0 +1,354 @@
{
"type": "formdata",
"children": [
{
"type": "tabs",
"guioptions": {},
"children": [
{
"type": "tab",
"guioptions": {
"title": "Allgemein",
"id": "allgemein"
},
"children": [
{
"type": "dv",
"guioptions": {},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist"
},
"children": []
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Befristung",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext",
"childdefaults": {
"guioptions": {
"canhavegehaltsbestandteile": false,
"disabled": [
"freitexttyp"
],
"hidden": [
"titel",
"freitext"
]
},
"data": {
"freitexttyp": "befristung",
"titel": "Befristung",
"freitext": "befristeter Dienstvertrag"
}
}
},
"children": []
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Arbeitszeit & Basisgehalt",
"id": "arbeitszeit"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Arbeitszeit",
"vertragsbestandteiltyp": "vertragsbestandteilstunden",
"errors": [
"test1",
"test2"
],
"infos": []
},
"children": [
"5671ff88-9580-4b20-8bbf-a744bc353485"
]
},
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zeitaufzeichnung",
"vertragsbestandteiltyp": "vertragsbestandteilzeitaufzeichnung",
"errors": [],
"infos": []
},
"children": [
"484f7166-7792-4cc7-b906-0db09c65bbf4"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Funktionen",
"id": "funktionen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Funktion",
"vertragsbestandteiltyp": "vertragsbestandteilfunktion",
"errors": [],
"infos": []
},
"children": [
"2c38c937-3157-4404-ad33-dfad2ed15633",
"b983791e-ff2e-4eeb-891e-b786c90daf69"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Zusatzvereinbarungen",
"id": "zusatzvereinbarungen"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Zusatzvereinbarungen",
"vertragsbestandteiltyp": "vertragsbestandteilfreitext"
},
"children": [
"b168a3bb-d0e2-407f-8192-525a5ab59b22"
]
}
]
},
{
"type": "tab",
"guioptions": {
"title": "Sonstiges",
"id": "sonstiges"
},
"children": [
{
"type": "vertragsbestandteillist",
"guioptions": {
"title": "Kündigungsfrist",
"vertragsbestandteiltyp": "vertragsbestandteilkuendigungsfrist",
"errors": [],
"infos": []
},
"children": [
"b7c613f2-f82b-45af-bc6a-9c5cefb41e91"
]
}
]
}
]
}
],
"data": {
"dienstverhaeltnisid": null,
"unternehmen": "",
"vertragsart_kurzbz": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "set"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
}
},
"vbs": {
"5671ff88-9580-4b20-8bbf-a744bc353485": {
"type": "vertragsbestandteilstunden",
"guioptions": {
"id": "5671ff88-9580-4b20-8bbf-a744bc353485",
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"stunden": "38,5",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"infos": [
"test info 1",
"test info 2"
],
"errors": [
"test error 1",
"test error 2"
]
},
"data": {
"gehaltstyp": "",
"betrag": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
},
"valorisierung": ""
}
}
]
},
"2c38c937-3157-4404-ad33-dfad2ed15633": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "2c38c937-3157-4404-ad33-dfad2ed15633"
},
"data": {
"funktion": "Leitung",
"orget": "sdf",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
}
},
"gbs": [
{
"type": "gehaltsbestandteil",
"guioptions": {
"id": "a5df7915-6935-47d8-9751-f8f8d63d188b",
"removeable": true
},
"data": {
"gehaltstyp": "zulage",
"betrag": "111",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
},
"valorisierung": true
}
}
]
},
"b983791e-ff2e-4eeb-891e-b786c90daf69": {
"type": "vertragsbestandteilfunktion",
"guioptions": {
"id": "b983791e-ff2e-4eeb-891e-b786c90daf69",
"removeable": true
},
"data": {
"funktion": "",
"orget": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
}
},
"gbs": []
},
"b168a3bb-d0e2-407f-8192-525a5ab59b22": {
"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": []
},
"b7c613f2-f82b-45af-bc6a-9c5cefb41e91": {
"type": "vertragsbestandteilkuendigungsfrist",
"guioptions": {
"id": "b7c613f2-f82b-45af-bc6a-9c5cefb41e91",
"removeable": true
},
"data": {
"arbeitgeber_frist": "",
"arbeitnehmer_frist": "",
"gueltigkeit": {
"guioptions": {
"sharedstatemode": "reflect"
},
"data": {
"gueltig_ab": "1.1.2010",
"gueltig_bis": ""
}
}
}
},
"484f7166-7792-4cc7-b906-0db09c65bbf4": {
"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": ""
}
}
}
}
}
}