extend VerttragsbestandteilLib to keep track on modified columns and only update dv, vbs and gbs when they differ from the status in the db

This commit is contained in:
Harald Bamberger
2023-07-26 16:27:34 +02:00
parent 2b4a4d12a9
commit ac5d6071cd
19 changed files with 230 additions and 104 deletions
@@ -0,0 +1,31 @@
<?php
namespace vertragsbestandteil;
/**
* Description of AbstractBestandteil
*
* @author bambi
*/
abstract class AbstractBestandteil
{
protected $modifiedcolumns;
protected $fromdb;
public function __construct()
{
$this->modifiedcolumns = array();
$this->fromdb = false;
}
public function isDirty() {
return count($this->modifiedcolumns) > 0;
}
protected function markDirty($columnname, $old_value, $new_value) {
if( !$this->fromdb && ($old_value != $new_value) ) {
$this->modifiedcolumns[$columnname] = $columnname;
}
}
abstract public function hydrateByStdClass($data, $fromdb=false);
}
@@ -2,6 +2,10 @@
namespace vertragsbestandteil;
require_once __DIR__ . '/IValidation.php';
require_once __DIR__ . '/AbstractBestandteil.php';
use vertragsbestandteil\AbstractBestandteil;
use vertragsbestandteil\IValidation;
const TYPE_ECHT = 'echterdv';
const TYPE_STUDENTISCHE_HILFSKRAFT = 'studentischehilfskr';
@@ -12,7 +16,7 @@ const TYPE_ECHT_FREI = 'echterfreier';
const TYPE_WERKVERTRAG = 'werkvertrag';
const TYPE_UEBERLASSUNG = 'ueberlassungsvertrag';
class Dienstverhaeltnis implements IValidation {
class Dienstverhaeltnis extends AbstractBestandteil implements IValidation {
protected $dienstverhaeltnis_id;
protected $mitarbeiter_uid;
protected $vertragsart_kurzbz;
@@ -29,12 +33,14 @@ class Dienstverhaeltnis implements IValidation {
public function __construct()
{
parent::__construct();
$this->isvalid = false;
$this->validationerrors = array();
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
$this->fromdb = $fromdb;
isset($data->dienstverhaeltnis_id) && $this->setDienstverhaeltnis_id($data->dienstverhaeltnis_id);
isset($data->mitarbeiter_uid) && $this->setMitarbeiter_uid($data->mitarbeiter_uid);
isset($data->vertragsart_kurzbz) && $this->setVertragsart_kurzbz($data->vertragsart_kurzbz);
@@ -45,6 +51,7 @@ class Dienstverhaeltnis implements IValidation {
isset($data->insertvon) && $this->setInsertvon($data->insertvon);
isset($data->updateamum) && $this->setUpdateamum($data->updateamum);
isset($data->updatevon) && $this->setUpdatevon($data->updatevon);
$this->fromdb = false;
}
public function toStdClass(): \stdClass
@@ -62,9 +69,9 @@ class Dienstverhaeltnis implements IValidation {
'updatevon' => $this->getUpdatevon()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -136,60 +143,70 @@ EOTXT;
public function setDienstverhaeltnis_id($dienstverhaeltnis_id)
{
$this->markDirty('dienstverhaeltnis_id', $this->dienstverhaeltnis_id, $dienstverhaeltnis_id);
$this->dienstverhaeltnis_id = $dienstverhaeltnis_id;
return $this;
}
public function setMitarbeiter_uid($mitarbeiter_uid)
{
$this->markDirty('mitarbeiter_uid', $this->mitarbeiter_uid, $mitarbeiter_uid);
$this->mitarbeiter_uid = $mitarbeiter_uid;
return $this;
}
public function setVertragsart_kurzbz($vertragsart_kurzbz)
{
$this->markDirty('vertragsart_kurzbz', $this->vertragsart_kurzbz, $vertragsart_kurzbz);
$this->vertragsart_kurzbz = $vertragsart_kurzbz;
return $this;
}
public function setOe_kurzbz($oe_kurzbz)
{
$this->markDirty('oe_kurzbz', $this->oe_kurzbz, $oe_kurzbz);
$this->oe_kurzbz = $oe_kurzbz;
return $this;
}
public function setVon($von)
{
$this->markDirty('von', $this->von, $von);
$this->von = $von;
return $this;
}
public function setBis($bis)
{
$this->markDirty('bis', $this->bis, $bis);
$this->bis = $bis;
return $this;
}
public function setInsertamum($insertamum)
{
$this->markDirty('insertamum', $this->insertamum, $insertamum);
$this->insertamum = $insertamum;
return $this;
}
public function setInsertvon($insertvon)
{
$this->markDirty('insertvon', $this->insertvon, $insertvon);
$this->insertvon = $insertvon;
return $this;
}
public function setUpdateamum($updateamum)
{
$this->markDirty('updateamum', $this->updateamum, $updateamum);
$this->updateamum = $updateamum;
return $this;
}
public function setUpdatevon($updatevon)
{
$this->markDirty('updatevon', $this->updatevon, $updatevon);
$this->updatevon = $updatevon;
return $this;
}
@@ -1,12 +1,13 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\AbstractBestandteil;
use DateTimeImmutable;
/**
* Salary always depends on employment (Dienstverhältnis) and optionally on part of contract (Vetragsbestandteil)
*/
class Gehaltsbestandteil implements IValidation, \JsonSerializable
class Gehaltsbestandteil extends AbstractBestandteil implements IValidation, \JsonSerializable
{
protected $gehaltsbestandteil_id;
protected $dienstverhaeltnis_id;
@@ -31,12 +32,14 @@ class Gehaltsbestandteil implements IValidation, \JsonSerializable
public function __construct()
{
parent::__construct();
$this->isvalid = false;
$this->validationerrors = array();
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
$this->fromdb = $fromdb;
isset($data->gehaltsbestandteil_id) && $this->setGehaltsbestandteil_id($data->gehaltsbestandteil_id);
isset($data->dienstverhaeltnis_id) && $this->setDienstverhaeltnis_id($data->dienstverhaeltnis_id);
isset($data->vertragsbestandteil_id) && $this->setVertragsbestandteil_id($data->vertragsbestandteil_id);
@@ -54,6 +57,7 @@ class Gehaltsbestandteil implements IValidation, \JsonSerializable
isset($data->insertvon) && $this->setInsertvon($data->insertvon);
isset($data->updateamum) && $this->setUpdateamum($data->updateamum);
isset($data->updatevon) && $this->setUpdatevon($data->updatevon);
$this->fromdb = false;
}
public function getGehaltsbestandteil_id()
@@ -153,96 +157,112 @@ class Gehaltsbestandteil implements IValidation, \JsonSerializable
public function setGehaltsbestandteil_id($gehaltsbestandteil_id)
{
$this->markDirty('gehaltsbestandteil_id', $this->gehaltsbestandteil_id, $gehaltsbestandteil_id);
$this->gehaltsbestandteil_id = $gehaltsbestandteil_id;
return $this;
}
public function setDienstverhaeltnis_id($dienstverhaeltnis_id)
{
$this->markDirty('dienstverhaeltnis_id', $this->dienstverhaeltnis_id, $dienstverhaeltnis_id);
$this->dienstverhaeltnis_id = $dienstverhaeltnis_id;
return $this;
}
public function setVertragsbestandteil_id($vertragsbestandteil_id)
{
$this->markDirty('vertragsbestandteil_id', $this->vertragsbestandteil_id, $vertragsbestandteil_id);
$this->vertragsbestandteil_id = $vertragsbestandteil_id;
return $this;
}
public function setGehaltstyp_kurzbz($gehaltstyp_kurzbz)
{
$this->markDirty('gehaltstyp_kurzbz', $this->gehaltstyp_kurzbz, $gehaltstyp_kurzbz);
$this->gehaltstyp_kurzbz = $gehaltstyp_kurzbz;
return $this;
}
public function setVon($von)
{
$this->markDirty('von', $this->von, $von);
$this->von = $von;
return $this;
}
public function setBis($bis)
{
$this->markDirty('bis', $this->bis, $bis);
$this->bis = $bis;
return $this;
}
public function setAnmerkung($anmerkung)
{
$this->markDirty('anmerkung', $this->anmerkung, $anmerkung);
$this->anmerkung = $anmerkung;
return $this;
}
public function setGrundbetrag($grundbetrag)
{
$this->markDirty('grundbetrag', $this->grundbetrag, $grundbetrag);
$this->grundbetrag = $grundbetrag;
return $this;
}
public function setBetrag_valorisiert($betrag_valorisiert)
{
$this->markDirty('betrag_valorisiert', $this->betrag_valorisiert, $betrag_valorisiert);
$this->betrag_valorisiert = $betrag_valorisiert;
return $this;
}
public function setValorisierungssperre($valorisierungssperre)
{
$this->markDirty('valorisierungssperre', $this->valorisierungssperre, $valorisierungssperre);
$this->valorisierungssperre = $valorisierungssperre;
return $this;
}
public function setValorisierung($valorisierung)
{
$this->markDirty('valorisierung', $this->valorisierung, $valorisierung);
$this->valorisierung = $valorisierung;
return $this;
}
public function setAuszahlungen($auszahlungen)
{
$this->markDirty('auszahlungen', $this->auszahlungen, $auszahlungen);
$this->auszahlungen = $auszahlungen;
return $this;
}
public function setInsertamum($insertamum)
{
$this->markDirty('insertamum', $this->insertamum, $insertamum);
$this->insertamum = $insertamum;
return $this;
}
public function setInsertvon($insertvon)
{
$this->markDirty('insertvon', $this->insertvon, $insertvon);
$this->insertvon = $insertvon;
return $this;
}
public function setUpdateamum($updateamum)
{
$this->markDirty('updateamum', $this->updateamum, $updateamum);
$this->updateamum = $updateamum;
return $this;
}
public function setUpdatevon($updatevon)
{
$this->markDirty('updatevon', $this->updatevon, $updatevon);
$this->updatevon = $updatevon;
return $this;
}
@@ -275,9 +295,9 @@ class Gehaltsbestandteil implements IValidation, \JsonSerializable
'updatevon' => $this->getUpdatevon()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -1,5 +1,6 @@
<?php
require_once __DIR__ . '/IValidation.php';
require_once __DIR__ . '/AbstractBestandteil.php';
require_once __DIR__ . '/Gehaltsbestandteil.php';
use vertragsbestandteil\Gehaltsbestandteil;
@@ -82,6 +83,10 @@ class GehaltsbestandteilLib
protected function updateGehaltsbestandteil(Gehaltsbestandteil $gehaltsbestandteil)
{
if(!$gehaltsbestandteil->isDirty()) {
return;
}
$gehaltsbestandteil->setUpdatevon($this->loggedInUser)
->setUpdateamum(strftime('%Y-%m-%d %H:%M:%S'));
$ret = $this->GehaltsbestandteilModel->update($gehaltsbestandteil->getGehaltsbestandteil_id(),
@@ -1,12 +1,14 @@
<?php
namespace vertragsbestandteil;
use vertragsbestandteil\AbstractBestandteil;
/**
* Description of Vertragsbestandteil
*
* @author bambi
*/
abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
abstract class Vertragsbestandteil extends AbstractBestandteil implements \JsonSerializable, IValidation
{
protected $vertragsbestandteil_id;
protected $dienstverhaeltnis_id;
@@ -25,13 +27,15 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
public function __construct()
{
parent::__construct();
$this->gehaltsbestandteile = array();
$this->isvalid = false;
$this->validationerrors = array();
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
$this->fromdb = $fromdb;
isset($data->vertragsbestandteil_id) && $this->setVertragsbestandteil_id($data->vertragsbestandteil_id);
isset($data->dienstverhaeltnis_id) && $this->setDienstverhaeltnis_id($data->dienstverhaeltnis_id);
isset($data->von) && $this->setVon($data->von);
@@ -40,6 +44,7 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
isset($data->insertvon) && $this->setInsertvon($data->insertvon);
isset($data->updateamum) && $this->setUpdateamum($data->updateamum);
isset($data->updatevon) && $this->setUpdatevon($data->updatevon);
$this->fromdb = false;
}
public function addGehaltsbestandteil(Gehaltsbestandteil $gehaltsbestandteil)
@@ -108,6 +113,7 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
public function setVertragsbestandteil_id($vertragsbestandteil_id)
{
$this->markDirty('vertragsbestandteil_id', $this->vertragsbestandteil_id, $vertragsbestandteil_id);
$this->vertragsbestandteil_id = $vertragsbestandteil_id;
foreach ($this->gehaltsbestandteile as $gehaltsbestandteil)
{
@@ -118,6 +124,7 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
public function setDienstverhaeltnis_id($dienstverhaeltnis_id)
{
$this->markDirty('dienstverhaeltnis_id', $this->dienstverhaeltnis_id, $dienstverhaeltnis_id);
$this->dienstverhaeltnis_id = $dienstverhaeltnis_id;
foreach ($this->gehaltsbestandteile as $gehaltsbestandteil)
{
@@ -128,42 +135,50 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
public function setVon($von)
{
$this->markDirty('von', $this->von, $von);
$this->von = $von;
return $this;
}
public function setBis($bis)
{
$this->markDirty('bis', $this->bis, $bis);
$this->bis = $bis;
return $this;
}
public function setVertragsbestandteiltyp_kurzbz($vertragsbestandteiltyp_kurzbz)
{
// type should never change and is set in constructor so do not mark dirty
//$this->markDirty('vertragsbestandteiltyp_kurzbz', $this->vertragsbestandteiltyp_kurzbz, $vertragsbestandteiltyp_kurzbz);
$this->vertragsbestandteiltyp_kurzbz = $vertragsbestandteiltyp_kurzbz;
return $this;
}
public function setInsertamum($insertamum)
{
$this->markDirty('insertamum', $this->insertamum, $insertamum);
$this->insertamum = $insertamum;
return $this;
}
public function setInsertvon($insertvon)
{
$this->markDirty('insertvon', $this->insertvon, $insertvon);
$this->insertvon = $insertvon;
return $this;
}
public function setUpdateamum($updateamum)
{
$this->markDirty('updateamum', $this->updateamum, $updateamum);
$this->updateamum = $updateamum;
return $this;
}
public function setUpdatevon($updatevon)
{
$this->markDirty('updatevon', $this->updatevon, $updatevon);
$this->updatevon = $updatevon;
return $this;
}
@@ -181,9 +196,9 @@ abstract class Vertragsbestandteil implements \JsonSerializable, IValidation
'updatevon' => $this->getUpdatevon(),
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -23,7 +23,7 @@ class VertragsbestandteilFactory
const VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG = 'zeitaufzeichnung';
const VERTRAGSBESTANDTEIL_LEHRE = 'lehre';
public static function getVertragsbestandteil($data)
public static function getVertragsbestandteil($data, $fromdb=false)
{
$vertragsbestandteiltyp_kurzbz = isset($data->vertragsbestandteiltyp_kurzbz)
? $data->vertragsbestandteiltyp_kurzbz : false;
@@ -37,37 +37,37 @@ class VertragsbestandteilFactory
{
case self::VERTRAGSBESTANDTEIL_FREITEXT:
$vertragsbestandteil = new VertragsbestandteilFreitext();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_FUNKTION:
$vertragsbestandteil = new VertragsbestandteilFunktion();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_KARENZ:
$vertragsbestandteil = new VertragsbestandteilKarenz();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST:
$vertragsbestandteil = new VertragsbestandteilKuendigungsfrist();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_STUNDEN:
$vertragsbestandteil = new VertragsbestandteilStunden();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH:
$vertragsbestandteil = new VertragsbestandteilUrlaubsanspruch();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
case self::VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG:
$vertragsbestandteil = new VertragsbestandteilZeitaufzeichnung();
$vertragsbestandteil->hydrateByStdClass($data);
$vertragsbestandteil->hydrateByStdClass($data, $fromdb);
break;
default:
@@ -17,14 +17,16 @@ class VertragsbestandteilFreitext extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_FREITEXT);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->freitexttyp) && $this->setFreitexttypKurzbz($data->freitexttyp);
isset($data->freitexttyp_kurzbz) && $this->setFreitexttypKurzbz($data->freitexttyp_kurzbz);
isset($data->titel) && $this->setTitel($data->titel);
isset($data->freitext) && $this->setAnmerkung($data->freitext);
isset($data->anmerkung) && $this->setAnmerkung($data->anmerkung);
$this->fromdb = false;
}
public function toStdClass(): \stdClass
@@ -36,9 +38,9 @@ class VertragsbestandteilFreitext extends Vertragsbestandteil
'anmerkung' => $this->getAnmerkung()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -67,6 +69,7 @@ EOTXT;
*/
public function setAnmerkung($anmerkung): self
{
$this->markDirty('anmerkung', $this->anmerkung, $anmerkung);
$this->anmerkung = $anmerkung;
return $this;
@@ -85,6 +88,7 @@ EOTXT;
*/
public function setTitel($titel): self
{
$this->markDirty('titel', $this->titel, $titel);
$this->titel = $titel;
return $this;
@@ -103,6 +107,7 @@ EOTXT;
*/
public function setFreitexttypKurzbz($freitexttyp_kurzbz): self
{
$this->markDirty('freitexttyp_kurzbz', $this->freitexttyp_kurzbz, $freitexttyp_kurzbz);
$this->freitexttyp_kurzbz = $freitexttyp_kurzbz;
return $this;
@@ -78,9 +78,9 @@ class VertragsbestandteilFunktion extends Vertragsbestandteil
'benutzerfunktion_id' => $this->getBenutzerfunktion_id()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -94,15 +94,17 @@ EOTXT;
return parent::__toString() . $txt;
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->benutzerfunktionid) && $this->setBenutzerfunktion_id($data->benutzerfunktionid);
isset($data->benutzerfunktion_id) && $this->setBenutzerfunktion_id($data->benutzerfunktion_id);
isset($data->funktion) && isset($data->orget)
&& isset($data->mitarbeiter_uid) && $this->createBenutzerfunktionData($data);
isset($data->funktion_bezeichnung) && isset($data->oe_bezeichnung)
&& $this->createBenutzerfunktionData4Display($data);
$this->fromdb = false;
}
@@ -113,6 +115,7 @@ EOTXT;
public function setBenutzerfunktion_id($benutzerfunktion_id)
{
$this->markDirty('benutzerfunktion_id', $this->benutzerfunktion_id, $benutzerfunktion_id);
$this->benutzerfunktion_id = $benutzerfunktion_id;
return $this;
}
@@ -17,12 +17,14 @@ class VertragsbestandteilKarenz extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_KARENZ);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->karenztyp_kurzbz) && $this->setKarenztypKurzbz($data->karenztyp_kurzbz);
isset($data->geplanter_geburtstermin) && $this->setGeplanterGeburtstermin($data->geplanter_geburtstermin);
isset($data->tatsaechlicher_geburtstermin) && $this->setTatsaechlicherGeburtstermin($data->tatsaechlicher_geburtstermin);
$this->fromdb = false;
}
/**
@@ -38,6 +40,7 @@ class VertragsbestandteilKarenz extends Vertragsbestandteil
*/
public function setKarenztypKurzbz($karenztyp_kurzbz): self
{
$this->markDirty('karenztyp_kurzbz', $this->karenztyp_kurzbz, $karenztyp_kurzbz);
$this->karenztyp_kurzbz = $karenztyp_kurzbz;
return $this;
@@ -56,6 +59,7 @@ class VertragsbestandteilKarenz extends Vertragsbestandteil
*/
public function setTatsaechlicherGeburtstermin($tatsaechlicher_geburtstermin): self
{
$this->markDirty('tatsaechlicher_geburtstermin', $this->tatsaechlicher_geburtstermin, $tatsaechlicher_geburtstermin);
$this->tatsaechlicher_geburtstermin = $tatsaechlicher_geburtstermin;
return $this;
@@ -74,6 +78,7 @@ class VertragsbestandteilKarenz extends Vertragsbestandteil
*/
public function setGeplanterGeburtstermin($geplanter_geburtstermin): self
{
$this->markDirty('geplanter_geburtstermin', $this->geplanter_geburtstermin, $geplanter_geburtstermin);
$this->geplanter_geburtstermin = $geplanter_geburtstermin;
return $this;
@@ -88,9 +93,9 @@ class VertragsbestandteilKarenz extends Vertragsbestandteil
'geplanter_geburtstermin' => $this->getGeplanterGeburtstermin()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -16,11 +16,13 @@ class VertragsbestandteilKuendigungsfrist extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_KUENDIGUNGSFRIST);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->arbeitgeber_frist) && $this->setArbeitgeberFrist($data->arbeitgeber_frist);
isset($data->arbeitnehmer_frist) && $this->setArbeitnehmerFrist($data->arbeitnehmer_frist);
$this->fromdb = false;
}
/**
@@ -36,6 +38,7 @@ class VertragsbestandteilKuendigungsfrist extends Vertragsbestandteil
*/
public function setArbeitgeberFrist($arbeitgeber_frist): self
{
$this->markDirty('arbeitgeber_frist', $this->arbeitgeber_frist, $arbeitgeber_frist);
$this->arbeitgeber_frist = $arbeitgeber_frist;
return $this;
@@ -54,6 +57,7 @@ class VertragsbestandteilKuendigungsfrist extends Vertragsbestandteil
*/
public function setArbeitnehmerFrist($arbeitnehmer_frist): self
{
$this->markDirty('arbeitnehmer_frist', $this->arbeitnehmer_frist, $arbeitnehmer_frist);
$this->arbeitnehmer_frist = $arbeitnehmer_frist;
return $this;
@@ -67,9 +71,9 @@ class VertragsbestandteilKuendigungsfrist extends Vertragsbestandteil
'arbeitnehmer_frist' => $this->getArbeitnehmerFrist()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -1,5 +1,6 @@
<?php
require_once __DIR__ . '/IValidation.php';
require_once __DIR__ . '/AbstractBestandteil.php';
require_once __DIR__ . '/Dienstverhaeltnis.php';
require_once __DIR__ . '/Vertragsbestandteil.php';
require_once __DIR__ . '/VertragsbestandteilStunden.php';
@@ -73,7 +74,7 @@ class VertragsbestandteilLib
if(null !== ($row = getData($result)))
{
$dv = new Dienstverhaeltnis();
$dv->hydrateByStdClass($row[0]);
$dv->hydrateByStdClass($row[0], true);
}
return $dv;
}
@@ -270,6 +271,10 @@ class VertragsbestandteilLib
protected function updateDienstverhaeltnis(Dienstverhaeltnis $dv)
{
if(!$dv->isDirty()) {
return;
}
$dv->setUpdatevon($this->loggedInUser)
->setUpdateamum(strftime('%Y-%m-%d %H:%M:%S'));
$ret = $this->DienstverhaeltnisModel->update($dv->getDienstverhaeltnis_id(),
@@ -315,26 +320,28 @@ class VertragsbestandteilLib
protected function updateVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil)
{
$vertragsbestandteil->setUpdatevon($this->loggedInUser)
->setUpdateamum(strftime('%Y-%m-%d %H:%M:%S'));
$vertragsbestandteil->beforePersist();
$ret = $this->VertragsbestandteilModel->update($vertragsbestandteil->getVertragsbestandteil_id(),
$vertragsbestandteil->baseToStdClass());
if($vertragsbestandteil->isDirty()) {
$vertragsbestandteil->setUpdatevon($this->loggedInUser)
->setUpdateamum(strftime('%Y-%m-%d %H:%M:%S'));
$vertragsbestandteil->beforePersist();
$ret = $this->VertragsbestandteilModel->update($vertragsbestandteil->getVertragsbestandteil_id(),
$vertragsbestandteil->baseToStdClass());
if(isError($ret) )
{
throw new Exception('error updating vertragsbestandteil');
}
if(isError($ret) )
{
throw new Exception('error updating vertragsbestandteil');
}
$specialisedModel = VertragsbestandteilFactory::getVertragsbestandteilDBModel(
$vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
$retspecial = $specialisedModel->update($vertragsbestandteil->getVertragsbestandteil_id(),
$vertragsbestandteil->toStdClass());
$specialisedModel = VertragsbestandteilFactory::getVertragsbestandteilDBModel(
$vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
$retspecial = $specialisedModel->update($vertragsbestandteil->getVertragsbestandteil_id(),
$vertragsbestandteil->toStdClass());
if(isError($retspecial) )
{
throw new Exception('error updating vertragsbestandteil '
. $vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
if(isError($retspecial) )
{
throw new Exception('error updating vertragsbestandteil '
. $vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
}
}
try
@@ -24,11 +24,13 @@ class VertragsbestandteilStunden extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_STUNDEN);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->wochenstunden) && $this->setWochenstunden($data->wochenstunden);
isset($data->teilzeittyp_kurzbz) && $this->setTeilzeittyp_kurzbz($data->teilzeittyp_kurzbz);
$this->fromdb = false;
}
public function getWochenstunden()
@@ -43,14 +45,17 @@ class VertragsbestandteilStunden extends Vertragsbestandteil
public function setWochenstunden($wochenstunden)
{
$this->markDirty('wochenstunden', $this->wochenstunden, $wochenstunden);
$this->wochenstunden = $wochenstunden;
return $this;
}
public function setTeilzeittyp_kurzbz($teilzeittyp_kurzbz)
{
$this->teilzeittyp_kurzbz = ($teilzeittyp_kurzbz !== '')
$teilzeittyp_kurzbz = ($teilzeittyp_kurzbz !== '')
? $teilzeittyp_kurzbz : null;
$this->markDirty('teilzeittyp_kurzbz', $this->teilzeittyp_kurzbz, $teilzeittyp_kurzbz);
$this->teilzeittyp_kurzbz = $teilzeittyp_kurzbz;
return $this;
}
@@ -62,9 +67,9 @@ class VertragsbestandteilStunden extends Vertragsbestandteil
'teilzeittyp_kurzbz' => $this->getTeilzeittyp_kurzbz()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -15,10 +15,12 @@ class VertragsbestandteilUrlaubsanspruch extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_URLAUBSANSPRUCH);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->tage) && $this->setTage($data->tage);
$this->fromdb = false;
}
/**
@@ -34,6 +36,7 @@ class VertragsbestandteilUrlaubsanspruch extends Vertragsbestandteil
*/
public function setTage($tage): self
{
$this->markDirty('tage', $this->tage, $tage);
$this->tage = $tage;
return $this;
@@ -46,9 +49,9 @@ class VertragsbestandteilUrlaubsanspruch extends Vertragsbestandteil
'tage' => $this->getTage(),
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -17,12 +17,14 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
VertragsbestandteilFactory::VERTRAGSBESTANDTEIL_ZEITAUFZEICHNUNG);
}
public function hydrateByStdClass($data)
public function hydrateByStdClass($data, $fromdb=false)
{
parent::hydrateByStdClass($data);
parent::hydrateByStdClass($data, $fromdb);
$this->fromdb = $fromdb;
isset($data->zeitaufzeichnung) && $this->setZeitaufzeichnung($data->zeitaufzeichnung);
isset($data->azgrelevant) && $this->setAzgrelevant($data->azgrelevant);
isset($data->homeoffice) && $this->setHomeoffice($data->homeoffice);
$this->fromdb = false;
}
/**
@@ -38,6 +40,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
*/
public function setZeitaufzeichnung($zeitaufzeichnung): self
{
$this->markDirty('zeitaufzeichnung', $this->zeitaufzeichnung, $zeitaufzeichnung);
$this->zeitaufzeichnung = $zeitaufzeichnung;
return $this;
@@ -56,6 +59,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
*/
public function setAzgrelevant($azgrelevant): self
{
$this->markDirty('azgrelevant', $this->azgrelevant, $azgrelevant);
$this->azgrelevant = $azgrelevant;
return $this;
@@ -74,6 +78,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
*/
public function setHomeoffice($homeoffice): self
{
$this->markDirty('homeoffice', $this->homeoffice, $homeoffice);
$this->homeoffice = $homeoffice;
return $this;
@@ -88,9 +93,9 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
'homeoffice' => $this->getHomeoffice()
);
$tmp = array_filter($tmp, function($v) {
return !is_null($v);
});
$tmp = array_filter($tmp, function($k) {
return in_array($k, $this->modifiedcolumns);
}, ARRAY_FILTER_USE_KEY);
return (object) $tmp;
}
@@ -121,7 +121,7 @@ EOSQL;
{
foreach( $rows as $row ) {
$tmpgb = new Gehaltsbestandteil();
$tmpgb->hydrateByStdClass($row);
$tmpgb->hydrateByStdClass($row, true);
$gehaltsbestandteile[] = $tmpgb;
}
}
@@ -139,7 +139,7 @@ EOSQL;
if( null !== ($row = getData($query)) )
{
$gehaltsbestandteil = new Gehaltsbestandteil();
$gehaltsbestandteil->hydrateByStdClass($row[0]);
$gehaltsbestandteil->hydrateByStdClass($row[0], true);
}
return $gehaltsbestandteil;
@@ -97,7 +97,7 @@ EOSQL;
foreach( $data as $row ) {
try
{
$vertragsbestandteile[] = VertragsbestandteilFactory::getVertragsbestandteil($row);
$vertragsbestandteile[] = VertragsbestandteilFactory::getVertragsbestandteil($row, true);
}
catch (Exception $ex)
{
@@ -129,7 +129,7 @@ EOSQL;
$data = getData($query)[0];
try
{
$vertragsbestandteil = VertragsbestandteilFactory::getVertragsbestandteil($data); // TODO add decryption
$vertragsbestandteil = VertragsbestandteilFactory::getVertragsbestandteil($data, true); // TODO add decryption
}
catch (Exception $ex)
{
@@ -123,6 +123,7 @@
generateJSsInclude('vendor/npm-asset/primevue/calendar/calendar.min.js');
generateJSsInclude('vendor/npm-asset/primevue/skeleton/skeleton.min.js');
generateJSsInclude('vendor/npm-asset/primevue/timeline/timeline.min.js');
generateJSsInclude('vendor/npm-asset/primevue/autocomplete/autocomplete.min.js');
}
// --------------------------------------------------------------------------------------------------------
+7 -7
View File
@@ -352,9 +352,9 @@
"type": "package",
"package": {
"name": "vuejs/vuedatepicker_js",
"version": "4.2.3",
"version": "5.4.0",
"dist": {
"url": "https://unpkg.com/@vuepic/vue-datepicker@4.2.3/dist/vue-datepicker.iife.js",
"url": "https://unpkg.com/@vuepic/vue-datepicker@5.4.0/dist/vue-datepicker.iife.js",
"type": "file"
}
}
@@ -363,9 +363,9 @@
"type": "package",
"package": {
"name": "vuejs/vuedatepicker_css",
"version": "4.2.3",
"version": "5.4.0",
"dist": {
"url": "https://unpkg.com/@vuepic/vue-datepicker@4.2.3/dist/main.css",
"url": "https://unpkg.com/@vuepic/vue-datepicker@5.4.0/dist/main.css",
"type": "file"
}
}
@@ -422,7 +422,7 @@
"nategood/httpful": "0.2.*",
"netcarver/textile": "3.7.*",
"nicolaskruchten/pivottable": "2.23.0",
"npm-asset/primevue": "3.15.*",
"npm-asset/primevue": "3.29.1",
"npm-asset/primeicons": "5.0.0",
"olifolkerd/tabulator4": "4.9.*",
@@ -443,8 +443,8 @@
"vuejs/vuejs3": "3.2.33",
"vuejs/vuerouter4": "4.1.3",
"vuejs/vuedatepicker_js": "4.2.3",
"vuejs/vuedatepicker_css": "4.2.3"
"vuejs/vuedatepicker_js": "5.4.0",
"vuejs/vuedatepicker_css": "5.4.0"
},
"config": {
"bin-dir": "vendor/bin"
Generated
+8 -8
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "12acec21673c71641f7f1a6586ec666f",
"content-hash": "ca679afc87606768c8ae706f9a8ac6b6",
"packages": [
{
"name": "afarkas/html5shiv",
@@ -1490,10 +1490,10 @@
},
{
"name": "npm-asset/primevue",
"version": "3.15.0",
"version": "3.29.1",
"dist": {
"type": "tar",
"url": "https://registry.npmjs.org/primevue/-/primevue-3.15.0.tgz"
"url": "https://registry.npmjs.org/primevue/-/primevue-3.29.1.tgz"
},
"type": "npm-asset",
"license": [
@@ -1850,19 +1850,19 @@
},
{
"name": "vuejs/vuedatepicker_css",
"version": "4.2.3",
"version": "5.4.0",
"dist": {
"type": "file",
"url": "https://unpkg.com/@vuepic/vue-datepicker@4.2.3/dist/main.css"
"url": "https://unpkg.com/@vuepic/vue-datepicker@5.4.0/dist/main.css"
},
"type": "library"
},
{
"name": "vuejs/vuedatepicker_js",
"version": "4.2.3",
"version": "5.4.0",
"dist": {
"type": "file",
"url": "https://unpkg.com/@vuepic/vue-datepicker@4.2.3/dist/vue-datepicker.iife.js"
"url": "https://unpkg.com/@vuepic/vue-datepicker@5.4.0/dist/vue-datepicker.iife.js"
},
"type": "library"
},
@@ -4738,5 +4738,5 @@
"php": ">=5.6.40"
},
"platform-dev": [],
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.1.0"
}