From 5272a1d07d28c24767728ebe54d41f4537dcf4c7 Mon Sep 17 00:00:00 2001 From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:01:28 +0530 Subject: [PATCH] suseendhiran --- application/libraries/index.html | 3 +- .../modules/Asset/controllers/Asset.php | 23 +- .../modules/Asset/models/Asset_model.php | 12 + .../modules/Asset/views/asset_list.php | 2 + application/modules/Asset/views/view_qr.php | 2 + application/modules/Asset/views/welcome.php | 3 + composer.json | 4 +- composer.lock | 350 ++++++++++++++++-- 8 files changed, 363 insertions(+), 36 deletions(-) create mode 100644 application/modules/Asset/views/view_qr.php create mode 100644 application/modules/Asset/views/welcome.php diff --git a/application/libraries/index.html b/application/libraries/index.html index b702fbc..c942a79 100644 --- a/application/libraries/index.html +++ b/application/libraries/index.html @@ -1,4 +1,3 @@ - 403 Forbidden @@ -8,4 +7,4 @@

Directory access is forbidden.

- + \ No newline at end of file diff --git a/application/modules/Asset/controllers/Asset.php b/application/modules/Asset/controllers/Asset.php index fdc5583..ffb3226 100644 --- a/application/modules/Asset/controllers/Asset.php +++ b/application/modules/Asset/controllers/Asset.php @@ -1,5 +1,9 @@ load->model('Asset_model'); $this->load->model('Audit_model'); $this->load->helper(array('form', 'url')); + + } public function index() @@ -61,13 +67,22 @@ public function addAsset($id='empty') public function assetList() { - $assets_list = $this->Asset_model->get_assets(user()->business_id); $this->layout->set('tableData', $assets_list); $this->layout->buffer('main_content', 'Asset/asset_list'); $this->layout->render('default_layout'); } + + public function view_qrcode($id) + { + $assetData = $this->Asset_model->get_asset_id($id, 'asset' , user()->business_id); + $this->layout->set('img', $assetData->qrcode_img); + $this->layout->buffer('main_content', 'Asset/view_qr'); + $this->layout->render('default_layout'); + + } + public function createAssets() { $data=$this->input->post(); @@ -95,6 +110,12 @@ public function createAssets() //create asset $create_assets = $this->MY_Model->insert($data,$table); + + // Qr code + $qr_data['qrcode_img'] = (new QRCode)->render(base_url().'Asset/view_asset_details/'.md5($create_assets)); + $editAssetData = $this->MY_Model->edit_option($qr_data, $create_assets, $table); + + if($create_assets) { //set id $ table name for audit history diff --git a/application/modules/Asset/models/Asset_model.php b/application/modules/Asset/models/Asset_model.php index b554811..1dec8e6 100644 --- a/application/modules/Asset/models/Asset_model.php +++ b/application/modules/Asset/models/Asset_model.php @@ -107,6 +107,18 @@ public function delete_by_md5_id($id,$business_id,$table) $this->db->update($table); return; } + +public function get_asset_id($id,$table,$business_id) + { + $this->db->select(); + $this->db->from($table); + $this->db->where('business_id', $business_id); + $this->db->where('md5(id)', $id); + $this->db->where('is_active', 1); + $query = $this->db->get(); + $query = $query->row(); + return $query; + } diff --git a/application/modules/Asset/views/asset_list.php b/application/modules/Asset/views/asset_list.php index 54f1acb..1c847e5 100644 --- a/application/modules/Asset/views/asset_list.php +++ b/application/modules/Asset/views/asset_list.php @@ -68,6 +68,8 @@   +   + diff --git a/application/modules/Asset/views/view_qr.php b/application/modules/Asset/views/view_qr.php new file mode 100644 index 0000000..8ea74ac --- /dev/null +++ b/application/modules/Asset/views/view_qr.php @@ -0,0 +1,2 @@ +QR Code \ No newline at end of file diff --git a/application/modules/Asset/views/welcome.php b/application/modules/Asset/views/welcome.php new file mode 100644 index 0000000..c4c07d2 --- /dev/null +++ b/application/modules/Asset/views/welcome.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/composer.json b/composer.json index 71e511c..0f322ae 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,9 @@ }, "require": { "php": ">=5.3.7", - "filp/whoops": "^2.5" + "filp/whoops": "^2.5", + "endroid/qr-code": "^4.6", + "chillerlan/php-qrcode": "^4.3" }, "suggest": { "paragonie/random_compat": "Provides better randomness in PHP 5.x" diff --git a/composer.lock b/composer.lock index 2ebfcb5..418afed 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,323 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "26190e9c87f9e02165e2c477e9d9961b", + "content-hash": "4d49fa8b3c123439b594db07cd383c5f", "packages": [ + { + "name": "bacon/bacon-qr-code", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/Bacon/BaconQrCode.git", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22", + "shasum": "" + }, + "require": { + "dasprid/enum": "^1.0.3", + "ext-iconv": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phly/keep-a-changelog": "^2.1", + "phpunit/phpunit": "^7 | ^8 | ^9", + "spatie/phpunit-snapshot-assertions": "^4.2.9", + "squizlabs/php_codesniffer": "^3.4" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "type": "library", + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "BaconQrCode is a QR code generator for PHP.", + "homepage": "https://github.com/Bacon/BaconQrCode", + "support": { + "issues": "https://github.com/Bacon/BaconQrCode/issues", + "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8" + }, + "time": "2022-12-07T17:46:57+00:00" + }, + { + "name": "chillerlan/php-qrcode", + "version": "4.3.4", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d", + "reference": "2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d", + "shasum": "" + }, + "require": { + "chillerlan/php-settings-container": "^2.1.4", + "ext-mbstring": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "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" + }, + { + "name": "Contributors", + "homepage": "https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "description": "A QR code generator. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "phpqrcode", + "qr", + "qr code", + "qrcode", + "qrcode-generator" + ], + "support": { + "issues": "https://github.com/chillerlan/php-qrcode/issues", + "source": "https://github.com/chillerlan/php-qrcode/tree/4.3.4" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2022-07-25T09:12:45+00:00" + }, + { + "name": "chillerlan/php-settings-container", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-settings-container.git", + "reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/1beb7df3c14346d4344b0b2e12f6f9a74feabd4a", + "reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Settings\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A container class for immutable settings objects. Not a DI container. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-settings-container", + "keywords": [ + "PHP7", + "Settings", + "configuration", + "container", + "helper" + ], + "support": { + "issues": "https://github.com/chillerlan/php-settings-container/issues", + "source": "https://github.com/chillerlan/php-settings-container" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2022-07-05T22:32:14+00:00" + }, + { + "name": "dasprid/enum", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/DASPRiD/Enum.git", + "reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2", + "reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "^3.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "PHP 7.1 enum implementation", + "keywords": [ + "enum", + "map" + ], + "support": { + "issues": "https://github.com/DASPRiD/Enum/issues", + "source": "https://github.com/DASPRiD/Enum/tree/1.0.3" + }, + "time": "2020-10-02T16:03:48+00:00" + }, + { + "name": "endroid/qr-code", + "version": "4.6.1", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code.git", + "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/a75c913b0e4d6ad275e49a2c1de1cacffc6c2184", + "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0.5", + "php": "^7.4||^8.0" + }, + "require-dev": { + "endroid/quality": "dev-master", + "ext-gd": "*", + "khanamiryan/qrcode-detector-decoder": "^1.0.4", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "ext-gd": "Enables you to write PNG images", + "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator", + "roave/security-advisories": "Makes sure package versions with known security issues are not installed", + "setasign/fpdf": "Enables you to use the PDF writer" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code", + "homepage": "https://github.com/endroid/qr-code", + "keywords": [ + "code", + "endroid", + "php", + "qr", + "qrcode" + ], + "support": { + "issues": "https://github.com/endroid/qr-code/issues", + "source": "https://github.com/endroid/qr-code/tree/4.6.1" + }, + "funding": [ + { + "url": "https://github.com/endroid", + "type": "github" + } + ], + "time": "2022-10-26T08:48:17+00:00" + }, { "name": "filp/whoops", "version": "2.5.0", @@ -170,36 +485,6 @@ ], "time": "2017-07-22T11:58:36+00:00" }, - { - "name": "mikey179/vfsStream", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/bovigo/vfsStream.git", - "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e", - "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "org\\bovigo\\vfs": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "homepage": "http://vfs.bovigo.org/", - "time": "2012-08-25T12:49:29+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.8.1", @@ -1544,5 +1829,6 @@ "platform": { "php": ">=5.3.7" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.3.0" }