mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
Injection ADDON KU for Multiselect and Print Honorarvertrag
This commit is contained in:
@@ -4,6 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Vertragsverwaltung extends Auth_Controller
|
||||
{
|
||||
//TODO(Manu) Permissions
|
||||
public function __construct()
|
||||
{
|
||||
$permissions = [];
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2024 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/>.
|
||||
*/
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use CI3_Events as Events;
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the back-end
|
||||
* Provides data to the ajax get calls about the VV Config
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
*/
|
||||
class Config extends FHCAPI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// TODO(Manu): permissions
|
||||
parent::__construct([
|
||||
'printDocument' => ['admin:r', 'assistenz:r'],
|
||||
]);
|
||||
|
||||
|
||||
// Load Phrases
|
||||
$this->loadPhrases([
|
||||
'global',
|
||||
'person',
|
||||
]);
|
||||
}
|
||||
|
||||
public function printDocument() {
|
||||
|
||||
$params = [];
|
||||
|
||||
Events::trigger('multiActionPrintHonorarvertrag',
|
||||
// passing $menu per reference
|
||||
function & () use (&$menu) {
|
||||
return $menu;
|
||||
},
|
||||
$params
|
||||
);
|
||||
|
||||
$this->terminateWithSuccess($menu[0]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use \DateTime as DateTime;
|
||||
|
||||
class Vertraege extends FHCAPI_Controller
|
||||
@@ -24,11 +25,12 @@ class Vertraege extends FHCAPI_Controller
|
||||
'updateContractStatus' => self::PERM_LOGGED,
|
||||
'deleteLehrauftrag' => self::PERM_LOGGED,
|
||||
'deleteBetreuung' => self::PERM_LOGGED,
|
||||
//TODO(Manu) Berechtigung
|
||||
//TODO(Manu) Berechtigungen
|
||||
'getMitarbeiter' => self::PERM_LOGGED,
|
||||
'getHeader' => self::PERM_LOGGED,
|
||||
'getPersonAbteilung' => self::PERM_LOGGED,
|
||||
'getLeitungOrg' => self::PERM_LOGGED,
|
||||
'getMitarbeiter_uid' => self::PERM_LOGGED,
|
||||
]);
|
||||
|
||||
//Load Models and Libraries
|
||||
@@ -678,7 +680,6 @@ class Vertraege extends FHCAPI_Controller
|
||||
//TODO(Manu) rewrite better
|
||||
return $this->terminateWithSuccess("no benutzerdata", self::ERROR_TYPE_GENERAL);
|
||||
|
||||
// return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'personID']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
return $this->terminateWithSuccess(getData($result));
|
||||
}
|
||||
@@ -718,11 +719,29 @@ class Vertraege extends FHCAPI_Controller
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'personID']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
/* $result = current(getData($result));
|
||||
$header = $result->name;*/
|
||||
|
||||
//return $this->terminateWithSuccess($header);
|
||||
return $this->terminateWithSuccess(getData($result));
|
||||
}
|
||||
|
||||
|
||||
public function getMitarbeiter_uid($person_id)
|
||||
{
|
||||
$this->load->model('ressource/Mitarbeiter_model', 'Mitarbeitermodel');
|
||||
|
||||
$result = $this->Mitarbeitermodel->getMitarbeiter_uid($person_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
//TODO(Manu) check ErrorLogic
|
||||
return $this->terminateWithSuccess($result);
|
||||
//return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if (!hasData($result))
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id' => 'personID']), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
return $this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class CI3_Events
|
||||
});
|
||||
self::$eventsSorted[$event] = true;
|
||||
}
|
||||
|
||||
|
||||
foreach (self::$events[$event] as $conf) {
|
||||
$conf[1](...$args);
|
||||
}
|
||||
@@ -46,6 +46,19 @@ class CI3_Events
|
||||
* NOTE(chris): Autoload Events config
|
||||
*/
|
||||
require_once(APPPATH.'config/Events.php');
|
||||
|
||||
foreach (scandir(APPPATH.'config/extensions') as $dir)
|
||||
if ($dir[0] != '.' && file_exists(APPPATH.'config/extensions/'.$dir.'/Events.php'))
|
||||
require_once APPPATH.'config/extensions/'.$dir.'/Events.php';
|
||||
|
||||
$active_addons_array = explode(";", ACTIVE_ADDONS);
|
||||
foreach (scandir(FHCPATH.'addons') as $dir)
|
||||
if ($dir[0] != '.' && file_exists(FHCPATH.'addons/'.$dir.'/Events.php'))
|
||||
{
|
||||
// only includes the Events of the addon if the addon is one of the active addons in the cis config
|
||||
if(in_array($dir,$active_addons_array))
|
||||
{
|
||||
require_once FHCPATH . 'addons/' . $dir . '/Events.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,63 +105,12 @@ class Mitarbeiter_model extends DB_Model
|
||||
*/
|
||||
public function getPersonenWithContractDetails($person_id=null)
|
||||
{
|
||||
/* $qry = "SELECT DISTINCT ON(mitarbeiter_uid) mitarbeiter_uid, person_id, titelpost, titelpre,
|
||||
nachname, vorname, vornamen,
|
||||
TO_CHAR(gebdatum::timestamp, 'DD.MM.YYYY') AS format_gebdatum
|
||||
FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid))
|
||||
JOIN public.tbl_person USING(person_id))
|
||||
LEFT JOIN public.tbl_benutzerfunktion USING(uid)
|
||||
LEFT JOIN public.tbl_benutzerfunktion akt_funk ON tbl_mitarbeiter.mitarbeiter_uid = akt_funk.uid AND akt_funk.funktion_kurzbz = 'fachzuordnung'
|
||||
AND (akt_funk.datum_von IS NULL OR akt_funk.datum_von <= now()) AND (akt_funk.datum_bis IS NULL OR akt_funk.datum_bis >= now())
|
||||
WHERE true";
|
||||
|
||||
if ($fix === true)
|
||||
$qry .= " AND fixangestellt=true";
|
||||
elseif ($fix === false)
|
||||
$qry .= " AND fixangestellt=false";
|
||||
|
||||
if ($aktiv === true)
|
||||
$qry .= " AND tbl_benutzer.aktiv=true";
|
||||
elseif ($aktiv === false)
|
||||
$qry .= " AND tbl_benutzer.aktiv=false";
|
||||
|
||||
if ($verwendung === true)
|
||||
{
|
||||
$qry.=" AND EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)";
|
||||
}
|
||||
elseif ($verwendung === false)
|
||||
{
|
||||
$qry.=" AND NOT EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)";
|
||||
}
|
||||
|
||||
if ($personaccount === true)
|
||||
$qry .= " AND tbl_mitarbeiter.personalnummer >= 0";
|
||||
elseif ($personaccount === false)
|
||||
$qry .= " AND tbl_mitarbeiter.personalnummer < 0";
|
||||
|
||||
$params = array();
|
||||
if (!isEmptyArray($uids))
|
||||
{
|
||||
$qry .= " AND tbl_mitarbeiter.mitarbeiter_uid IN ?";
|
||||
$params[] = $uids;
|
||||
}
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
*/
|
||||
|
||||
//TODO(Manu) filter nach DV-Art? was, wenn mehrere? oder einfach wenn extern ODER fix?
|
||||
//TODO(Manu) email: plus dieses @domainzeugs: mohamed.aburaia@c3p0.ma0068.technikum-wien.at
|
||||
//Standardkostenstelle...
|
||||
//was wenn 2 echte DV? schmarrn
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
b.uid , p.person_id,
|
||||
p.vorname, p.nachname,
|
||||
TO_CHAR(gebdatum::timestamp, 'DD.MM.YYYY') AS format_gebdatum,
|
||||
COALESCE(b.alias, b.uid) AS email,
|
||||
--COALESCE(b.alias, b.uid) AS EMail,
|
||||
--u.bezeichnung AS Unternehmen,
|
||||
STRING_AGG(DISTINCT va.bezeichnung, ', ') AS Vertragsarten,
|
||||
STRING_AGG(DISTINCT u.bezeichnung, ', ') AS Unternehmen,
|
||||
STRING_AGG(d.dienstverhaeltnis_id::TEXT, ', ') AS ids,
|
||||
@@ -180,33 +129,11 @@ class Mitarbeiter_model extends DB_Model
|
||||
JOIN
|
||||
hr.tbl_vertragsart va ON d.vertragsart_kurzbz = va.vertragsart_kurzbz ";
|
||||
|
||||
/* if ($aktiv === true)
|
||||
$qry .= " WHERE b.aktiv = true";
|
||||
elseif ($aktiv === false)
|
||||
$qry .= " WHERE b.aktiv = false";
|
||||
|
||||
if($fix)
|
||||
{
|
||||
$filterVertragsart = "echterdv";
|
||||
|
||||
$filterVertragsart = addslashes($filterVertragsart); // Escaping von Sonderzeichen
|
||||
$qry .= " AND d.vertragsart_kurzbz = '" . $filterVertragsart . "'";
|
||||
}
|
||||
|
||||
if($extern)
|
||||
{
|
||||
$filterVertragsart2 = "externerlehrender";
|
||||
|
||||
$filterVertragsart2 = addslashes($filterVertragsart2); // Escaping von Sonderzeichen
|
||||
$qry .= " AND d.vertragsart_kurzbz = '" . $filterVertragsart2 . "'";
|
||||
}*/
|
||||
|
||||
if($person_id)
|
||||
{
|
||||
$qry .= " WHERE p.person_id = ?";
|
||||
}
|
||||
|
||||
|
||||
$qry.= "
|
||||
GROUP BY
|
||||
b.uid, p.person_id, p.vorname, p.nachname, b.alias
|
||||
@@ -229,37 +156,7 @@ class Mitarbeiter_model extends DB_Model
|
||||
*/
|
||||
function getPersonAbteilung($person_id)
|
||||
{
|
||||
/*
|
||||
$qry = "
|
||||
SELECT tbl_benutzer.uid
|
||||
FROM tbl_mitarbeiter
|
||||
JOIN tbl_benutzer ON tbl_mitarbeiter.mitarbeiter_uid::text = tbl_benutzer.uid::text
|
||||
JOIN tbl_person USING (person_id)
|
||||
WHERE tbl_person.person_id=?
|
||||
";
|
||||
|
||||
|
||||
$result = $this->execQuery($qry, array($person_id));
|
||||
|
||||
$uid = current(getData($result));
|
||||
$uid = $uid->uid;
|
||||
|
||||
|
||||
$qry2 ="
|
||||
SELECT
|
||||
bf.benutzerfunktion_id,bf.fachbereich_kurzbz,bf.uid,bf.funktion_kurzbz,bf.updateamum,bf.updatevon,bf.insertamum,bf.insertvon,bf.ext_id,bf.semester,bf.oe_kurzbz,bf.datum_von,bf.datum_bis,bf.bezeichnung,bf.wochenstunden,
|
||||
oe.oe_kurzbz,oe.oe_parent_kurzbz,oe.bezeichnung,oe.organisationseinheittyp_kurzbz,oe.aktiv,oe.mailverteiler,oe.freigabegrenze,oe.kurzzeichen,oe.lehre,oe.standort,oe.warn_semesterstunden_frei,oe.warn_semesterstunden_fix,oe.standort_id
|
||||
FROM tbl_benutzerfunktion bf JOIN public.tbl_organisationseinheit oe USING(oe_kurzbz)
|
||||
WHERE uid = ? AND funktion_kurzbz='oezuordnung'
|
||||
AND datum_von<=now() AND (datum_bis is null OR datum_bis>=now())
|
||||
";
|
||||
|
||||
$result2 = $this->execQuery($qry2, array($uid));
|
||||
|
||||
|
||||
return $result2;*/
|
||||
|
||||
// First Query
|
||||
//TODO(Manu) use function getMitarbeiter_uid
|
||||
$qry = "
|
||||
SELECT tbl_benutzer.uid
|
||||
FROM tbl_mitarbeiter
|
||||
@@ -269,14 +166,12 @@ class Mitarbeiter_model extends DB_Model
|
||||
";
|
||||
$result = $this->execQuery($qry, [$person_id]);
|
||||
|
||||
// Validate and extract UID
|
||||
$data = getData($result);
|
||||
if (empty($data)) {
|
||||
return null; // No UID found
|
||||
}
|
||||
|
||||
$uid = isset($data[0]->uid) ? $data[0]->uid : null;
|
||||
// $uid = isset($data[0]['uid']) ? $data[0]['uid'] : null;
|
||||
|
||||
if (!$uid) {
|
||||
return null; // UID extraction failed
|
||||
@@ -475,4 +370,30 @@ class Mitarbeiter_model extends DB_Model
|
||||
|
||||
return $this->execQuery($qry);
|
||||
}
|
||||
|
||||
public function getMitarbeiter_uid($person_id){
|
||||
//TODO(Manu) refactor function
|
||||
//and use in function getPersonAbteilung
|
||||
//check function in Vertraege.php
|
||||
$qry = "
|
||||
SELECT tbl_benutzer.uid
|
||||
FROM tbl_mitarbeiter
|
||||
JOIN tbl_benutzer ON CAST(tbl_mitarbeiter.mitarbeiter_uid AS TEXT) = CAST(tbl_benutzer.uid AS TEXT)
|
||||
JOIN tbl_person USING (person_id)
|
||||
WHERE tbl_person.person_id = ?
|
||||
";
|
||||
$result = $this->execQuery($qry, [$person_id]);
|
||||
|
||||
$data = getData($result);
|
||||
if (empty($data)) {
|
||||
return null; // No UID found
|
||||
}
|
||||
//else
|
||||
// $data = current($data);
|
||||
|
||||
// $uid = $data->uid;
|
||||
|
||||
$uid = isset($data[0]->uid) ? $data[0]->uid : null;
|
||||
return $uid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,20 @@ $includesArray = array(
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$configArray = [
|
||||
'generateAlias' => !defined('GENERATE_ALIAS_STUDENT') ? 'notDefined' : GENERATE_ALIAS_STUDENT,
|
||||
'domain' => !defined('DOMAIN') ? 'notDefined' : DOMAIN,
|
||||
'chooseLayout' => !defined('CHOOSE_LAYOUT') ? 'notDefined' : CHOOSE_LAYOUT,
|
||||
];
|
||||
?>
|
||||
|
||||
<div id="main">
|
||||
<router-view
|
||||
stv-root="<?= site_url('Vertragsverwaltung'); ?>"
|
||||
cis-root="<?= CIS_ROOT; ?>"
|
||||
:permissions="<?= htmlspecialchars(json_encode($permissions)); ?>"
|
||||
:config="<?= htmlspecialchars(json_encode($configArray)); ?>"
|
||||
>
|
||||
</router-view>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user