Merge branch 'feature-15970/kartenterminal'

This commit is contained in:
Andreas Österreicher
2022-05-03 10:18:40 +02:00
6 changed files with 195 additions and 1 deletions
+49
View File
@@ -73,4 +73,53 @@ class Konto_model extends DB_Model
return error('Failed to load Payment');
}
}
public function getLastStudienbeitrag($uid, $buchungstypen)
{
$query = 'SELECT konto.studiensemester_kurzbz
FROM public.tbl_konto konto,
public.tbl_benutzer,
public.tbl_student
WHERE tbl_benutzer.uid = \'' . $uid . '\'
AND tbl_benutzer.uid = tbl_student.student_uid
AND tbl_benutzer.person_id = konto.person_id
AND konto.studiengang_kz = tbl_student.studiengang_kz
AND konto.buchungstyp_kurzbz IN (\'' . $buchungstypen . '\')
AND 0 = (
SELECT sum(betrag)
FROM public.tbl_konto skonto
WHERE skonto.buchungsnr = konto.buchungsnr_verweis
OR skonto.buchungsnr_verweis = konto.buchungsnr_verweis
)
ORDER BY buchungsnr DESC LIMIT 1;
';
return $this->execQuery($query);
}
public function checkStudienbeitrag($uid, $stsem, $buchungstypen)
{
$query = 'SELECT tbl_konto.buchungsnr,
tbl_konto.buchungsdatum
FROM public.tbl_konto,
public.tbl_benutzer,
public.tbl_student
WHERE
tbl_konto.studiensemester_kurzbz = \'' . $stsem . '\'
AND tbl_benutzer.uid = \'' . $uid . '\'
AND tbl_benutzer.uid = tbl_student.student_uid
AND tbl_benutzer.person_id = tbl_konto.person_id
AND tbl_konto.studiengang_kz=tbl_student.studiengang_kz
AND tbl_konto.buchungstyp_kurzbz IN (\'' . $buchungstypen . '\')
AND 0 >= (
SELECT sum(betrag)
FROM public.tbl_konto skonto
WHERE skonto.buchungsnr = tbl_konto.buchungsnr_verweis
OR skonto.buchungsnr_verweis = tbl_konto.buchungsnr_verweis
)
ORDER BY buchungsnr DESC LIMIT 1
';
return $this->execQuery($query);
}
}
@@ -0,0 +1,22 @@
<?php
class Fotostatusperson_model extends DB_Model
{
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_person_fotostatus';
$this->pk = 'person_fotostatus_id';
}
public function getLastFotoStatus($person_id)
{
$this->addOrder('datum', 'DESC');
$this->addOrder('person_fotostatus_id', 'DESC');
$this->addLimit(1);
return $this->loadWhere(array('person_id' => $person_id));
}
}
+1 -1
View File
@@ -193,7 +193,7 @@ class Person_model extends DB_Model
*/
public function getByUid($uid)
{
$this->addSelect('vorname, nachname, gebdatum, person_id, bpk, matr_nr');
$this->addSelect('vorname, nachname, gebdatum, person_id, bpk, matr_nr, foto');
$this->addJoin('tbl_benutzer', 'person_id');
return $this->loadWhere(array('uid' => $uid));
@@ -55,4 +55,21 @@ class Betriebsmittelperson_model extends DB_Model
return $this->loadWhere($condition);
}
public function getBetriebsmittelZuordnung($cardIdentifier, $typ = 'Zutrittskarte', $ausgegeben = true)
{
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
$where = 'wawi.tbl_betriebsmittel.nummer2 = \'' . $cardIdentifier . '\'
AND wawi.tbl_betriebsmittel.betriebsmitteltyp = \''. $typ .'\'
AND (retouram >= now() OR retouram IS NULL)
';
if ($ausgegeben)
$where .= 'AND ausgegebenam <= now()';
else
$where .= 'AND (ausgegebenam <= now() OR ausgegebenam IS NULL)';
return $this->loadWhere($where);
}
}