mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
- stundensaetze fas
This commit is contained in:
@@ -977,6 +977,36 @@ class organisationseinheit extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getRoots()
|
||||
{
|
||||
$qry = "SELECT *
|
||||
FROM public.tbl_organisationseinheit
|
||||
WHERE oe_parent_kurzbz IS NULL AND aktiv
|
||||
ORDER BY organisationseinheittyp_kurzbz, bezeichnung";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new organisationseinheit();
|
||||
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
|
||||
$obj->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
|
||||
$obj->lehre = $this->db_parse_bool($row->lehre);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Organisationseinheiten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -19,9 +19,10 @@ class stundensatz extends basis_db
|
||||
public $insertvon; // varchar(16)
|
||||
public $updateamum; // timestamp
|
||||
public $updatevon; // varchar(16)
|
||||
|
||||
|
||||
|
||||
public $oe_bezeichnung;
|
||||
public $stundensatztyp_bezeichnung;
|
||||
|
||||
public function __construct($stundensatz_id = null)
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -78,5 +79,211 @@ class stundensatz extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllStundensaetze($uid)
|
||||
{
|
||||
$qry = "SELECT
|
||||
tbl_stundensatz.*,
|
||||
tbl_organisationseinheit.bezeichnung AS oe_bezeichnung,
|
||||
hr.tbl_stundensatztyp.bezeichnung AS stundensatztyp_bezeichnung,
|
||||
tbl_organisationseinheit.oe_kurzbz
|
||||
FROM
|
||||
hr.tbl_stundensatz
|
||||
LEFT JOIN
|
||||
public.tbl_organisationseinheit ON tbl_stundensatz.oe_kurzbz = tbl_organisationseinheit.oe_kurzbz
|
||||
JOIN hr.tbl_stundensatztyp USING(stundensatztyp)
|
||||
WHERE
|
||||
uid = ". $this->db_add_param($uid);
|
||||
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new stundensatz();
|
||||
$obj->stundensatz_id = $row->stundensatz_id;
|
||||
$obj->uid = $row->uid;
|
||||
$obj->stundensatztyp = $row->stundensatztyp;
|
||||
$obj->stundensatz = $row->stundensatz;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->gueltig_von = $row->gueltig_von;
|
||||
$obj->gueltig_bis = $row->gueltig_bis;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->oe_bezeichnung = $row->oe_bezeichnung;
|
||||
$obj->stundensatztyp_bezeichnung = $row->stundensatztyp_bezeichnung;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function load($stundensatz_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
tbl_stundensatz.*,
|
||||
tbl_organisationseinheit.bezeichnung AS oe_bezeichnung,
|
||||
hr.tbl_stundensatztyp.bezeichnung AS stundensatztyp_bezeichnung,
|
||||
tbl_organisationseinheit.oe_kurzbz
|
||||
FROM
|
||||
hr.tbl_stundensatz
|
||||
LEFT JOIN public.tbl_organisationseinheit ON tbl_stundensatz.oe_kurzbz = tbl_organisationseinheit.oe_kurzbz
|
||||
JOIN hr.tbl_stundensatztyp USING(stundensatztyp)
|
||||
WHERE
|
||||
stundensatz_id = ".$this->db_add_param($stundensatz_id).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->stundensatz_id = $row->stundensatz_id;
|
||||
$this->uid = $row->uid;
|
||||
$this->stundensatztyp = $row->stundensatztyp;
|
||||
$this->stundensatz = $row->stundensatz;
|
||||
$this->oe_kurzbz = $row->oe_kurzbz;
|
||||
$this->gueltig_von = $row->gueltig_von;
|
||||
$this->gueltig_bis = $row->gueltig_bis;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->oe_bezeichnung = $row->oe_bezeichnung;
|
||||
$this->stundensatztyp_bezeichnung = $row->stundensatztyp_bezeichnung;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function save($new = null)
|
||||
{
|
||||
if (!$this->validate())
|
||||
return false;
|
||||
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if ($new)
|
||||
{
|
||||
|
||||
$qry = "BEGIN;INSERT INTO hr.tbl_stundensatz
|
||||
(
|
||||
uid,
|
||||
stundensatz,
|
||||
gueltig_von,
|
||||
gueltig_bis,
|
||||
oe_kurzbz,
|
||||
stundensatztyp,
|
||||
insertamum,
|
||||
insertvon
|
||||
)
|
||||
VALUES
|
||||
(" .
|
||||
$this->db_add_param($this->uid) . "," .
|
||||
$this->db_add_param($this->stundensatz, FHC_INTEGER) . "," .
|
||||
$this->db_add_param($this->gueltig_von) . "," .
|
||||
$this->db_add_param($this->gueltig_bis) . "," .
|
||||
$this->db_add_param($this->oe_kurzbz) . "," .
|
||||
$this->db_add_param($this->stundensatztyp) . "," .
|
||||
$this->db_add_param($this->insertamum) . "," .
|
||||
$this->db_add_param($this->insertvon) .
|
||||
");";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "UPDATE hr.tbl_stundensatz SET " .
|
||||
"stundensatz = " . $this->db_add_param($this->stundensatz, FHC_INTEGER) .",".
|
||||
"oe_kurzbz = " . $this->db_add_param($this->oe_kurzbz) .",".
|
||||
"stundensatztyp = " . $this->db_add_param($this->stundensatztyp) .",".
|
||||
"gueltig_von = " . $this->db_add_param($this->gueltig_von) .",".
|
||||
"gueltig_bis = " . $this->db_add_param($this->gueltig_bis) .",".
|
||||
"updatevon = " . $this->db_add_param($this->updatevon) .",".
|
||||
"updateamum = " . $this->db_add_param($this->updateamum).
|
||||
" WHERE stundensatz_id = " . $this->db_add_param($this->stundensatz_id, FHC_INTEGER).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if ($new)
|
||||
{
|
||||
$qry = "SELECT currval('hr.tbl_stundensatz_stundensatz_id_seq') as id;";
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->stundensatz_id = $row->id;
|
||||
$this->db_query('COMMIT');
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
$this->db_query('ROLLBACK');
|
||||
$this->errormsg = "Fehler beim Auslesen der Sequence";
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
$this->db_query('ROLLBACK');
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Zuteilen des Eintrages';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($stundensatz_id)
|
||||
{
|
||||
$qry = "DELETE FROM hr.tbl_stundensatz WHERE stundensatz_id = ".$this->db_add_param($stundensatz_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Löschen des Stundensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function validate()
|
||||
{
|
||||
if (!is_numeric($this->stundensatz))
|
||||
{
|
||||
$this->errormsg = "Stundensatz ungueltig";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($this->oe_kurzbz))
|
||||
{
|
||||
$this->errormsg = "Unternehmen ungueltig";
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->insertamum === '')
|
||||
{
|
||||
$this->errormsg = "Datum ungueltig";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class stundensatzzyp extends basis_db
|
||||
{
|
||||
public $result = array();
|
||||
|
||||
public $stundensatztyp;
|
||||
public $bezeichnung;
|
||||
public $aktiv;
|
||||
|
||||
public function __construct($stundensatztyp=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if($stundensatztyp!=null)
|
||||
$this->load($stundensatztyp);
|
||||
}
|
||||
|
||||
public function load($stundensatzzyp)
|
||||
{
|
||||
$qry = "SELECT *
|
||||
FROM hr.tbl_stundensatztyp
|
||||
WHERE stundensatztyp=". $this->db_add_param($stundensatzzyp);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->stundensatztyp = $row->stundensatztyp;
|
||||
$this->bezeichnung = $row->bezeichnung;
|
||||
$this->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg ="Fehler bei der Abfrage aufgetreten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAll($onlyAktiv = true, $order = 'aktiv DESC, bezeichnung')
|
||||
{
|
||||
$qry = "SELECT *
|
||||
FROM hr.tbl_stundensatztyp";
|
||||
|
||||
if ($onlyAktiv)
|
||||
{
|
||||
$qry .= " WHERE aktiv";
|
||||
}
|
||||
|
||||
if($order !== '')
|
||||
$qry .= " ORDER BY ".$order;
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new stundensatzzyp();
|
||||
|
||||
$obj->stundensatztyp = $row->stundensatztyp;
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
$obj->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user