diff --git a/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php b/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php index c7820f65a..aa89fe781 100644 --- a/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php +++ b/application/libraries/vertragsbestandteil/Dienstverhaeltnis.php @@ -15,7 +15,7 @@ class Dienstverhaeltnis { /** @var integer */ protected $dienstverhaeltnis_id; /** @var integer */ - protected $unternehmen; // TODO link zu orgeinheit + protected $unternehmen; /** @var string */ protected $vertragsart_kurzbz; protected $gueltig_ab; diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilGehalt.php b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php similarity index 74% rename from application/libraries/vertragsbestandteil/VertragsbestandteilGehalt.php rename to application/libraries/vertragsbestandteil/Gehaltsbestandteil.php index cdb06b26b..e911c4228 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilGehalt.php +++ b/application/libraries/vertragsbestandteil/Gehaltsbestandteil.php @@ -1,17 +1,16 @@ setVertragsbestandteiltyp_kurzbz( - VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_GEHALT); - } + { + } - public function hydrateByStdClass($data) - { - parent::hydrateByStdClass($data); - isset($data->gehalt_von) && $this->setGehaltVon($data->gehalt_von); - isset($data->gehalt_bis) && $this->setGehaltBis($data->gehalt_bis); - isset($data->anmerkung) && $this->setAnmerkung($data->anmerkung); - isset($data->gehalt_dienstverhaeltnis_id) && $this->setGehaltDienstverhaeltnisID($data->gehalt_dienstverhaeltnis_id); - isset($data->gehaltstyp_kurzbz) && $this->setGehaltstypKurzbz($data->gehaltstyp_kurzbz); - isset($data->valorisierungssperre) && $this->setValorisierungssperre($data->valorisierungssperre); - } - - public function getGehaltVon() - { - return $this->gehalt_von; - } - - public function getGehaltBis() - { - return $this->gehalt_bis; - } - - public function setGehaltVon($von) - { - $this->gehalt_von = $von; - return $this; - } - - public function setGehaltBis($bis) - { - $this->gehalt_bis = $bis; - return $this; - } /** * Get the value of gehaltsbestandteil_id @@ -203,16 +168,11 @@ class VertragsbestandteilGehalt extends Vertragsbestandteil return $this; } - - - public function toStdClass(): \stdClass { $tmp = array( - 'von' => $this->getVon(), - 'bis' => $this->getBis(), - 'gehalt_von' => $this->getGehaltVon(), - 'gehalt_bis' => $this->getGehaltBis(), + 'gueltig_ab' => $this->getGueltigAb(), + 'gueltig_bis' => $this->getGueltigBis(), 'gehalt_dienstverhaeltnis_id' => $this->getGehaltDienstverhaeltnisID(), 'grundbetrag' => $this->getGrundbetrag(), 'betrag_valorisiert' => $this->getBetragValorisiert(), @@ -242,4 +202,40 @@ EOTXT; } + + /** + * 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; + } } diff --git a/application/libraries/vertragsbestandteil/gui/AbstractBestandteil.php b/application/libraries/vertragsbestandteil/gui/AbstractBestandteil.php deleted file mode 100644 index 861dcf11a..000000000 --- a/application/libraries/vertragsbestandteil/gui/AbstractBestandteil.php +++ /dev/null @@ -1,86 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/AbstractGUIVertragsbestandteil.php b/application/libraries/vertragsbestandteil/gui/AbstractGUIVertragsbestandteil.php deleted file mode 100644 index 63906e42e..000000000 --- a/application/libraries/vertragsbestandteil/gui/AbstractGUIVertragsbestandteil.php +++ /dev/null @@ -1,143 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/FormData.php b/application/libraries/vertragsbestandteil/gui/FormData.php deleted file mode 100644 index fe3f761f6..000000000 --- a/application/libraries/vertragsbestandteil/gui/FormData.php +++ /dev/null @@ -1,109 +0,0 @@ -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'); - $gueltigkeit = new GUIGueltigkeit(); - $gueltigkeit->mapJSON($decodedData['gueltigkeit']); - $this->data['gueltigkeit'] = $gueltigkeit; - //$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; - } - - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIGehaltsbestandteil.php b/application/libraries/vertragsbestandteil/gui/GUIGehaltsbestandteil.php deleted file mode 100644 index 713ee64a0..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIGehaltsbestandteil.php +++ /dev/null @@ -1,89 +0,0 @@ -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'); - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIGueltigkeit.php b/application/libraries/vertragsbestandteil/gui/GUIGueltigkeit.php deleted file mode 100644 index 0caee1114..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIGueltigkeit.php +++ /dev/null @@ -1,76 +0,0 @@ -mapGuioptions($decoded); - $this->mapData($decoded); - } - - private function mapGuioptions(&$decoded) - { - $decodedData = null; - if (!$this->getJSONData($decodedData, $decoded, 'guioptions')) - { - throw new \Exception('missing guioptions'); - } - $this->guioptions = $decodedData; - } - - 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]; - } -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIHandler.php b/application/libraries/vertragsbestandteil/gui/GUIHandler.php deleted file mode 100644 index 5ccf9d421..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIHandler.php +++ /dev/null @@ -1,215 +0,0 @@ -employeeUID = $employeeUID; - $this->userUID = $userUID; - $this->CI = get_instance(); - $this->CI->load->model('vertragsbestandteil/Dienstverhaeltnis_model', - 'Dienstverhaeltnis_model'); - $this->CI->load->library('vertragsbestandteil/VertragsbestandteilLib', - null, 'VertragsbestandteilLib'); - - - } - - /** - * 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(); - $res = $this->handleDV($dvData); - - if ($res === false) - { - // TODO write error message - } else { - - // VBS - $vbsList = $formDataMapper->getVbs(); - - foreach ($vbsList as $vbsID => $vbs) { - $this->handleVBS($dvData['dienstverhaeltnisid'] ,$vbs); - } - } - - return $formDataMapper->generateJSON(); - } - - /** - * dienstverhaeltnisid - * unternehmen - * vertragsart_kurzbz - * gueltigkeit - */ - private function handleDV(&$dv) - { - $dienstverhaeltnisid = $dv['dienstverhaeltnisid']; - - if (isset($dienstverhaeltnisid) && intval($dienstverhaeltnisid > 0)) - { - // DV exists - $res = $this->updateDV($dv); - if (isSuccess($res)) - { - return true; - } - } else { - // DV is new - $res = $this->insertDV($dv); - if (isSuccess($res)) - { - // write back new id - $dv['dienstverhaeltnisid'] = $res->retval[0]->dienstverhaeltnis_id; - return true; - } - - } - - return false; - - } - - private function handleVBS($dienstverhaeltnis_id, $vbs) - { - /** @var GUIVertragsbestandteilFunktion */ - $vbsMapper = GUIHandlerFactory::getGUIHandler($vbs['type']); - $vbsMapper->mapJSON($vbs); - $vbsData = $vbsMapper->getData(); - - // merge GUI-Data with DB-Data - $vbsInstance = $vbsMapper->generateVertragsbestandteil(isset($vbsData['id'])?$vbsData['id']:null); - if ($vbsInstance->getDienstverhaeltnis_id() === null) - { - $vbsInstance->setDienstverhaeltnis_id($dienstverhaeltnis_id); - $vbsInstance->setInsertvon($this->userUID); - $vbsInstance->setInsertamum((new DateTime())->format("Y-m-d h:m:s")); - } else { - $vbsInstance->setUpdatevon($this->userUID); - $vbsInstance->setUpdateamum((new DateTime())->format("Y-m-d h:m:s")); - } - - // TODO Validate? - - // store - $this->CI->VertragsbestandteilLib->storeVertragsbestandteil($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) - { - $dvJSON['mitarbeiter_uid'] = $this->employeeUID; - $now = new DateTime(); - $dvJSON['von'] = string2Date($dvJSON['gueltigkeit']->getData()['gueltig_ab']); - $dvJSON['bis'] = string2Date($dvJSON['gueltigkeit']->getData()['gueltig_bis']); - $dvJSON['oe_kurzbz'] = $dvJSON['unternehmen']; - $dvJSON['insertvon'] = $this->userUID; - $dvJSON['insertamum'] = $now->format(DateTime::ATOM); - - unset($dvJSON['dienstverhaeltnisid']); - unset($dvJSON['children']); - unset($dvJSON['gueltigkeit']); - unset($dvJSON['unternehmen']); - - $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) - { - $dvJSON['mitarbeiter_uid'] = $this->employeeUID; - $dvJSON['von'] = string2Date($dvJSON['gueltigkeit']->getData()['gueltig_ab']); - $dvJSON['bis'] = string2Date($dvJSON['gueltigkeit']->getData()['gueltig_bis']); - $dvJSON['oe_kurzbz'] = $dvJSON['unternehmen']; - $now = new DateTime(); - $dvJSON['updatevon'] = $this->userUID; - $dvJSON['updateamum'] = $now->format(DateTime::ATOM); - $dvJSON['dienstverhaeltnis_id'] = $dvJSON['dienstverhaeltnisid']; - - unset($dvJSON['insertamum']); - unset($dvJSON['insertvon']); - unset($dvJSON['dienstverhaeltnisid']); - unset($dvJSON['children']); - unset($dvJSON['gueltigkeit']); - unset($dvJSON['unternehmen']); - - $result = $this->CI->Dienstverhaeltnis_model->update($dvJSON); - //$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); - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIHandlerFactory.php b/application/libraries/vertragsbestandteil/gui/GUIHandlerFactory.php deleted file mode 100644 index e0140755b..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIHandlerFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -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) { - /** @var vertragsbestandteil\VertragsbestandteilFunktion */ - $vbs = null; - if (isset($vbsData['id']) && $vbsData['id'] > 0) - { - // load VBS - $vbs = $this->vbsLib->fetchVertragsbestandteil($vbsData['id']); - } else { - $vbs = new vertragsbestandteil\VertragsbestandteilFunktion(); - } - // merge - $vbs->setBenutzerfunktion_id($this->data['benutzerfunktionid']); - $vbs->setVon(string2Date($this->data['gueltigkeit']->getData()['gueltig_ab'])); - $vbs->setBis(string2Date($this->data['gueltigkeit']->getData()['gueltig_bis'])); - return $vbs; - } - - public function jsonSerialize() { - return [ - "type" => $this->type, - "guioptions" => $this->guioptions, - "data" => $this->data, - "gbs" => $this->gbs]; - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilKuendigungsfrist.php b/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilKuendigungsfrist.php deleted file mode 100644 index 8d706ef26..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilKuendigungsfrist.php +++ /dev/null @@ -1,118 +0,0 @@ -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]; - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilStunden.php b/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilStunden.php deleted file mode 100644 index 0e94ca16d..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilStunden.php +++ /dev/null @@ -1,139 +0,0 @@ -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(string2Date($this->data['gueltigkeit']->getData()['gueltig_ab'])); - $vbs->setBis(string2Date($this->data['gueltigkeit']->getData()['gueltig_bis'])); - return $vbs; - } - - public function jsonSerialize() { - return [ - "type" => $this->type, - "guioptions" => $this->guioptions, - "data" => $this->data, - "gbs" => $this->gbs]; - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZeitaufzeichnung.php b/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZeitaufzeichnung.php deleted file mode 100644 index dacee544c..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZeitaufzeichnung.php +++ /dev/null @@ -1,103 +0,0 @@ -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]; - } -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZusatzvereinbarung.php b/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZusatzvereinbarung.php deleted file mode 100644 index 606f57b0e..000000000 --- a/application/libraries/vertragsbestandteil/gui/GUIVertragsbestandteilZusatzvereinbarung.php +++ /dev/null @@ -1,139 +0,0 @@ -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]; - } - -} \ No newline at end of file diff --git a/application/libraries/vertragsbestandteil/gui/JSONData.php b/application/libraries/vertragsbestandteil/gui/JSONData.php deleted file mode 100644 index 77ea19ce4..000000000 --- a/application/libraries/vertragsbestandteil/gui/JSONData.php +++ /dev/null @@ -1,53 +0,0 @@ -format('Y-m-d'); -} \ No newline at end of file