diff --git a/api/application/composer.json b/api/application/composer.json index f3b10333..3feef0eb 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -26,7 +26,8 @@ "twilio/sdk": "^6.10", "phpoffice/phpspreadsheet": "^1.15", "johnathanmiller/secure-env-php": "^2.0", - "google/apiclient": "^2.0" + "google/apiclient": "^2.0", + "jurosh/pdf-merge": "^2.1" }, "suggest": { diff --git a/api/application/composer.lock b/api/application/composer.lock index 037bcaf0..337b06a1 100644 --- a/api/application/composer.lock +++ b/api/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "70890214c6c375f6c009bf71a7b172e7", + "content-hash": "8fc0a51600d01d7c91e51c6a63b2b3f2", "packages": [ { "name": "amphp/amp", @@ -377,6 +377,236 @@ }, "time": "2021-12-25T01:21:49+00:00" }, + { + "name": "firebase/php-jwt", + "version": "v5.5.1", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6", + "reference": "83b609028194aa042ea33b5af2d41a7427de80e6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v5.5.1" + }, + "time": "2021-11-08T20:18:51+00:00" + }, + { + "name": "google/apiclient", + "version": "v2.12.1", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-api-php-client.git", + "reference": "1530583a711f4414407112c4068464bcbace1c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/1530583a711f4414407112c4068464bcbace1c71", + "reference": "1530583a711f4414407112c4068464bcbace1c71", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0||~3.0||~4.0||~5.0", + "google/apiclient-services": "~0.200", + "google/auth": "^1.10", + "guzzlehttp/guzzle": "~5.3.3||~6.0||~7.0", + "guzzlehttp/psr7": "^1.7||^2.0.0", + "monolog/monolog": "^1.17||^2.0", + "php": "^5.6|^7.0|^8.0", + "phpseclib/phpseclib": "~2.0||^3.0.2" + }, + "require-dev": { + "cache/filesystem-adapter": "^0.3.2|^1.1", + "composer/composer": "^1.10.22", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "phpcompatibility/php-compatibility": "^9.2", + "phpspec/prophecy-phpunit": "^1.1||^2.0", + "phpunit/phpunit": "^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "~2.3", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "files": [ + "src/aliases.php" + ], + "psr-4": { + "Google\\": "src/" + }, + "classmap": [ + "src/aliases.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/google-api-php-client/issues", + "source": "https://github.com/googleapis/google-api-php-client/tree/v2.12.1" + }, + "time": "2021-12-02T03:34:25+00:00" + }, + { + "name": "google/apiclient-services", + "version": "v0.279.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-api-php-client-services.git", + "reference": "2105f08f4ee00c5847f980b5b4491346f4ceb60d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/2105f08f4ee00c5847f980b5b4491346f4ceb60d", + "reference": "2105f08f4ee00c5847f980b5b4491346f4ceb60d", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5.7||^8.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "autoload.php" + ], + "psr-4": { + "Google\\Service\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/google-api-php-client-services/issues", + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.279.0" + }, + "time": "2022-12-18T01:18:15+00:00" + }, + { + "name": "google/auth", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-auth-library-php.git", + "reference": "1f8cff5aa324700d041efd2df1a0855112a2e7ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/1f8cff5aa324700d041efd2df1a0855112a2e7ae", + "reference": "1f8cff5aa324700d041efd2df1a0855112a2e7ae", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "^5.5||^6.0", + "guzzlehttp/guzzle": "^6.2.1|^7.0", + "guzzlehttp/psr7": "^1.7|^2.0", + "php": "^7.1||^8.0", + "psr/cache": "^1.0|^2.0|^3.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "guzzlehttp/promises": "0.1.1|^1.3", + "kelvinmo/simplejwt": "^0.2.5|^0.5.1", + "phpseclib/phpseclib": "^2.0.31", + "phpspec/prophecy-phpunit": "^1.1||^2.0", + "phpunit/phpunit": "^7.5||^9.0.0", + "sebastian/comparator": ">=1.2.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/main/", + "issues": "https://github.com/googleapis/google-auth-library-php/issues", + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.24.0" + }, + "time": "2022-11-28T18:29:23+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.5.5", @@ -698,6 +928,55 @@ }, "time": "2019-01-07T06:56:58+00:00" }, + { + "name": "jurosh/pdf-merge", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/jurosh/php-pdf-merge.git", + "reference": "89ba3446c9f38c573e3b8bf577d2f22993494130" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jurosh/php-pdf-merge/zipball/89ba3446c9f38c573e3b8bf577d2f22993494130", + "reference": "89ba3446c9f38c573e3b8bf577d2f22993494130", + "shasum": "" + }, + "require": { + "php": ">=5.6.20", + "setasign/fpdf": "^1.8", + "setasign/fpdi": "^2.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/Jurosh/PDFMerge/PDFMerger.php", + "src/Jurosh/PDFMerge/PDFObject.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Juraj Husar", + "email": "jurosh@jurosh.com", + "homepage": "http://jurosh.com" + } + ], + "description": "PHP PDF Merger", + "homepage": "https://github.com/jurosh/php-pdf-merge", + "keywords": [ + "merge", + "pdf" + ], + "support": { + "issues": "https://github.com/jurosh/php-pdf-merge/issues", + "source": "https://github.com/jurosh/php-pdf-merge/tree/remove" + }, + "time": "2021-03-28T19:57:14+00:00" + }, { "name": "maennchen/zipstream-php", "version": "2.1.0", @@ -1083,6 +1362,123 @@ ], "time": "2021-07-05T08:18:36+00:00" }, + { + "name": "paragonie/constant_time_encoding", + "version": "v2.6.3", + "source": { + "type": "git", + "url": "https://github.com/paragonie/constant_time_encoding.git", + "reference": "58c3f47f650c94ec05a151692652a868995d2938" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", + "reference": "58c3f47f650c94ec05a151692652a868995d2938", + "shasum": "" + }, + "require": { + "php": "^7|^8" + }, + "require-dev": { + "phpunit/phpunit": "^6|^7|^8|^9", + "vimeo/psalm": "^1|^2|^3|^4" + }, + "type": "library", + "autoload": { + "psr-4": { + "ParagonIE\\ConstantTime\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com", + "role": "Maintainer" + }, + { + "name": "Steve 'Sc00bz' Thomas", + "email": "steve@tobtu.com", + "homepage": "https://www.tobtu.com", + "role": "Original Developer" + } + ], + "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", + "keywords": [ + "base16", + "base32", + "base32_decode", + "base32_encode", + "base64", + "base64_decode", + "base64_encode", + "bin2hex", + "encoding", + "hex", + "hex2bin", + "rfc4648" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/constant_time_encoding/issues", + "source": "https://github.com/paragonie/constant_time_encoding" + }, + "time": "2022-06-14T06:56:20+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, { "name": "phenx/php-font-lib", "version": "0.5.4", @@ -1424,6 +1820,165 @@ }, "time": "2022-01-06T11:10:08+00:00" }, + { + "name": "phpseclib/phpseclib", + "version": "3.0.18", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "f28693d38ba21bb0d9f0c411ee5dae2b178201da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/f28693d38ba21bb0d9f0c411ee5dae2b178201da", + "reference": "f28693d38ba21bb0d9f0c411ee5dae2b178201da", + "shasum": "" + }, + "require": { + "paragonie/constant_time_encoding": "^1|^2", + "paragonie/random_compat": "^1.4|^2.0|^9.99.99", + "php": ">=5.6.1" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "suggest": { + "ext-dom": "Install the DOM extension to load XML formatted public keys.", + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "type": "library", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib3\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "support": { + "issues": "https://github.com/phpseclib/phpseclib/issues", + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.18" + }, + "funding": [ + { + "url": "https://github.com/terrafrost", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpseclib", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", + "type": "tidelift" + } + ], + "time": "2022-12-17T18:26:50+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "time": "2016-08-06T20:24:11+00:00" + }, { "name": "psr/http-client", "version": "1.0.1", @@ -1782,6 +2337,124 @@ }, "time": "2021-12-11T13:40:54+00:00" }, + { + "name": "setasign/fpdf", + "version": "1.8.5", + "source": { + "type": "git", + "url": "https://github.com/Setasign/FPDF.git", + "reference": "f4104a04c9a3f95c4c26a0a0531abebcc980987a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Setasign/FPDF/zipball/f4104a04c9a3f95c4c26a0a0531abebcc980987a", + "reference": "f4104a04c9a3f95c4c26a0a0531abebcc980987a", + "shasum": "" + }, + "require": { + "ext-gd": "*", + "ext-zlib": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "fpdf.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Olivier Plathey", + "email": "oliver@fpdf.org", + "homepage": "http://fpdf.org/" + } + ], + "description": "FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.", + "homepage": "http://www.fpdf.org", + "keywords": [ + "fpdf", + "pdf" + ], + "support": { + "source": "https://github.com/Setasign/FPDF/tree/1.8.5" + }, + "time": "2022-11-18T07:02:00+00:00" + }, + { + "name": "setasign/fpdi", + "version": "v2.3.6", + "source": { + "type": "git", + "url": "https://github.com/Setasign/FPDI.git", + "reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31", + "reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31", + "shasum": "" + }, + "require": { + "ext-zlib": "*", + "php": "^5.6 || ^7.0 || ^8.0" + }, + "conflict": { + "setasign/tfpdf": "<1.31" + }, + "require-dev": { + "phpunit/phpunit": "~5.7", + "setasign/fpdf": "~1.8", + "setasign/tfpdf": "1.31", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "~6.2" + }, + "suggest": { + "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." + }, + "type": "library", + "autoload": { + "psr-4": { + "setasign\\Fpdi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Slabon", + "email": "jan.slabon@setasign.com", + "homepage": "https://www.setasign.com" + }, + { + "name": "Maximilian Kresse", + "email": "maximilian.kresse@setasign.com", + "homepage": "https://www.setasign.com" + } + ], + "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", + "homepage": "https://www.setasign.com/fpdi", + "keywords": [ + "fpdf", + "fpdi", + "pdf" + ], + "support": { + "issues": "https://github.com/Setasign/FPDI/issues", + "source": "https://github.com/Setasign/FPDI/tree/v2.3.6" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi", + "type": "tidelift" + } + ], + "time": "2021-02-11T11:37:01+00:00" + }, { "name": "smalot/pdfparser", "version": "v0.13.3", @@ -2497,5 +3170,5 @@ "php": ">=5.3.7" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 516bfdb1..bd8049aa 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -417,5 +417,3 @@ $route['checkjsonPD']='Data_Dump_Controller/checkjsonPD'; $route['deleteS3Image']='Data_Dump_Controller/deleteS3Images'; $route['saveShortsVideo'] = 'PD_Controller/saveShortsVideo'; - -$route['merge']='Data_Dump_Controller/pdfmerge'; \ No newline at end of file diff --git a/api/application/controllers/Flyhi_Controller.php b/api/application/controllers/Flyhi_Controller.php index 08b3994b..2e8e54da 100644 --- a/api/application/controllers/Flyhi_Controller.php +++ b/api/application/controllers/Flyhi_Controller.php @@ -2343,7 +2343,7 @@ class Flyhi_Controller extends REST_Controller { if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { - $pd_document_data = array('fk_pd_id' => $pd_id,'img_type' => 2,'pd_document_title'=>$doc_renamed,'pd_document_name'=>$doc_renamed,'fk_form_id'=>18,'co_applicant_id'=>$applicant_id,'image_key' => 'person_met_id','content_type'=>3); + $pd_document_data = array('fk_pd_id' => $pd_id,'img_type' => 2,'pd_document_title'=>$digilocker_doc_name[$i],'pd_document_name'=>$doc_renamed,'fk_form_id'=>18,'co_applicant_id'=>$applicant_id,'image_key' => 'person_met_id','content_type'=>3); $pd_document_id = $this->Flyhi_Model->saveRecords($pd_document_data,PDDOCUMENTS); if($pd_document_id != "" || $pd_document_id != null){ $temp_flag++; } unlink($src_local_file); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 57ef5cf5..08091090 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4431,7 +4431,7 @@ class PD_Controller extends REST_Controller } $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid, $random_string); - //print_r($pd_master_details); + // print_r($pd_master_details);die(); // var_dump($pd_master_details[0]['is_img_pdf_created']); // check img zip link, img pdf link and vide links if (!$pd_master_details[0]['is_img_pdf_created']) { @@ -4477,6 +4477,7 @@ class PD_Controller extends REST_Controller if ($is_qc_edited == 1 || $is_qc_edited == 2) { //Get Latest PD Report Html file and convert it into PDF + // $latest_pd_report_html_file_name = "2022-12-19-22-25-40"; $latest_pd_report_html_file_name = $pd_master_details[0]['pd_report_html_filename']; $latest_pd_report_html_file_path = $this->external_path . '/pd_reports/' . $pdid . '/' . $latest_pd_report_html_file_name . '.html'; $temp = file_get_contents($latest_pd_report_html_file_path); @@ -4512,14 +4513,39 @@ class PD_Controller extends REST_Controller // die(); //PDF Gen using DOM PDF $pdf_doc = $this->pdfgenerator->generate($temp, $filename = 'version', $stream = false, $paper = 'A4', $orientation = "portrait"); + $details = $this->PD_Model->getDocsDetails($pdid); + if(!empty($details)){ + for($i=0;$iaws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $dockey, '+30 minutes'); + $src_local_file = XLPATH.'/tmp/'.$details[$i]['pd_document_name']; + $ifp = fopen( $src_local_file, 'wb' ); + fwrite( $ifp, $doc_singed_uri ); + fclose( $ifp ); + chmod($src_local_file, 0777); + $docsdetails[] = $details[$i]['pd_document_name']; + } + } + // ALTER TABLE `sineedgedemo`.`t_pd_documents` + // ADD COLUMN `docs_merge` TINYINT(4) NULL DEFAULT '0' AFTER `content_type`; //End of PDF Gen using DOM PDF $output_file2 = $this->external_path . "/pd_reports/" . $pdid . "/sample.pdf"; $bytes = file_put_contents($output_file2, $pdf_doc); // echo $output_file2; // die(); if (file_put_contents($output_file2, $pdf_doc)) { - + if(!empty($docsdetails)){ + $pdf = new \Jurosh\PDFMerge\PDFMerger; + // $pdf = new PDFMerger; + $pdf->addPDF($output_file2, 'all'); + foreach($docsdetails as $doc) + { + $pdf->addPDF(XLPATH.'/tmp/'.$doc, 'all'); + } + $pdf->merge('file', $output_file2); + } $sourcefile = $output_file2; + // print_r($sourcefile);die(); $bucket_data = array('bucket_name' => $bucketname, 'key' => $newkey, 'sourcefile' => $sourcefile); $s3result = $this->aws_s3->uploadFileToS3Bucket($bucket_data); //print_r($s3result); @@ -4537,7 +4563,6 @@ class PD_Controller extends REST_Controller if ($headers && strpos($headers[0], '200')) { $singed_uri = $_uri; } else { - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $newkey, '30 minutes'); } @@ -4546,6 +4571,11 @@ class PD_Controller extends REST_Controller $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = $singed_uri; + foreach($docsdetails as $doc) + { + $src_local_file = XLPATH.'/tmp/'.$doc; + unlink($src_local_file); + } //$data['records'] = array('pdf_url' => $singed_uri,'zip_url' => $zip_file_uri); $this->response($data, REST_Controller::HTTP_OK); } else { @@ -4596,8 +4626,7 @@ class PD_Controller extends REST_Controller $pdid = $records['pd_id']; $fk_createdby = $records['fk_createdby']; $random_string = $records['random_string']; - - + $doc_id = $records['digilocker_merge']; if (!file_exists($this->external_path . '/pd_reports/' . $pdid)) { mkdir($this->external_path . '/pd_reports/' . $pdid, 0777); } @@ -4774,7 +4803,12 @@ class PD_Controller extends REST_Controller if ($is_write_done) { //$update = $this->PD_Model->updateRecords(array('pd_report_html_filename' => $pd_report_time),PDTRIGGER,array('pd_id' => $pdid)); - + if(!empty($records['digilocker_merge'])){ + foreach ($doc_id as $id) { + $filtered_arr[] = $id['pd_document_id']; + } + if(!empty($filtered_arr))$this->PD_Model->updpddocs($filtered_arr); + } $where_condition_array = array("pd_id" => $pdid); $temp_array = array('is_original_report_created' => 1, 'pd_report_html_filename' => $pd_report_time, 'pd_report_generated_date' => date('Y-m-d H:i:s'), 'is_qc_edited' => 2); diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 821314fc..eff36ce5 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -2744,6 +2744,8 @@ class GETPROCESSEDJSON if(count($name)) { $raw_json[$key]['Name_of_the_Person_met_master'] = $name[0]['applicant_name']; + }else{ + $raw_json[$key]['Name_of_the_Person_met_master'] = $value['Name_of_the_Person_met']; } } diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index c62d0b8c..8328ee67 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -2928,4 +2928,17 @@ function array_splice_after_key($array, $key, $array_to_insert) } return $array; } +public function getDocsDetails($pd_id){ + $sql = "SELECT d.fk_pd_id, d.pd_document_id, d.image_key, d.pd_document_title, d.pd_document_name, d.pd_image_alias_name + FROM t_pd_documents as d + where d.fk_pd_id = ".$pd_id." and d.content_type = 3 and d.isactive = 1 and d.docs_merge = 1"; + return $this->db->query($sql)->result_array(); +} + +function updpddocs($arr){ + $this->db->where_in("pd_document_id", $arr); + $this->db->where("content_type",3); + $this->db->where("isactive",1); + $this->db->update("t_pd_documents", array("docs_merge" => 1)); +} } \ No newline at end of file