diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php index 840bb290c..32fdd97c9 100644 --- a/application/models/crm/Konto_model.php +++ b/application/models/crm/Konto_model.php @@ -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); + } } diff --git a/application/models/person/Fotostatusperson_model.php b/application/models/person/Fotostatusperson_model.php new file mode 100644 index 000000000..7f701063d --- /dev/null +++ b/application/models/person/Fotostatusperson_model.php @@ -0,0 +1,22 @@ +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)); + } + +} \ No newline at end of file diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 559700390..6bf9fc2c0 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -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)); diff --git a/application/models/ressource/Betriebsmittelperson_model.php b/application/models/ressource/Betriebsmittelperson_model.php index 1a97d9e38..7d9689753 100644 --- a/application/models/ressource/Betriebsmittelperson_model.php +++ b/application/models/ressource/Betriebsmittelperson_model.php @@ -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); + } } diff --git a/composer.json b/composer.json index 14e2ab141..6a23a8526 100644 --- a/composer.json +++ b/composer.json @@ -246,6 +246,8 @@ "afarkas/html5shiv": "3.7.*", + "chillerlan/php-qrcode": "2.0.*", + "chriskacerguis/codeigniter-restserver": "3.0.3", "christianbach/tablesorter": "1.0.*", "codeigniter/framework": "3.*", diff --git a/composer.lock b/composer.lock index ea8f24af0..ea222f2ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,13 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], +<<<<<<< HEAD "hash": "7e7441d3ba7b9b2be1f647b9bfc2c941", "content-hash": "d59d1c1f4957fc2e3dc019cbb99b5aa2", +======= + "hash": "40072f80c7fd5e407eaba6591fb2d6ec", + "content-hash": "e55258d0e91f60adde23afe67816258a", +>>>>>>> feature-15970/kartenterminal "packages": [ { "name": "BlackrockDigital/startbootstrap-sb-admin-2", @@ -71,6 +76,105 @@ }, "type": "library" }, + { + "name": "chillerlan/php-qrcode", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "bf0382aaf2f79fa41c2dcb0f216675f74d633fe7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/bf0382aaf2f79fa41c2dcb0f216675f74d633fe7", + "reference": "bf0382aaf2f79fa41c2dcb0f216675f74d633fe7", + "shasum": "" + }, + "require": { + "chillerlan/php-traits": "^1.1", + "php": ">=7.0.3" + }, + "require-dev": { + "chillerlan/php-authenticator": "^2.0", + "phpunit/phpunit": "^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A QR code generator. PHP 7+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "qr code" + ], + "time": "2020-04-12 07:38:35" + }, + { + "name": "chillerlan/php-traits", + "version": "1.1.13", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-traits.git", + "reference": "264759946b6aaeb427346b749fc9639b790b8e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-traits/zipball/264759946b6aaeb427346b749fc9639b790b8e7f", + "reference": "264759946b6aaeb427346b749fc9639b790b8e7f", + "shasum": "" + }, + "require": { + "php": ">=7.0.3" + }, + "require-dev": { + "phpunit/phpunit": "^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Traits\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "Some useful traits for PHP 7+", + "homepage": "https://github.com/chillerlan/php-traits", + "keywords": [ + "PHP7", + "container", + "dotenv", + "helper", + "trait" + ], + "abandoned": true, + "time": "2018-06-22 00:30:47" + }, { "name": "chriskacerguis/codeigniter-restserver", "version": "3.0.3",