mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 09:04:28 +00:00
changes for aenderung and korrektur
This commit is contained in:
@@ -26,9 +26,9 @@ class GehaltsbestandteilLib
|
|||||||
$this->GehaltsbestandteilModel = $this->CI->GehaltsbestandteilModel;
|
$this->GehaltsbestandteilModel = $this->CI->GehaltsbestandteilModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null)
|
public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
|
||||||
{
|
{
|
||||||
return $this->GehaltsbestandteilModel->getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag);
|
return $this->GehaltsbestandteilModel->getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchGehaltsbestandteil($gehaltsbestandteil_id)
|
public function fetchGehaltsbestandteil($gehaltsbestandteil_id)
|
||||||
@@ -93,4 +93,13 @@ class GehaltsbestandteilLib
|
|||||||
throw new Exception('error updating gehaltsbestandteil');
|
throw new Exception('error updating gehaltsbestandteil');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteGehaltsbestandteil(Gehaltsbestandteil $gehaltsbestandteil)
|
||||||
|
{
|
||||||
|
$ret = $this->GehaltsbestandteilModel->delete($gehaltsbestandteil->getGehaltsbestandteil_id());
|
||||||
|
if(isError($ret) )
|
||||||
|
{
|
||||||
|
throw new Exception('error deleting gehaltsbestandteil');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,31 @@ class VertragsbestandteilFunktion extends Vertragsbestandteil
|
|||||||
|
|
||||||
public function beforePersist()
|
public function beforePersist()
|
||||||
{
|
{
|
||||||
|
if( isset($this->benutzerfunktion_id) && intval($this->benutzerfunktion_id) > 0 )
|
||||||
|
{
|
||||||
|
$this->beforePersitExisting();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->beforePersitNew();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function beforePersitExisting() {
|
||||||
|
$data = (object) array(
|
||||||
|
'datum_bis' => $this->getBis(),
|
||||||
|
'updateamum' => strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
|
'updatevon' => getAuthUID()
|
||||||
|
);
|
||||||
|
$ret = $this->CI->BenutzerfunktionModel->update($this->getBenutzerfunktion_id(), $data);
|
||||||
|
|
||||||
|
if(isError($ret) )
|
||||||
|
{
|
||||||
|
throw new Exception('failed to update Benutzerfunktion');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function beforePersitNew() {
|
||||||
if( $this->benutzerfunktiondata === null)
|
if( $this->benutzerfunktiondata === null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ use vertragsbestandteil\VertragsbestandteilFactory;
|
|||||||
*/
|
*/
|
||||||
class VertragsbestandteilLib
|
class VertragsbestandteilLib
|
||||||
{
|
{
|
||||||
|
const INCLUDE_FUTURE = true;
|
||||||
|
const DO_NOT_INCLUDE_FUTURE = false;
|
||||||
|
|
||||||
protected $CI;
|
protected $CI;
|
||||||
/** @var Dienstverhaeltnis_model */
|
/** @var Dienstverhaeltnis_model */
|
||||||
protected $DienstverhaeltnisModel;
|
protected $DienstverhaeltnisModel;
|
||||||
@@ -75,10 +78,10 @@ class VertragsbestandteilLib
|
|||||||
return $dv;
|
return $dv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null)
|
public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false)
|
||||||
{
|
{
|
||||||
$vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag);
|
$vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
|
||||||
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag);
|
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
|
||||||
|
|
||||||
$gbsByVBid = array();
|
$gbsByVBid = array();
|
||||||
foreach( $gbs as $gb )
|
foreach( $gbs as $gb )
|
||||||
@@ -259,4 +262,22 @@ class VertragsbestandteilLib
|
|||||||
$dv->getDienstverhaeltnis_id()
|
$dv->getDienstverhaeltnis_id()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteVertragsbestandteil(Vertragsbestandteil $vertragsbestandteil)
|
||||||
|
{
|
||||||
|
$specialisedModel = VertragsbestandteilFactory::getVertragsbestandteilDBModel(
|
||||||
|
$vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
|
||||||
|
$retspecial = $specialisedModel->delete($vertragsbestandteil->getVertragsbestandteil_id());
|
||||||
|
if(isError($retspecial) )
|
||||||
|
{
|
||||||
|
throw new Exception('error deleting vertragsbestandteil '
|
||||||
|
. $vertragsbestandteil->getVertragsbestandteiltyp_kurzbz());
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = $this->VertragsbestandteilModel->delete($vertragsbestandteil->getVertragsbestandteil_id());
|
||||||
|
if(isError($ret) )
|
||||||
|
{
|
||||||
|
throw new Exception('error deleting vertragsbestandteil');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption
|
|||||||
. ' AND COALESCE(bis, \'2170-01-01\'::date)';
|
. ' AND COALESCE(bis, \'2170-01-01\'::date)';
|
||||||
if( $includefuture )
|
if( $includefuture )
|
||||||
{
|
{
|
||||||
$stichtagclause .= ' OR COALESCE(v.von, \'1970-01-01\'::date) > '
|
$stichtagclause .= ' OR COALESCE(von, \'1970-01-01\'::date) > '
|
||||||
. $this->escape($date);
|
. $this->escape($date);
|
||||||
}
|
}
|
||||||
$stichtagclause .= ')';
|
$stichtagclause .= ')';
|
||||||
@@ -113,6 +113,7 @@ EOSQL;
|
|||||||
|
|
||||||
public function getGehaltsbestandteil($id)
|
public function getGehaltsbestandteil($id)
|
||||||
{
|
{
|
||||||
|
$this->addSelect('*');
|
||||||
$query = $this->load($id, $this->getEncryptedColumns());
|
$query = $this->load($id, $this->getEncryptedColumns());
|
||||||
$gehaltsbestandteil = null;
|
$gehaltsbestandteil = null;
|
||||||
|
|
||||||
|
|||||||
@@ -120,17 +120,21 @@ EOSQL;
|
|||||||
;
|
;
|
||||||
EOSQL;
|
EOSQL;
|
||||||
|
|
||||||
// echo $sql . "\n\n";
|
$query = $this->execReadOnlyQuery($sql);
|
||||||
$query = $this->db->query($sql);
|
|
||||||
|
|
||||||
$vertragsbestandteil = array();
|
$vertragsbestandteil = null;
|
||||||
try
|
|
||||||
|
if( hasData($query) )
|
||||||
{
|
{
|
||||||
$vertragsbestandteile = VertragsbestandteilFactory::getVertragsbestandteil($row); // TODO add decryption
|
$data = getData($query)[0];
|
||||||
}
|
try
|
||||||
catch (Exception $ex)
|
{
|
||||||
{
|
$vertragsbestandteil = VertragsbestandteilFactory::getVertragsbestandteil($data); // TODO add decryption
|
||||||
echo $ex->getMessage() . "\n";
|
}
|
||||||
|
catch (Exception $ex)
|
||||||
|
{
|
||||||
|
echo $ex->getMessage() . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $vertragsbestandteil;
|
return $vertragsbestandteil;
|
||||||
|
|||||||
Reference in New Issue
Block a user