mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 09:04:28 +00:00
Merge branch 'feature-25562/PV21_Vertraege_Encryption_Merge'
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user