mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
changes for aenderung and korrektur
This commit is contained in:
@@ -26,9 +26,9 @@ class GehaltsbestandteilLib
|
||||
$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)
|
||||
@@ -93,4 +93,13 @@ class GehaltsbestandteilLib
|
||||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
return;
|
||||
@@ -43,9 +68,9 @@ class VertragsbestandteilFunktion extends Vertragsbestandteil
|
||||
throw new Exception('failed to create Benutzerfunktion');
|
||||
}
|
||||
|
||||
$this->setBenutzerfunktion_id(getData($ret));
|
||||
$this->setBenutzerfunktion_id(getData($ret));
|
||||
}
|
||||
|
||||
|
||||
public function toStdClass()
|
||||
{
|
||||
$tmp = array(
|
||||
|
||||
@@ -21,7 +21,10 @@ use vertragsbestandteil\VertragsbestandteilFactory;
|
||||
* @author bambi
|
||||
*/
|
||||
class VertragsbestandteilLib
|
||||
{
|
||||
{
|
||||
const INCLUDE_FUTURE = true;
|
||||
const DO_NOT_INCLUDE_FUTURE = false;
|
||||
|
||||
protected $CI;
|
||||
/** @var Dienstverhaeltnis_model */
|
||||
protected $DienstverhaeltnisModel;
|
||||
@@ -75,10 +78,10 @@ class VertragsbestandteilLib
|
||||
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);
|
||||
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag);
|
||||
$vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
|
||||
$gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture);
|
||||
|
||||
$gbsByVBid = array();
|
||||
foreach( $gbs as $gb )
|
||||
@@ -259,4 +262,22 @@ class VertragsbestandteilLib
|
||||
$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)';
|
||||
if( $includefuture )
|
||||
{
|
||||
$stichtagclause .= ' OR COALESCE(v.von, \'1970-01-01\'::date) > '
|
||||
$stichtagclause .= ' OR COALESCE(von, \'1970-01-01\'::date) > '
|
||||
. $this->escape($date);
|
||||
}
|
||||
$stichtagclause .= ')';
|
||||
@@ -113,6 +113,7 @@ EOSQL;
|
||||
|
||||
public function getGehaltsbestandteil($id)
|
||||
{
|
||||
$this->addSelect('*');
|
||||
$query = $this->load($id, $this->getEncryptedColumns());
|
||||
$gehaltsbestandteil = null;
|
||||
|
||||
|
||||
@@ -120,19 +120,23 @@ EOSQL;
|
||||
;
|
||||
EOSQL;
|
||||
|
||||
// echo $sql . "\n\n";
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
$vertragsbestandteil = array();
|
||||
try
|
||||
$query = $this->execReadOnlyQuery($sql);
|
||||
|
||||
$vertragsbestandteil = null;
|
||||
|
||||
if( hasData($query) )
|
||||
{
|
||||
$vertragsbestandteile = VertragsbestandteilFactory::getVertragsbestandteil($row); // TODO add decryption
|
||||
$data = getData($query)[0];
|
||||
try
|
||||
{
|
||||
$vertragsbestandteil = VertragsbestandteilFactory::getVertragsbestandteil($data); // TODO add decryption
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
echo $ex->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
echo $ex->getMessage() . "\n";
|
||||
}
|
||||
|
||||
|
||||
return $vertragsbestandteil;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user