From cf1b34769c1044a4c6a9bc216b5220a9c0c04704 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Fri, 12 Nov 2021 12:16:35 +0100 Subject: [PATCH 1/5] api & anpassungen fuer das kartenterminal --- application/models/crm/Konto_model.php | 23 +++++++++++++++++++ .../models/person/Fotostatusperson_model.php | 22 ++++++++++++++++++ application/models/person/Person_model.php | 2 +- .../ressource/Betriebsmittelperson_model.php | 17 ++++++++++++++ composer.json | 4 +++- 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 application/models/person/Fotostatusperson_model.php diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php index a3b5cdbb6..aba861895 100644 --- a/application/models/crm/Konto_model.php +++ b/application/models/crm/Konto_model.php @@ -68,4 +68,27 @@ 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); + } } 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 ec5522674..a43b63287 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 145927be0..042042b0e 100644 --- a/composer.json +++ b/composer.json @@ -309,7 +309,9 @@ "scottjehl/Respond": "1.4.2", "tapmodo/Jcrop": "2.0.4", - "tomazdragar/SimpleCropper": "1.0" + "tomazdragar/SimpleCropper": "1.0", + + "chillerlan/php-qrcode": "2.0.*" }, "config": { "bin-dir": "vendor/bin" From c8ebcdf5a12702c6949c19ea5040093bd3feb02e Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 23 Nov 2021 09:53:24 +0100 Subject: [PATCH 2/5] Updated composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 042042b0e..81c487814 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.*", "christianbach/tablesorter": "1.0.*", "codeigniter/framework": "3.*", @@ -309,9 +311,7 @@ "scottjehl/Respond": "1.4.2", "tapmodo/Jcrop": "2.0.4", - "tomazdragar/SimpleCropper": "1.0", - - "chillerlan/php-qrcode": "2.0.*" + "tomazdragar/SimpleCropper": "1.0" }, "config": { "bin-dir": "vendor/bin" From f1bf3bb4be2685c196f2da90246102338f7f0441 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 23 Nov 2021 09:54:56 +0100 Subject: [PATCH 3/5] Updated composer.lock --- composer.lock | 206 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 154 insertions(+), 52 deletions(-) diff --git a/composer.lock b/composer.lock index 467af9461..d8d00562c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "d9941245360c86434d18413999bdc812", - "content-hash": "fbeb5d4ef943f6d1d55220cb844d11f1", + "hash": "698d18072d5bdca35f006abb48135f97", + "content-hash": "5d7d0ed8a6755422fedde68f26823701", "packages": [ { "name": "BlackrockDigital/startbootstrap-sb-admin-2", @@ -71,6 +71,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", @@ -502,16 +601,16 @@ }, { "name": "components/jquery", - "version": "3.4.1", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/components/jquery.git", - "reference": "901828b7968b18319e377dc23d466f28426ee083" + "reference": "6cf38ee1fd04b6adf8e7dda161283aa35be818c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/components/jquery/zipball/901828b7968b18319e377dc23d466f28426ee083", - "reference": "901828b7968b18319e377dc23d466f28426ee083", + "url": "https://api.github.com/repos/components/jquery/zipball/6cf38ee1fd04b6adf8e7dda161283aa35be818c3", + "reference": "6cf38ee1fd04b6adf8e7dda161283aa35be818c3", "shasum": "" }, "type": "component", @@ -540,7 +639,7 @@ ], "description": "jQuery JavaScript Library", "homepage": "http://jquery.com", - "time": "2019-10-23 05:15:13" + "time": "2021-03-20 19:13:42" }, { "name": "components/jqueryui", @@ -674,6 +773,7 @@ "captcha", "security" ], + "abandoned": true, "time": "2018-03-09 06:07:41" }, { @@ -750,16 +850,16 @@ }, { "name": "fzaninotto/faker", - "version": "v1.9.1", + "version": "v1.9.2", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", - "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", "shasum": "" }, "require": { @@ -797,7 +897,7 @@ "fixtures" ], "abandoned": true, - "time": "2019-12-12 13:22:17" + "time": "2020-12-11 09:56:16" }, { "name": "joeldbirch/superfish", @@ -1086,16 +1186,16 @@ }, { "name": "ml/json-ld", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/lanthaler/JsonLD.git", - "reference": "b5f82820c255cb64067b1c7adbb819cad4afa70a" + "reference": "c74a1aed5979ed1cfb1be35a55a305fd30e30b93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lanthaler/JsonLD/zipball/b5f82820c255cb64067b1c7adbb819cad4afa70a", - "reference": "b5f82820c255cb64067b1c7adbb819cad4afa70a", + "url": "https://api.github.com/repos/lanthaler/JsonLD/zipball/c74a1aed5979ed1cfb1be35a55a305fd30e30b93", + "reference": "c74a1aed5979ed1cfb1be35a55a305fd30e30b93", "shasum": "" }, "require": { @@ -1131,7 +1231,7 @@ "JSON-LD", "jsonld" ], - "time": "2018-11-18 20:26:18" + "time": "2020-06-16 17:45:06" }, { "name": "moment/momentjs", @@ -1146,16 +1246,16 @@ }, { "name": "mottie/tablesorter", - "version": "v2.31.2", + "version": "v2.31.3", "source": { "type": "git", "url": "https://github.com/Mottie/tablesorter.git", - "reference": "6a32e5acc294be5b6c420c83d70d66e096533d8f" + "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/6a32e5acc294be5b6c420c83d70d66e096533d8f", - "reference": "6a32e5acc294be5b6c420c83d70d66e096533d8f", + "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/7202d5faf8105a5ecd1a2b7a653777618713ffe5", + "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5", "shasum": "" }, "require": { @@ -1193,7 +1293,7 @@ "sorting", "table" ], - "time": "2019-12-01 13:49:52" + "time": "2020-03-03 13:46:03" }, { "name": "nategood/httpful", @@ -1322,16 +1422,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.31", + "version": "2.0.34", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4" + "reference": "98a6fe587f3481aea319eef7e656d02cfe1675ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/233a920cb38636a43b18d428f9a8db1f0a1a08f4", - "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/98a6fe587f3481aea319eef7e656d02cfe1675ec", + "reference": "98a6fe587f3481aea319eef7e656d02cfe1675ec", "shasum": "" }, "require": { @@ -1409,7 +1509,7 @@ "x.509", "x509" ], - "time": "2021-04-06 13:56:45" + "time": "2021-10-27 02:46:30" }, { "name": "rmariuzzo/jquery-checkboxes", @@ -1435,16 +1535,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", "shasum": "" }, "require": { @@ -1456,7 +1556,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -1489,7 +1593,7 @@ "polyfill", "portable" ], - "time": "2019-11-27 13:56:44" + "time": "2020-10-23 09:01:57" }, { "name": "tapmodo/Jcrop", @@ -1504,16 +1608,16 @@ }, { "name": "tinymce/tinymce", - "version": "4.9.8", + "version": "4.9.11", "source": { "type": "git", "url": "https://github.com/tinymce/tinymce-dist.git", - "reference": "912df2bc85015c758e32d1262219f1653bbf9783" + "reference": "3a68b67d1120ab89c6760afeb787291703c9a7d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/912df2bc85015c758e32d1262219f1653bbf9783", - "reference": "912df2bc85015c758e32d1262219f1653bbf9783", + "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/3a68b67d1120ab89c6760afeb787291703c9a7d5", + "reference": "3a68b67d1120ab89c6760afeb787291703c9a7d5", "shasum": "" }, "type": "component", @@ -1546,7 +1650,7 @@ "tinymce", "wysiwyg" ], - "time": "2020-01-28 05:03:01" + "time": "2020-07-13 05:29:19" }, { "name": "tomazdragar/SimpleCropper", @@ -1611,16 +1715,16 @@ }, { "name": "twig/twig", - "version": "v1.42.4", + "version": "v1.42.5", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152" + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e587180584c3d2d6cb864a0454e777bb6dcb6152", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", "shasum": "" }, "require": { @@ -1629,8 +1733,7 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^3.4|^4.2", - "symfony/phpunit-bridge": "^4.4@dev|^5.0" + "symfony/phpunit-bridge": "^4.4|^5.0" }, "type": "library", "extra": { @@ -1659,7 +1762,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -1673,24 +1775,24 @@ "keywords": [ "templating" ], - "time": "2019-11-11 16:49:32" + "time": "2020-02-11 05:59:23" }, { "name": "zetacomponents/base", - "version": "1.9.1", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/zetacomponents/Base.git", - "reference": "489e20235989ddc97fdd793af31ac803972454f1" + "reference": "2f432f4117a5aa2164d4fb1784f84db91dbdd3b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zetacomponents/Base/zipball/489e20235989ddc97fdd793af31ac803972454f1", - "reference": "489e20235989ddc97fdd793af31ac803972454f1", + "url": "https://api.github.com/repos/zetacomponents/Base/zipball/2f432f4117a5aa2164d4fb1784f84db91dbdd3b8", + "reference": "2f432f4117a5aa2164d4fb1784f84db91dbdd3b8", "shasum": "" }, "require-dev": { - "phpunit/phpunit": "~5.7", + "phpunit/phpunit": "~8.0", "zetacomponents/unit-test": "*" }, "type": "library", @@ -1737,7 +1839,7 @@ ], "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.", "homepage": "https://github.com/zetacomponents", - "time": "2017-11-28 11:30:00" + "time": "2021-07-25 15:46:08" }, { "name": "zetacomponents/database", From f14496ef5ad47c01b9e27ec9f09ef17df078cc04 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 2 May 2022 11:31:23 +0200 Subject: [PATCH 4/5] checkstudienbeitrag hinzugefuegt --- application/models/crm/Konto_model.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php index 23e52ce49..1262a089e 100644 --- a/application/models/crm/Konto_model.php +++ b/application/models/crm/Konto_model.php @@ -96,4 +96,30 @@ class Konto_model extends DB_Model 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 + '; + + return $this->execQuery($query); + } } From 826d4797617d31133c4e2249b6252950cdc5a5fa Mon Sep 17 00:00:00 2001 From: ma0048 Date: Mon, 2 May 2022 11:33:33 +0200 Subject: [PATCH 5/5] limit hinzugefuegt --- application/models/crm/Konto_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php index 1262a089e..32fdd97c9 100644 --- a/application/models/crm/Konto_model.php +++ b/application/models/crm/Konto_model.php @@ -117,7 +117,7 @@ class Konto_model extends DB_Model WHERE skonto.buchungsnr = tbl_konto.buchungsnr_verweis OR skonto.buchungsnr_verweis = tbl_konto.buchungsnr_verweis ) - ORDER BY buchungsnr + ORDER BY buchungsnr DESC LIMIT 1 '; return $this->execQuery($query);