mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ae6cb8086 | ||
|
|
1675d97195 | ||
|
|
9e1b782c54 | ||
|
|
2acbb6ecd0 | ||
|
|
1acb89f8b7 | ||
|
|
2114352d82 | ||
|
|
df6b71b9c4 | ||
|
|
319c9a166c |
@@ -9,6 +9,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
|
||||
protected $zeitaufzeichnung;
|
||||
protected $azgrelevant;
|
||||
protected $homeoffice;
|
||||
protected $zeitmodell_id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -24,6 +25,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
|
||||
isset($data->zeitaufzeichnung) && $this->setZeitaufzeichnung($data->zeitaufzeichnung);
|
||||
isset($data->azgrelevant) && $this->setAzgrelevant($data->azgrelevant);
|
||||
isset($data->homeoffice) && $this->setHomeoffice($data->homeoffice);
|
||||
isset($data->zeitmodell_id) && $this->setZeitmodell_id($data->zeitmodell_id);
|
||||
$this->fromdb = false;
|
||||
}
|
||||
|
||||
@@ -83,6 +85,25 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of zeitmodell_id
|
||||
*/
|
||||
public function getZeitmodell_id()
|
||||
{
|
||||
return $this->zeitmodell_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of zeitmodell_id
|
||||
*/
|
||||
public function setZeitmodell_id($zeitmodell_id): self
|
||||
{
|
||||
$this->markDirty('zeitmodell_id', $this->zeitmodell_id, $zeitmodell_id);
|
||||
$this->zeitmodell_id = $zeitmodell_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function toStdClass(): \stdClass
|
||||
{
|
||||
@@ -90,7 +111,8 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
|
||||
'vertragsbestandteil_id' => $this->getVertragsbestandteil_id(),
|
||||
'zeitaufzeichnung' => $this->getZeitaufzeichnung(),
|
||||
'azgrelevant' => $this->getAzgrelevant(),
|
||||
'homeoffice' => $this->getHomeoffice()
|
||||
'homeoffice' => $this->getHomeoffice(),
|
||||
'zeitmodell_id' => $this->getZeitmodell_id()
|
||||
);
|
||||
|
||||
$tmp = array_filter($tmp, function($k) {
|
||||
@@ -106,6 +128,7 @@ class VertragsbestandteilZeitaufzeichnung extends Vertragsbestandteil
|
||||
zeitaufzeichnung: {$this->getZeitaufzeichnung()}
|
||||
azgrelevant: {$this->getAzgrelevant()}
|
||||
homeoffice: {$this->getHomeoffice()}
|
||||
zeitmodell_id: {$this->getZeitmodell_id()}
|
||||
|
||||
EOTXT;
|
||||
return parent::__toString() . $txt;
|
||||
|
||||
@@ -37,7 +37,7 @@ class Vertragsbestandteil_model extends DB_Model
|
||||
kf.arbeitgeber_frist, kf.arbeitnehmer_frist,
|
||||
s.wochenstunden, s.teilzeittyp_kurzbz,
|
||||
u.tage,
|
||||
z.zeitaufzeichnung, z.azgrelevant, z.homeoffice,
|
||||
z.zeitaufzeichnung, z.azgrelevant, z.homeoffice, z.zeitmodell_id,
|
||||
lg.stellenbezeichnung, lg.vordienstzeit, lg.fachrichtung_kurzbz, lg.modellstelle_kurzbz, lg.kommentar_person, lg.kommentar_modellstelle
|
||||
FROM
|
||||
hr.tbl_vertragsbestandteil v
|
||||
|
||||
@@ -28,6 +28,7 @@ class mitarbeiter extends benutzer
|
||||
{
|
||||
public $new;
|
||||
public $result=array();
|
||||
public $maData=array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $ausbildungcode; //integer
|
||||
@@ -1937,6 +1938,63 @@ class mitarbeiter extends benutzer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert alle zeitaufzeichnungspflichtigen Mitarbeiter*innen
|
||||
*
|
||||
* @param $aktiv
|
||||
* @return boolean
|
||||
*/
|
||||
public function getZeitaufzeichnungspflichtig($aktiv=null)
|
||||
{
|
||||
$aktivClause = '';
|
||||
|
||||
if (is_bool($aktiv)) $aktivClause = 'AND b.aktiv = '.$this->db_add_param($aktiv, FHC_BOOLEAN);
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
ma.mitarbeiter_uid, p.nachname, p.vorname, b.alias
|
||||
FROM
|
||||
public.tbl_mitarbeiter ma
|
||||
JOIN public.tbl_benutzer b ON (mitarbeiter_uid=uid)
|
||||
JOIN public.tbl_person p USING(person_id)
|
||||
WHERE
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM
|
||||
hr.tbl_vertragsbestandteil_zeitaufzeichnung vbtza
|
||||
JOIN hr.tbl_vertragsbestandteil vbt USING (vertragsbestandteil_id)
|
||||
JOIN hr.tbl_dienstverhaeltnis dv USING (dienstverhaeltnis_id)
|
||||
WHERE
|
||||
dv.mitarbeiter_uid = b.uid
|
||||
AND zeitaufzeichnung
|
||||
)
|
||||
{$aktivClause}
|
||||
ORDER BY b.uid
|
||||
";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->maData[] = array();
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$ma_obj = new mitarbeiter();
|
||||
|
||||
$ma_obj->nachname = $row->nachname;
|
||||
$ma_obj->vorname = $row->vorname;
|
||||
$ma_obj->mitarbeiter_uid = $row->mitarbeiter_uid;
|
||||
$ma_obj->alias = $row->alias;
|
||||
|
||||
$this->maData[] = $ma_obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generiert nächste freie Personalnummer anhand der sequence tbl_mitarbeiter_personalnummer_seq
|
||||
* @return string $personalnummer
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Cristina Hainberger <[email protected]>,
|
||||
*/
|
||||
/**
|
||||
* Klasse Vertragsbestandteil
|
||||
* @create 29.03.2023
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class vertragsbestandteil_zeitaufzeichnung extends basis_db
|
||||
{
|
||||
public $new; // boolean
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $vertragsbestandteil_id; // integer
|
||||
public $zeitaufzeichnung; // bool
|
||||
public $azgrelevant; // bool
|
||||
public $homeoffice; // bool
|
||||
public $zeitmodell_id; // integer
|
||||
public $von; // date
|
||||
public $bis; // date
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $vertragsbestandteil_id ID des Vertragsbestandteils, der geladen werden soll (Default=null)
|
||||
*/
|
||||
public function __construct($vertragsbestandteil_id = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if($vertragsbestandteil_id != null)
|
||||
$this->load($vertragsbestandteil_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den Vertragsbestandteil in die Datenbank
|
||||
* Wenn $new auf true gesetzt ist wird ein neuer Datensatz
|
||||
* angelegt, ansonsten der Datensatz upgedated
|
||||
*
|
||||
* @return true wenn erfolgreich, false im Fehlerfall
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if($this->new)
|
||||
{
|
||||
$qry = "INSERT INTO hr.tbl_vertragsbestandteil_zeitaufzeichnung (zeitaufzeichnung, azgrelevant, homeoffice, zeitmodell_id)
|
||||
VALUES(".
|
||||
$this->db_add_param($this->zeitaufzeichnung, FHC_BOOLEAN).",".
|
||||
$this->db_add_param($this->azgrelevant, FHC_BOOLEAN).",".
|
||||
$this->db_add_param($this->homeoffice, FHC_BOOLEAN).",".
|
||||
$this->db_add_param($this->zeitmodell_id).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE hr.tbl_vertragsbestandteil_zeitaufzeichnung SET'.
|
||||
' zeitaufzeichnung='.$this->db_add_param($this->zeitaufzeichnung, FHC_BOOLEAN).','.
|
||||
' azgrelevant='.$this->db_add_param($this->azgrelevant, FHC_BOOLEAN).','.
|
||||
' homeoffice='.$this->db_add_param($this->homeoffice, FHC_BOOLEAN).','.
|
||||
' zeitmodell_id='.$this->db_add_param($this->zeitmodell_id, FHC_INTEGER).
|
||||
' WHERE vertragsbestandteil_id='.$this->db_add_param($this->vertragsbestandteil_id, FHC_INTEGER);
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Studiensemesters';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt alle Vertragsbestandteile ab einem bestimmten Startdatum.
|
||||
*
|
||||
* @param $mitarbeiter_uid
|
||||
* @param $startDate
|
||||
* @param $order
|
||||
* @param null $limit
|
||||
* @return bool
|
||||
*/
|
||||
public function getFromStartdate($mitarbeiter_uid, $startDate, $order = 'ASC', $limit = null)
|
||||
{
|
||||
if ($order !== 'ASC' && $order !== 'DESC')
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = 'SELECT
|
||||
vbt.vertragsbestandteil_id, vbt.dienstverhaeltnis_id, vbt.vertragsbestandteiltyp_kurzbz,
|
||||
vbt.von, vbt.bis, vbt.insertamum, vbt.insertvon, vbt.updateamum, vbt.updatevon,
|
||||
vbtza.zeitaufzeichnung, vbtza.azgrelevant, vbtza.homeoffice, vbtza.zeitmodell_id
|
||||
FROM hr.tbl_vertragsbestandteil_zeitaufzeichnung vbtza
|
||||
JOIN hr.tbl_vertragsbestandteil vbt USING (vertragsbestandteil_id)
|
||||
JOIN hr.tbl_dienstverhaeltnis dv USING (dienstverhaeltnis_id)
|
||||
-- Dienstverhältnis(se) des Mitarbeiters
|
||||
WHERE dv.mitarbeiter_uid = '. $this->db_add_param($mitarbeiter_uid). '
|
||||
-- Zeitaufzeichnungspflichtig
|
||||
AND zeitaufzeichnung = TRUE
|
||||
-- Vertragsbestandteile sind aktuell
|
||||
AND (vbt.bis IS NULL OR vbt.bis >= '. $this->db_add_param($startDate).')
|
||||
ORDER BY vbt.von ' . $order;
|
||||
|
||||
|
||||
if (!is_null($limit))
|
||||
{
|
||||
$qry .= ' LIMIT ' . $this->db_add_param($limit, FHC_INTEGER);
|
||||
}
|
||||
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
if ($this->db_num_rows($result) > 0)
|
||||
{
|
||||
$this->result = array();
|
||||
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
$vtb = new vertragsbestandteil_zeitaufzeichnung();
|
||||
$vtb->vertragsbestandteil_id = $row->vertragsbestandteil_id;
|
||||
$vtb->zeitaufzeichnung = $vtb->db_parse_bool($row->zeitaufzeichnung);
|
||||
$vtb->azgrelevant = $vtb->db_parse_bool($row->azgrelevant);
|
||||
$vtb->homeoffice = $vtb->db_parse_bool($row->homeoffice);
|
||||
$vtb->zeitmodell_id = $row->zeitmodell_id;
|
||||
$vtb->von = $row->von;
|
||||
$vtb->bis = $row->bis;
|
||||
$this->result[] = $vtb;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler bei der Abfrage aufgetreten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -98,6 +98,7 @@ require_once('dbupdate_3.4/75888_reihungstest_mehrfachdurchfuehrung.php');
|
||||
require_once('dbupdate_3.4/76150_perm_other_lv_plan.php');
|
||||
require_once('dbupdate_3.4/68957_dashboard_bookmark_neue_Spalte_sort.php');
|
||||
require_once('dbupdate_3.4/68530_Dashboard_Cleanup.php');
|
||||
require_once('dbupdate_3.4/76677_zeitaufzeichnung_zeitmodell.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
@@ -250,6 +251,7 @@ $tabellen=array(
|
||||
"hr.tbl_lohnguide_modellstelle" => array("modellstelle_kurzbz", "bezeichnung", "grade", "modellfunktion_kurzbz", "aktiv", "sort", "insertvon", "insertamum", "updatevon", "updateamum"),
|
||||
"hr.tbl_lohnguide_fachrichtung" => array("fachrichtung_kurzbz", "bezeichnung", "aktiv", "insertvon", "insertamum", "updatevon", "updateamum"),
|
||||
"hr.tbl_vertragsbestandteil_lohnguide" => array("vertragsbestandteil_id", "stellenbezeichnung", "vordienstzeit", "fachrichtung_kurzbz", "modellstelle_kurzbz", "kommentar_person", "kommentar_modellstelle"),
|
||||
"hr.tbl_zeitmodell" => array('zeitmodell_id', 'zeitmodell_kurzbz','beschreibung','aktiv', 'stundenanzahl','ext_id','sort'),
|
||||
"lehre.tbl_abschlussbeurteilung" => array("abschlussbeurteilung_kurzbz","bezeichnung","bezeichnung_english","sort"),
|
||||
"lehre.tbl_abschlusspruefung" => array("abschlusspruefung_id","student_uid","vorsitz","pruefer1","pruefer2","pruefer3","abschlussbeurteilung_kurzbz","akadgrad_id","pruefungstyp_kurzbz","datum","uhrzeit","sponsion","anmerkung","updateamum","updatevon","insertamum","insertvon","ext_id","note","protokoll","endezeit","pruefungsantritt_kurzbz","freigabedatum"),
|
||||
"lehre.tbl_abschlusspruefung_antritt" => array("pruefungsantritt_kurzbz","bezeichnung","bezeichnung_english","sort"),
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
//Create Sequence hr.tbl_zeitmodell and grant Rights
|
||||
if ($result = @$db->db_query("SELECT * FROM pg_class WHERE relname = 'tbl_zeitmodell_zeitmodell_id_seq'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
if ($count = @$db->db_query("SELECT * FROM hr.tbl_zeitmodell"))
|
||||
{
|
||||
$count = $db->db_num_rows($count) + 1;
|
||||
$qry = 'CREATE SEQUENCE hr.tbl_zeitmodell_zeitmodell_id_seq START ';
|
||||
$qry .= $count;
|
||||
if(!$db->db_query($qry))
|
||||
{
|
||||
echo '<strong> hr.tbl_zeitmodell '.$db->db_last_error().'</strong><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<br>hr.tbl_zeitmodell: Sequence hr.tbl_zeitmodell_zeitmodell_id_seq mit Startwert ' . $count . ' erstellt';
|
||||
$qry2 = "GRANT SELECT, UPDATE ON hr.tbl_zeitmodell_zeitmodell_id_seq TO vilesci;
|
||||
GRANT SELECT, UPDATE ON hr.tbl_zeitmodell_zeitmodell_id_seq TO web;";
|
||||
if(!$db->db_query($qry2))
|
||||
{
|
||||
echo '<strong>hr.tbl_zeitmodell_zeitmodell_id_seq Berechtigungen: '.$db->db_last_error().'</strong><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<br>hr.tbl_zeitmodell: Rechte auf hr.tbl_zeitmodell_zeitmodell_id_seq fuer web user und vilesci gesetzt ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Create Table
|
||||
if ($result = $db->db_query("SELECT * FROM information_schema.tables WHERE table_name='tbl_zeitmodell' AND table_schema='hr'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "
|
||||
CREATE TABLE IF NOT EXISTS hr.tbl_zeitmodell (
|
||||
zeitmodell_id integer,
|
||||
zeitmodell_kurzbz varchar(32) UNIQUE,
|
||||
beschreibung text,
|
||||
aktiv boolean NOT NULL DEFAULT FALSE,
|
||||
stundenanzahl numeric(8,2),
|
||||
ext_id text,
|
||||
sort smallint,
|
||||
insertamum TIMESTAMP DEFAULT NOW(),
|
||||
insertvon VARCHAR(32),
|
||||
updateamum TIMESTAMP,
|
||||
updatevon VARCHAR(32),
|
||||
CONSTRAINT tbl_zeitmodell_pkey PRIMARY KEY (zeitmodell_id)
|
||||
);
|
||||
|
||||
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hr.tbl_zeitmodell TO vilesci;";
|
||||
|
||||
if (! $db->db_query($qry))
|
||||
echo '<strong>Zeitmodell: ' . $db->db_last_error() . '</strong><br>';
|
||||
else
|
||||
echo 'hr.tbl_zeitmodell wurde neu erstellt<br>';
|
||||
}
|
||||
}
|
||||
|
||||
//hr.tbl_zeitmodell DEFAULT einstellen
|
||||
if ($result = @$db->db_query("SELECT column_default FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_zeitmodell'AND column_name = 'zeitmodell_id' and column_default is null"))
|
||||
{
|
||||
if($db->db_num_rows($result)==1)
|
||||
{
|
||||
$qry = "ALTER TABLE hr.tbl_zeitmodell ALTER COLUMN zeitmodell_id SET DEFAULT nextval('hr.tbl_zeitmodell_zeitmodell_id_seq'::regclass);";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong> hr.tbl_zeitmodell '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo '<br> hr.tbl_zeitmodell: Defaultwert bei Spalte hr.tbl_zeitmodell_id gesetzt';
|
||||
}
|
||||
}
|
||||
|
||||
//foreign key zu Vertragsbestandteil
|
||||
if ($result = @$db->db_query("SELECT * FROM information_schema.columns WHERE column_name='zeitmodell_id' AND table_name='tbl_vertragsbestandteil_zeitaufzeichnung' AND table_schema='hr'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "
|
||||
ALTER TABLE
|
||||
hr.tbl_vertragsbestandteil_zeitaufzeichnung
|
||||
ADD COLUMN
|
||||
zeitmodell_id integer;
|
||||
ALTER TABLE hr.tbl_vertragsbestandteil_zeitaufzeichnung ADD CONSTRAINT vertragsbestandteil_zeitaufzeichnung_zeitmodell_fk FOREIGN KEY (zeitmodell_id) REFERENCES hr.tbl_zeitmodell (zeitmodell_id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
";
|
||||
if (! $db->db_query($qry))
|
||||
echo '<strong>Zeitmodell: ' . $db->db_last_error() . '</strong><br>';
|
||||
else
|
||||
echo '<br>Spalte zeitmodell_id wurde in hr.tbl_vertragsbestandteil_zeitaufzeichnung neu erstellt<br>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user