Merge branch 'master' into feature-40953/LV-Template_Uebersichtsseite

This commit is contained in:
Harald Bamberger
2024-10-08 09:28:56 +02:00
21 changed files with 1043 additions and 335 deletions
@@ -10,5 +10,6 @@ class Lvgesamtnote_model extends DB_Model
parent::__construct();
$this->dbTable = 'campus.tbl_lvgesamtnote';
$this->pk = array('student_uid', 'studiensemester_kurzbz', 'lehrveranstaltung_id');
$this->hasSequence = false;
}
}
@@ -25,7 +25,7 @@ class Paabgabe_model extends DB_Model
WHERE projektarbeit_id = ?
AND paabgabetyp_kurzbz = 'end'
AND paabg.abgabedatum IS NOT NULL
ORDER BY paabg.abgabedatum, paabg.datum DESC
ORDER BY paabg.abgabedatum DESC, paabg.datum DESC
LIMIT 1";
return $this->execQuery($qry, array($projektarbeit_id));
@@ -32,11 +32,20 @@ class Geschaeftsjahr_model extends DB_Model
* Gets next Geschaeftsjahr, as determined by its start date
* @return array|null
*/
public function getNextGeschaeftsjahr()
public function getNextGeschaeftsjahr($offsetDays=null)
{
$query = 'SELECT *
FROM public.tbl_geschaeftsjahr
WHERE start > now()
FROM public.tbl_geschaeftsjahr WHERE ';
if(!is_null($offsetDays))
{
$query .= "start > now() - '".$offsetDays." days'::interval";
}
else
{
$query .= 'start > now()';
}
$query .= '
ORDER BY start
LIMIT 1';
+30 -7
View File
@@ -22,13 +22,23 @@ class Issue_model extends DB_Model
*/
public function getOpenIssues($fehlercodes, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
{
$params = array($fehlercodes);
$params = array();
// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
$qry = 'SELECT issue_id, fehlercode, inhalt, fehlercode_extern, inhalt_extern, person_id, oe_kurzbz,
behebung_parameter, datum, verarbeitetvon, verarbeitetamum
FROM system.tbl_issue
WHERE fehlercode IN ?
AND verarbeitetamum IS NULL';
$qry = 'SELECT
iss.issue_id, iss.fehlercode, fe.fehler_kurzbz, iss.inhalt, iss.fehlercode_extern,
iss.inhalt_extern, iss.person_id, iss.oe_kurzbz, iss.behebung_parameter,
iss.datum, iss.verarbeitetvon, iss.verarbeitetamum
FROM
system.tbl_issue iss
JOIN system.tbl_fehler fe USING (fehlercode)
WHERE
verarbeitetamum IS NULL';
if (!isEmptyArray($fehlercodes))
{
$qry .= ' AND fehlercode IN ?';
$params[] = $fehlercodes;
}
if (!isEmptyString($fehlercode_extern))
{
@@ -59,7 +69,7 @@ class Issue_model extends DB_Model
* @param string $fehlercode_extern if provided, only issues with this external fehlercode are counted (for identifying issues from external systems).
* @return Object success with number of issues or error
*/
public function getOpenIssueCount($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null)
public function getOpenIssueCount($fehlercode, $person_id = null, $oe_kurzbz = null, $fehlercode_extern = null, $behebung_parameter = null)
{
$params = array($fehlercode);
// issue exists for a fehlercode (or fehlercode_extern), person_id, oe_kurzbz, if not verarbeitet yet
@@ -85,6 +95,19 @@ class Issue_model extends DB_Model
$params[] = $oe_kurzbz;
}
if (isset($behebung_parameter) && !isEmptyArray($behebung_parameter))
{
// convert array to JSON string for postgres
$behebung_parameter_string = json_encode($behebung_parameter);
if ($behebung_parameter_string)
{
// check if jsonb value is equal to the passed parameters array (if value contains array and array contains value)
$qry .= ' AND behebung_parameter @> ? AND behebung_parameter <@ ?';
$params = array_merge($params, array($behebung_parameter_string, $behebung_parameter_string));
}
}
return $this->execQuery($qry, $params);
}
}
@@ -327,7 +327,7 @@ class Recipient_model extends DB_Model
pr.nachname,
ms.person_id,
mrou.token
ORDER BY sent DESC';
ORDER BY sent DESC LIMIT 1500';
return $this->execQuery($sql, array($person_id, $functions, $person_id));
}
@@ -0,0 +1,28 @@
<?php
class GehaltsTyp_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'hr.tbl_gehaltstyp';
$this->pk = 'gehaltstyp_kurzbz';
}
/**
* Gets Gehaltstyp for a Gehaltsbestandteil.
* @param int gehaltsbestandteil_id
* @return object the typ
*/
public function getGehaltstypByGehaltsbestandteil($gehaltsbestandteil_id)
{
$gehaltsTyp = null;
$this->addJoin('hr.tbl_gehaltsbestandteil', 'gehaltstyp_kurzbz');
$result = $this->loadWhere(['gehaltsbestandteil_id' => $gehaltsbestandteil_id]);
if (hasData($result)) $gehaltsTyp = getData($result)[0];
return $gehaltsTyp;
}
}