From 36f8dddc4d01f50d4a25498195f89e632744f856 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 25 May 2022 11:00:20 +1000 Subject: [PATCH 1/6] Page numbering with TCPDF --- app/Utils/Traits/Pdf/PDF.php | 23 ++++++ app/Utils/Traits/Pdf/PdfMaker.php | 27 +++++++ composer.json | 4 +- composer.lock | 120 +++++++++++++++++++++++++++++- 4 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 app/Utils/Traits/Pdf/PDF.php diff --git a/app/Utils/Traits/Pdf/PDF.php b/app/Utils/Traits/Pdf/PDF.php new file mode 100644 index 000000000000..9e1e505d96ee --- /dev/null +++ b/app/Utils/Traits/Pdf/PDF.php @@ -0,0 +1,23 @@ +SetY(-7); + // $this->SetX(-50); + + $this->SetXY(0, -5); + + // Arial italic 8 + $this->SetFont('Arial','I',8); + // Page number + $this->Cell(0,5, ctrans('texts.page').' '.$this->PageNo().'/{nb}',0,0,'C'); + } +} \ No newline at end of file diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index 7c33990b48e5..f21bba9fd019 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -14,6 +14,7 @@ namespace App\Utils\Traits\Pdf; use App\Exceptions\InternalPDFFailure; use Beganovich\Snappdf\Snappdf; +use setasign\Fpdi\PdfParser\StreamReader; trait PdfMaker { @@ -43,6 +44,32 @@ trait PdfMaker ->setHtml($html) ->generate(); + + // initiate PDF + $pdf = new PDF(); + + // set the source file + // $pageCount = $pdf->setSourceFile("file-1.pdf"); + $pageCount = $pdf->setSourceFile(StreamReader::createByString($generated)); + + $pdf->AliasNbPages(); + for ($i=1; $i <= $pageCount; $i++) { + //import a page then get the id and will be used in the template + $tplId = $pdf->importPage($i); + //create a page + + $templateSize = $pdf->getTemplateSize($tplId); + $pdf->AddPage('', [$templateSize['width'], $templateSize['height']]); + + // $pdf->AddPage(); + //use the template of the imporated page + $pdf->useTemplate($tplId); + } + + + $generated = $pdf->Output(); + + if($generated) return $generated; diff --git a/composer.json b/composer.json index 936fc0c378b6..dd97adf32f13 100644 --- a/composer.json +++ b/composer.json @@ -74,6 +74,8 @@ "predis/predis": "^1.1", "razorpay/razorpay": "2.*", "sentry/sentry-laravel": "^2", + "setasign/fpdf": "^1.8", + "setasign/fpdi": "^2.3", "square/square": "13.0.0.20210721", "stripe/stripe-php": "^7.50", "symfony/http-client": "^5.2", @@ -148,4 +150,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index ee703998a3c0..897642caab0a 100644 --- a/composer.lock +++ b/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": "9bc9b45c0c0864b0f16869ba0870fde5", + "content-hash": "7b3f79c9cba4d88565a17f269a2184a2", "packages": [ { "name": "afosto/yaac", @@ -7831,6 +7831,124 @@ ], "time": "2022-04-05T10:05:19+00:00" }, + { + "name": "setasign/fpdf", + "version": "1.8.4", + "source": { + "type": "git", + "url": "https://github.com/Setasign/FPDF.git", + "reference": "b0ddd9c5b98ced8230ef38534f6f3c17308a7974" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Setasign/FPDF/zipball/b0ddd9c5b98ced8230ef38534f6f3c17308a7974", + "reference": "b0ddd9c5b98ced8230ef38534f6f3c17308a7974", + "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.4" + }, + "time": "2021-08-30T07:50:06+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": "square/square", "version": "13.0.0.20210721", From bdb08bf93ad63b784822b285703294ff2ef1c1bf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 25 May 2022 11:49:27 +1000 Subject: [PATCH 2/6] Page numbering trait --- app/Utils/Traits/Pdf/PageNumbering.php | 47 ++ app/Utils/Traits/Pdf/PdfMaker.php | 27 -- composer.lock | 572 +++++++++++++------------ 3 files changed, 347 insertions(+), 299 deletions(-) create mode 100644 app/Utils/Traits/Pdf/PageNumbering.php diff --git a/app/Utils/Traits/Pdf/PageNumbering.php b/app/Utils/Traits/Pdf/PageNumbering.php new file mode 100644 index 000000000000..e012675c25bd --- /dev/null +++ b/app/Utils/Traits/Pdf/PageNumbering.php @@ -0,0 +1,47 @@ +setSourceFile(StreamReader::createByString($pdf_data_object)); + + $pdf->AliasNbPages(); + for ($i=1; $i <= $pageCount; $i++) { + //import a page then get the id and will be used in the template + $tplId = $pdf->importPage($i); + + //create a page + $templateSize = $pdf->getTemplateSize($tplId); + $pdf->AddPage('', [$templateSize['width'], $templateSize['height']]); + + $pdf->useTemplate($tplId); + } + + + return $pdf->Output(); + + } + +} \ No newline at end of file diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index f21bba9fd019..7c33990b48e5 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -14,7 +14,6 @@ namespace App\Utils\Traits\Pdf; use App\Exceptions\InternalPDFFailure; use Beganovich\Snappdf\Snappdf; -use setasign\Fpdi\PdfParser\StreamReader; trait PdfMaker { @@ -44,32 +43,6 @@ trait PdfMaker ->setHtml($html) ->generate(); - - // initiate PDF - $pdf = new PDF(); - - // set the source file - // $pageCount = $pdf->setSourceFile("file-1.pdf"); - $pageCount = $pdf->setSourceFile(StreamReader::createByString($generated)); - - $pdf->AliasNbPages(); - for ($i=1; $i <= $pageCount; $i++) { - //import a page then get the id and will be used in the template - $tplId = $pdf->importPage($i); - //create a page - - $templateSize = $pdf->getTemplateSize($tplId); - $pdf->AddPage('', [$templateSize['width'], $templateSize['height']]); - - // $pdf->AddPage(); - //use the template of the imporated page - $pdf->useTemplate($tplId); - } - - - $generated = $pdf->Output(); - - if($generated) return $generated; diff --git a/composer.lock b/composer.lock index 897642caab0a..3d161f04ae9d 100644 --- a/composer.lock +++ b/composer.lock @@ -434,16 +434,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.220.3", + "version": "3.222.19", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "fbb2d7349916c15758ee02dfd001a714883a9adf" + "reference": "22fcdfcc7ed0f267512aa5c38bc00c12eaed51b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fbb2d7349916c15758ee02dfd001a714883a9adf", - "reference": "fbb2d7349916c15758ee02dfd001a714883a9adf", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/22fcdfcc7ed0f267512aa5c38bc00c12eaed51b6", + "reference": "22fcdfcc7ed0f267512aa5c38bc00c12eaed51b6", "shasum": "" }, "require": { @@ -519,9 +519,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.220.3" + "source": "https://github.com/aws/aws-sdk-php/tree/3.222.19" }, - "time": "2022-04-22T18:18:31+00:00" + "time": "2022-05-24T18:16:51+00:00" }, { "name": "bacon/bacon-qr-code", @@ -1003,16 +1003,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b" + "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", - "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/fd5dd441932a7e10ca6e5b490e272d34c8430640", + "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640", "shasum": "" }, "require": { @@ -1059,7 +1059,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.1" + "source": "https://github.com/composer/ca-bundle/tree/1.3.2" }, "funding": [ { @@ -1075,7 +1075,7 @@ "type": "tidelift" } ], - "time": "2021-10-28T20:44:15+00:00" + "time": "2022-05-24T11:56:16+00:00" }, { "name": "dasprid/enum", @@ -1201,16 +1201,16 @@ }, { "name": "doctrine/cache", - "version": "2.1.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce" + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/331b4d5dbaeab3827976273e9356b3b453c300ce", - "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", "shasum": "" }, "require": { @@ -1220,18 +1220,12 @@ "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "predis/predis": "~1.0", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.2 || ^6.0@dev", - "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" }, "type": "library", "autoload": { @@ -1280,7 +1274,7 @@ ], "support": { "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.1.1" + "source": "https://github.com/doctrine/cache/tree/2.2.0" }, "funding": [ { @@ -1296,26 +1290,26 @@ "type": "tidelift" } ], - "time": "2021-07-17T14:49:29+00:00" + "time": "2022-05-20T20:07:39+00:00" }, { "name": "doctrine/dbal", - "version": "3.3.5", + "version": "3.3.6", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "719663b15983278227669c8595151586a2ff3327" + "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/719663b15983278227669c8595151586a2ff3327", - "reference": "719663b15983278227669c8595151586a2ff3327", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9e7f76dd1cde81c62574fdffa5a9c655c847ad21", + "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21", "shasum": "" }, "require": { "composer-runtime-api": "^2", "doctrine/cache": "^1.11|^2.0", - "doctrine/deprecations": "^0.5.3", + "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", "php": "^7.3 || ^8.0", "psr/cache": "^1|^2|^3", @@ -1323,15 +1317,15 @@ }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.5.3", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "9.5.16", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.6.3", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "9.5.20", "psalm/plugin-phpunit": "0.16.1", "squizlabs/php_codesniffer": "3.6.2", "symfony/cache": "^5.2|^6.0", "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.22.0" + "vimeo/psalm": "4.23.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -1391,7 +1385,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.3.5" + "source": "https://github.com/doctrine/dbal/tree/3.3.6" }, "funding": [ { @@ -1407,29 +1401,29 @@ "type": "tidelift" } ], - "time": "2022-04-05T09:50:18+00:00" + "time": "2022-05-02T17:21:01+00:00" }, { "name": "doctrine/deprecations", - "version": "v0.5.3", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", "shasum": "" }, "require": { "php": "^7.1|^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0" + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -1448,9 +1442,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v0.5.3" + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" }, - "time": "2021-03-21T12:59:47+00:00" + "time": "2022-05-02T15:47:09+00:00" }, { "name": "doctrine/event-manager", @@ -2025,23 +2019,28 @@ }, { "name": "firebase/php-jwt", - "version": "v6.1.2", + "version": "v6.2.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "c297139da7c6873dbd67cbd1093f09ec0bbd0c50" + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/c297139da7c6873dbd67cbd1093f09ec0bbd0c50", - "reference": "c297139da7c6873dbd67cbd1093f09ec0bbd0c50", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d28e6df83830252650da4623c78aaaf98fb385f3", + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3", "shasum": "" }, "require": { "php": "^7.1||^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5||9.5" + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^1.1", + "phpunit/phpunit": "^7.5||^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" }, "suggest": { "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" @@ -2076,9 +2075,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.1.2" + "source": "https://github.com/firebase/php-jwt/tree/v6.2.0" }, - "time": "2022-04-21T14:37:18+00:00" + "time": "2022-05-13T20:54:50+00:00" }, { "name": "fruitcake/laravel-cors", @@ -2161,16 +2160,16 @@ }, { "name": "gocardless/gocardless-pro", - "version": "4.15.0", + "version": "4.16.0", "source": { "type": "git", "url": "https://github.com/gocardless/gocardless-pro-php.git", - "reference": "ff6e8f46e8018fabc7d432f4a64389e003394429" + "reference": "31116c4a47b7815cbe25e411a1e0382e42006691" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/ff6e8f46e8018fabc7d432f4a64389e003394429", - "reference": "ff6e8f46e8018fabc7d432f4a64389e003394429", + "url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/31116c4a47b7815cbe25e411a1e0382e42006691", + "reference": "31116c4a47b7815cbe25e411a1e0382e42006691", "shasum": "" }, "require": { @@ -2210,9 +2209,9 @@ ], "support": { "issues": "https://github.com/gocardless/gocardless-pro-php/issues", - "source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.15.0" + "source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.16.0" }, - "time": "2021-12-31T15:22:38+00:00" + "time": "2022-04-25T14:24:52+00:00" }, { "name": "google/apiclient", @@ -2287,16 +2286,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.245.0", + "version": "v0.250.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "500a4c056bf1e115142688418fa2f0a12b4dcfd0" + "reference": "3db4c0db2a5452e623b54f06dd993c432e6d6f8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/500a4c056bf1e115142688418fa2f0a12b4dcfd0", - "reference": "500a4c056bf1e115142688418fa2f0a12b4dcfd0", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/3db4c0db2a5452e623b54f06dd993c432e6d6f8c", + "reference": "3db4c0db2a5452e623b54f06dd993c432e6d6f8c", "shasum": "" }, "require": { @@ -2325,9 +2324,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.245.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.250.0" }, - "time": "2022-04-22T18:49:18+00:00" + "time": "2022-05-22T01:16:11+00:00" }, { "name": "google/auth", @@ -3069,16 +3068,16 @@ }, { "name": "intervention/image", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/Intervention/image.git", - "reference": "744ebba495319501b873a4e48787759c72e3fb8c" + "reference": "04be355f8d6734c826045d02a1079ad658322dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/744ebba495319501b873a4e48787759c72e3fb8c", - "reference": "744ebba495319501b873a4e48787759c72e3fb8c", + "url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad", + "reference": "04be355f8d6734c826045d02a1079ad658322dad", "shasum": "" }, "require": { @@ -3121,8 +3120,8 @@ "authors": [ { "name": "Oliver Vogel", - "email": "oliver@olivervogel.com", - "homepage": "http://olivervogel.com/" + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" } ], "description": "Image handling and manipulation library with support for Laravel integration", @@ -3137,11 +3136,11 @@ ], "support": { "issues": "https://github.com/Intervention/image/issues", - "source": "https://github.com/Intervention/image/tree/2.7.1" + "source": "https://github.com/Intervention/image/tree/2.7.2" }, "funding": [ { - "url": "https://www.paypal.me/interventionphp", + "url": "https://paypal.me/interventionio", "type": "custom" }, { @@ -3149,7 +3148,7 @@ "type": "github" } ], - "time": "2021-12-16T16:49:26+00:00" + "time": "2022-05-21T17:30:32+00:00" }, { "name": "invoiceninja/inspector", @@ -3325,16 +3324,16 @@ }, { "name": "laravel/framework", - "version": "v8.83.9", + "version": "v8.83.14", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "ac6e16bb56510eda2e373c6365d5c92da3fd559d" + "reference": "141cf126f1746c7264f59aa78c923a84eaab501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/ac6e16bb56510eda2e373c6365d5c92da3fd559d", - "reference": "ac6e16bb56510eda2e373c6365d5c92da3fd559d", + "url": "https://api.github.com/repos/laravel/framework/zipball/141cf126f1746c7264f59aa78c923a84eaab501e", + "reference": "141cf126f1746c7264f59aa78c923a84eaab501e", "shasum": "" }, "require": { @@ -3494,20 +3493,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-04-19T15:01:38+00:00" + "time": "2022-05-24T14:04:02+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "9e4b005daa20b0c161f3845040046dc9ddc1d74e" + "reference": "09f0e9fb61829f628205b7c94906c28740ff9540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/9e4b005daa20b0c161f3845040046dc9ddc1d74e", - "reference": "9e4b005daa20b0c161f3845040046dc9ddc1d74e", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/09f0e9fb61829f628205b7c94906c28740ff9540", + "reference": "09f0e9fb61829f628205b7c94906c28740ff9540", "shasum": "" }, "require": { @@ -3553,7 +3552,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-02-11T19:23:53+00:00" + "time": "2022-05-16T17:09:47+00:00" }, { "name": "laravel/slack-notification-channel", @@ -3755,16 +3754,16 @@ }, { "name": "laravel/ui", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/laravel/ui.git", - "reference": "f11d295de1508c5bb56206a620b00b6616de414c" + "reference": "65ec5c03f7fee2c8ecae785795b829a15be48c2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/ui/zipball/f11d295de1508c5bb56206a620b00b6616de414c", - "reference": "f11d295de1508c5bb56206a620b00b6616de414c", + "url": "https://api.github.com/repos/laravel/ui/zipball/65ec5c03f7fee2c8ecae785795b829a15be48c2c", + "reference": "65ec5c03f7fee2c8ecae785795b829a15be48c2c", "shasum": "" }, "require": { @@ -3810,22 +3809,22 @@ "ui" ], "support": { - "source": "https://github.com/laravel/ui/tree/v3.4.5" + "source": "https://github.com/laravel/ui/tree/v3.4.6" }, - "time": "2022-02-21T14:59:16+00:00" + "time": "2022-05-20T13:38:08+00:00" }, { "name": "league/commonmark", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955" + "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/32a49eb2b38fe5e5c417ab748a45d0beaab97955", - "reference": "32a49eb2b38fe5e5c417ab748a45d0beaab97955", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/cb36fee279f7fca01d5d9399ddd1b37e48e2eca1", + "reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1", "shasum": "" }, "require": { @@ -3918,7 +3917,7 @@ "type": "tidelift" } ], - "time": "2022-04-07T22:37:05+00:00" + "time": "2022-05-14T15:37:39+00:00" }, { "name": "league/config", @@ -4620,16 +4619,16 @@ }, { "name": "mollie/mollie-api-php", - "version": "v2.42.1", + "version": "v2.44.1", "source": { "type": "git", "url": "https://github.com/mollie/mollie-api-php.git", - "reference": "1ced5854c98af5cffca09b1093156ebdac277285" + "reference": "5906cf9ff3133a4f47fea47624f3839ac07d0805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/1ced5854c98af5cffca09b1093156ebdac277285", - "reference": "1ced5854c98af5cffca09b1093156ebdac277285", + "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/5906cf9ff3133a4f47fea47624f3839ac07d0805", + "reference": "5906cf9ff3133a4f47fea47624f3839ac07d0805", "shasum": "" }, "require": { @@ -4706,9 +4705,9 @@ ], "support": { "issues": "https://github.com/mollie/mollie-api-php/issues", - "source": "https://github.com/mollie/mollie-api-php/tree/v2.42.1" + "source": "https://github.com/mollie/mollie-api-php/tree/v2.44.1" }, - "time": "2022-04-21T11:21:14+00:00" + "time": "2022-05-24T14:03:01+00:00" }, { "name": "moneyphp/money", @@ -4798,16 +4797,16 @@ }, { "name": "monolog/monolog", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4192345e260f1d51b365536199744b987e160edc" + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4192345e260f1d51b365536199744b987e160edc", - "reference": "4192345e260f1d51b365536199744b987e160edc", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", "shasum": "" }, "require": { @@ -4820,18 +4819,23 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", "graylog2/gelf-php": "^1.4.2", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", "php-console/php-console": "^3.1.3", - "phpspec/prophecy": "^1.6.1", + "phpspec/prophecy": "^1.15", "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^8.5.14", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": ">=0.90@dev", - "swiftmailer/swiftmailer": "^5.3|^6.0" + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -4881,7 +4885,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.5.0" + "source": "https://github.com/Seldaek/monolog/tree/2.6.0" }, "funding": [ { @@ -4893,7 +4897,7 @@ "type": "tidelift" } ], - "time": "2022-04-08T15:43:54+00:00" + "time": "2022-05-10T09:36:00+00:00" }, { "name": "mtdowling/jmespath.php", @@ -5031,16 +5035,16 @@ }, { "name": "nesbot/carbon", - "version": "2.57.0", + "version": "2.58.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/97a34af22bde8d0ac20ab34b29d7bfe360902055", + "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055", "shasum": "" }, "require": { @@ -5058,7 +5062,8 @@ "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "phpunit/php-file-iterator": "^2.0.5", + "phpunit/phpunit": "^7.5.20 || ^8.5.23", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -5123,7 +5128,7 @@ "type": "tidelift" } ], - "time": "2022-02-13T18:13:33+00:00" + "time": "2022-04-25T19:31:17+00:00" }, { "name": "nette/schema", @@ -7035,16 +7040,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.2", + "version": "v0.11.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "7f7da640d68b9c9fec819caae7c744a213df6514" + "reference": "05c544b339b112226ad14803e1e5b09a61957454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/7f7da640d68b9c9fec819caae7c744a213df6514", - "reference": "7f7da640d68b9c9fec819caae7c744a213df6514", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/05c544b339b112226ad14803e1e5b09a61957454", + "reference": "05c544b339b112226ad14803e1e5b09a61957454", "shasum": "" }, "require": { @@ -7059,15 +7064,13 @@ "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "3.17.05.02" + "bamarni/composer-bin-plugin": "^1.2" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", "ext-pdo-sqlite": "The doc command requires SQLite to work.", "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." }, "bin": [ "bin/psysh" @@ -7107,9 +7110,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.2" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.4" }, - "time": "2022-02-28T15:28:54+00:00" + "time": "2022-05-06T12:49:14+00:00" }, { "name": "ralouphie/getallheaders", @@ -7334,29 +7337,32 @@ }, { "name": "razorpay/razorpay", - "version": "v2.8.2", + "version": "v2.8.3", "source": { "type": "git", "url": "https://github.com/razorpay/razorpay-php.git", - "reference": "f36ad5ec74522d2930ffad3b160dddc454e42f4d" + "reference": "1ae60f9142f63cb01e6f9b843dd0a3573976fd40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/f36ad5ec74522d2930ffad3b160dddc454e42f4d", - "reference": "f36ad5ec74522d2930ffad3b160dddc454e42f4d", + "url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/1ae60f9142f63cb01e6f9b843dd0a3573976fd40", + "reference": "1ae60f9142f63cb01e6f9b843dd0a3573976fd40", "shasum": "" }, "require": { "ext-json": "*", "php": ">=5.3.0", - "rmccue/requests": "v1.8.0" + "rmccue/requests": "^2.0" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0", + "phpunit/phpunit": "^9", "raveren/kint": "1.*" }, "type": "library", "autoload": { + "files": [ + "Deprecated.php" + ], "psr-4": { "Razorpay\\Api\\": "src/", "Razorpay\\Tests\\": "tests/" @@ -7392,40 +7398,48 @@ "issues": "https://github.com/Razorpay/razorpay-php/issues", "source": "https://github.com/Razorpay/razorpay-php" }, - "time": "2022-03-08T13:36:42+00:00" + "time": "2022-04-29T11:11:00+00:00" }, { "name": "rmccue/requests", - "version": "v1.8.0", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/WordPress/Requests.git", - "reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1" + "reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/afbe4790e4def03581c4a0963a1e8aa01f6030f1", - "reference": "afbe4790e4def03581c4a0963a1e8aa01f6030f1", + "url": "https://api.github.com/repos/WordPress/Requests/zipball/b290dd974051bf1ead51d1947a5a56357e5b80ff", + "reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff", "shasum": "" }, "require": { - "php": ">=5.2" + "ext-json": "*", + "php": ">=5.6" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", + "php-parallel-lint/php-parallel-lint": "^1.3.1", "phpcompatibility/php-compatibility": "^9.0", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5", - "requests/test-server": "dev-master", - "squizlabs/php_codesniffer": "^3.5", - "wp-coding-standards/wpcs": "^2.0" + "requests/test-server": "dev-main", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.6", + "wp-coding-standards/wpcs": "^2.0", + "yoast/phpunit-polyfills": "^1.0.0" }, "type": "library", "autoload": { - "psr-0": { - "Requests": "library/" - } + "files": [ + "library/Deprecated.php" + ], + "psr-4": { + "WpOrg\\Requests\\": "src/" + }, + "classmap": [ + "library/Requests.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -7434,11 +7448,23 @@ "authors": [ { "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" + "homepage": "https://rmccue.io/" + }, + { + "name": "Alain Schlesser", + "homepage": "https://github.com/schlessera" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl" + }, + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/Requests/graphs/contributors" } ], "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/WordPress/Requests", + "homepage": "https://requests.ryanmccue.info/", "keywords": [ "curl", "fsockopen", @@ -7449,10 +7475,11 @@ "sockets" ], "support": { + "docs": "https://requests.ryanmccue.info/", "issues": "https://github.com/WordPress/Requests/issues", - "source": "https://github.com/WordPress/Requests/tree/v1.8.0" + "source": "https://github.com/WordPress/Requests" }, - "time": "2021-04-27T11:05:25+00:00" + "time": "2022-05-10T08:42:27+00:00" }, { "name": "sabre/uri", @@ -7581,21 +7608,21 @@ }, { "name": "sentry/sdk", - "version": "3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php-sdk.git", - "reference": "2de7de3233293f80d1e244bd950adb2121a3731c" + "reference": "6d78bd83b43efbb52f81d6824f4af344fa9ba292" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php-sdk/zipball/2de7de3233293f80d1e244bd950adb2121a3731c", - "reference": "2de7de3233293f80d1e244bd950adb2121a3731c", + "url": "https://api.github.com/repos/getsentry/sentry-php-sdk/zipball/6d78bd83b43efbb52f81d6824f4af344fa9ba292", + "reference": "6d78bd83b43efbb52f81d6824f4af344fa9ba292", "shasum": "" }, "require": { "http-interop/http-factory-guzzle": "^1.0", - "sentry/sentry": "^3.1", + "sentry/sentry": "^3.5", "symfony/http-client": "^4.3|^5.0|^6.0" }, "type": "metapackage", @@ -7621,7 +7648,8 @@ "sentry" ], "support": { - "source": "https://github.com/getsentry/sentry-php-sdk/tree/3.1.1" + "issues": "https://github.com/getsentry/sentry-php-sdk/issues", + "source": "https://github.com/getsentry/sentry-php-sdk/tree/3.2.0" }, "funding": [ { @@ -7633,27 +7661,27 @@ "type": "custom" } ], - "time": "2021-11-30T11:54:41+00:00" + "time": "2022-05-21T11:10:11+00:00" }, { "name": "sentry/sentry", - "version": "3.4.0", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "a92443883df6a55cbe7a062f76949f23dda66772" + "reference": "5b611e3f09035f5ad5edf494443e3236bd5ea482" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/a92443883df6a55cbe7a062f76949f23dda66772", - "reference": "a92443883df6a55cbe7a062f76949f23dda66772", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/5b611e3f09035f5ad5edf494443e3236bd5ea482", + "reference": "5b611e3f09035f5ad5edf494443e3236bd5ea482", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7|^2.0", + "guzzlehttp/psr7": "^1.8.4|^2.1.1", "jean85/pretty-package-versions": "^1.5|^2.0.4", "php": "^7.2|^8.0", "php-http/async-client-implementation": "^1.0", @@ -7692,7 +7720,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4.x-dev" + "dev-master": "3.5.x-dev" } }, "autoload": { @@ -7726,7 +7754,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/3.4.0" + "source": "https://github.com/getsentry/sentry-php/tree/3.5.0" }, "funding": [ { @@ -7738,7 +7766,7 @@ "type": "custom" } ], - "time": "2022-03-13T12:38:01+00:00" + "time": "2022-05-19T07:14:12+00:00" }, { "name": "sentry/sentry-laravel", @@ -8008,16 +8036,16 @@ }, { "name": "stripe/stripe-php", - "version": "v7.125.0", + "version": "v7.128.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "822c00aa380c10c2a3c55d105c5da72ad577b7c4" + "reference": "c704949c49b72985c76cc61063aa26fefbd2724e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/822c00aa380c10c2a3c55d105c5da72ad577b7c4", - "reference": "822c00aa380c10c2a3c55d105c5da72ad577b7c4", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/c704949c49b72985c76cc61063aa26fefbd2724e", + "reference": "c704949c49b72985c76cc61063aa26fefbd2724e", "shasum": "" }, "require": { @@ -8062,9 +8090,9 @@ ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v7.125.0" + "source": "https://github.com/stripe/stripe-php/tree/v7.128.0" }, - "time": "2022-04-21T22:31:37+00:00" + "time": "2022-05-05T17:18:02+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -8144,16 +8172,16 @@ }, { "name": "symfony/console", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6" + "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/900275254f0a1a2afff1ab0e11abd5587a10e1d6", - "reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6", + "url": "https://api.github.com/repos/symfony/console/zipball/ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", + "reference": "ffe3aed36c4d60da2cf1b0a1cee6b8f2e5fa881b", "shasum": "" }, "require": { @@ -8223,7 +8251,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.7" + "source": "https://github.com/symfony/console/tree/v5.4.8" }, "funding": [ { @@ -8239,7 +8267,7 @@ "type": "tidelift" } ], - "time": "2022-03-31T17:09:19+00:00" + "time": "2022-04-12T16:02:29+00:00" }, { "name": "symfony/css-selector", @@ -8376,16 +8404,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "060bc01856a1846e3e4385261bc9ed11a1dd7b6a" + "reference": "c1fcde614dfe99d62a83b796a53b8bad358b266a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/060bc01856a1846e3e4385261bc9ed11a1dd7b6a", - "reference": "060bc01856a1846e3e4385261bc9ed11a1dd7b6a", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c1fcde614dfe99d62a83b796a53b8bad358b266a", + "reference": "c1fcde614dfe99d62a83b796a53b8bad358b266a", "shasum": "" }, "require": { @@ -8427,7 +8455,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.7" + "source": "https://github.com/symfony/error-handler/tree/v5.4.8" }, "funding": [ { @@ -8443,7 +8471,7 @@ "type": "tidelift" } ], - "time": "2022-03-18T16:21:29+00:00" + "time": "2022-04-12T15:48:08+00:00" }, { "name": "symfony/event-dispatcher", @@ -8675,16 +8703,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", "shasum": "" }, "require": { @@ -8718,7 +8746,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.3" + "source": "https://github.com/symfony/finder/tree/v5.4.8" }, "funding": [ { @@ -8734,20 +8762,20 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:34:36+00:00" + "time": "2022-04-15T08:07:45+00:00" }, { "name": "symfony/http-client", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "88b6909f74fd1f2147e068411f71870a3b27ac56" + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/88b6909f74fd1f2147e068411f71870a3b27ac56", - "reference": "88b6909f74fd1f2147e068411f71870a3b27ac56", + "url": "https://api.github.com/repos/symfony/http-client/zipball/0dabec4e3898d3e00451dd47b5ef839168f9bbf5", + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5", "shasum": "" }, "require": { @@ -8805,7 +8833,7 @@ "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v5.4.7" + "source": "https://github.com/symfony/http-client/tree/v5.4.8" }, "funding": [ { @@ -8821,7 +8849,7 @@ "type": "tidelift" } ], - "time": "2022-04-01T12:27:37+00:00" + "time": "2022-04-12T16:02:29+00:00" }, { "name": "symfony/http-client-contracts", @@ -8903,16 +8931,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.4.6", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "34e89bc147633c0f9dd6caaaf56da3b806a21465" + "reference": "ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/34e89bc147633c0f9dd6caaaf56da3b806a21465", - "reference": "34e89bc147633c0f9dd6caaaf56da3b806a21465", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2", + "reference": "ff2818d1c3d49860bcae1f2cbb5eb00fcd3bf9e2", "shasum": "" }, "require": { @@ -8956,7 +8984,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.6" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.8" }, "funding": [ { @@ -8972,20 +9000,20 @@ "type": "tidelift" } ], - "time": "2022-03-05T21:03:43+00:00" + "time": "2022-04-22T08:14:12+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "509243b9b3656db966284c45dffce9316c1ecc5c" + "reference": "cf7e61106abfc19b305ca0aedc41724ced89a02a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/509243b9b3656db966284c45dffce9316c1ecc5c", - "reference": "509243b9b3656db966284c45dffce9316c1ecc5c", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/cf7e61106abfc19b305ca0aedc41724ced89a02a", + "reference": "cf7e61106abfc19b305ca0aedc41724ced89a02a", "shasum": "" }, "require": { @@ -9068,7 +9096,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.7" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.8" }, "funding": [ { @@ -9084,20 +9112,20 @@ "type": "tidelift" } ], - "time": "2022-04-02T06:04:20+00:00" + "time": "2022-04-27T17:22:21+00:00" }, { "name": "symfony/mime", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "92d27a34dea2e199fa9b687e3fff3a7d169b7b1c" + "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/92d27a34dea2e199fa9b687e3fff3a7d169b7b1c", - "reference": "92d27a34dea2e199fa9b687e3fff3a7d169b7b1c", + "url": "https://api.github.com/repos/symfony/mime/zipball/af49bc163ec3272f677bde3bc44c0d766c1fd662", + "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662", "shasum": "" }, "require": { @@ -9151,7 +9179,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.7" + "source": "https://github.com/symfony/mime/tree/v5.4.8" }, "funding": [ { @@ -9167,7 +9195,7 @@ "type": "tidelift" } ], - "time": "2022-03-11T16:08:05+00:00" + "time": "2022-04-12T15:48:08+00:00" }, { "name": "symfony/options-resolver", @@ -10139,16 +10167,16 @@ }, { "name": "symfony/process", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb" + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/38a44b2517b470a436e1c944bf9b9ba3961137fb", - "reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb", + "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", "shasum": "" }, "require": { @@ -10181,7 +10209,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.7" + "source": "https://github.com/symfony/process/tree/v5.4.8" }, "funding": [ { @@ -10197,7 +10225,7 @@ "type": "tidelift" } ], - "time": "2022-03-18T16:18:52+00:00" + "time": "2022-04-08T05:07:18+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -10289,16 +10317,16 @@ }, { "name": "symfony/routing", - "version": "v5.4.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "44b29c7a94e867ccde1da604792f11a469958981" + "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/44b29c7a94e867ccde1da604792f11a469958981", - "reference": "44b29c7a94e867ccde1da604792f11a469958981", + "url": "https://api.github.com/repos/symfony/routing/zipball/e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", + "reference": "e07817bb6244ea33ef5ad31abc4a9288bef3f2f7", "shasum": "" }, "require": { @@ -10359,7 +10387,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.4.3" + "source": "https://github.com/symfony/routing/tree/v5.4.8" }, "funding": [ { @@ -10375,7 +10403,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-04-18T21:45:37+00:00" }, { "name": "symfony/service-contracts", @@ -10462,16 +10490,16 @@ }, { "name": "symfony/string", - "version": "v5.4.3", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" + "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", - "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", + "url": "https://api.github.com/repos/symfony/string/zipball/3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", + "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", "shasum": "" }, "require": { @@ -10528,7 +10556,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.3" + "source": "https://github.com/symfony/string/tree/v5.4.8" }, "funding": [ { @@ -10544,20 +10572,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-04-19T10:40:37+00:00" }, { "name": "symfony/translation", - "version": "v5.4.7", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e1eb790575202ee3ac2659f55b93b05853726f8e" + "reference": "f5c0f6d1f20993b2606f3a5f36b1dc8c1899170b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e1eb790575202ee3ac2659f55b93b05853726f8e", - "reference": "e1eb790575202ee3ac2659f55b93b05853726f8e", + "url": "https://api.github.com/repos/symfony/translation/zipball/f5c0f6d1f20993b2606f3a5f36b1dc8c1899170b", + "reference": "f5c0f6d1f20993b2606f3a5f36b1dc8c1899170b", "shasum": "" }, "require": { @@ -10625,7 +10653,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.7" + "source": "https://github.com/symfony/translation/tree/v5.4.8" }, "funding": [ { @@ -10641,7 +10669,7 @@ "type": "tidelift" } ], - "time": "2022-03-24T17:09:09+00:00" + "time": "2022-04-22T08:14:12+00:00" }, { "name": "symfony/translation-contracts", @@ -10723,16 +10751,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.4.6", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "294e9da6e2e0dd404e983daa5aa74253d92c05d0" + "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/294e9da6e2e0dd404e983daa5aa74253d92c05d0", - "reference": "294e9da6e2e0dd404e983daa5aa74253d92c05d0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cdcadd343d31ad16fc5e006b0de81ea307435053", + "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053", "shasum": "" }, "require": { @@ -10792,7 +10820,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.6" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.8" }, "funding": [ { @@ -10808,7 +10836,7 @@ "type": "tidelift" } ], - "time": "2022-03-02T12:42:23+00:00" + "time": "2022-04-26T13:19:20+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -12536,16 +12564,16 @@ }, { "name": "laravel/dusk", - "version": "v6.23.0", + "version": "v6.24.0", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "98901d49176977c96330fd8c2ca5460eee50a246" + "reference": "7fed3695741787d9998c5f04c94adfd62d70e766" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/98901d49176977c96330fd8c2ca5460eee50a246", - "reference": "98901d49176977c96330fd8c2ca5460eee50a246", + "url": "https://api.github.com/repos/laravel/dusk/zipball/7fed3695741787d9998c5f04c94adfd62d70e766", + "reference": "7fed3695741787d9998c5f04c94adfd62d70e766", "shasum": "" }, "require": { @@ -12603,9 +12631,9 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v6.23.0" + "source": "https://github.com/laravel/dusk/tree/v6.24.0" }, - "time": "2022-04-11T18:55:12+00:00" + "time": "2022-05-09T13:43:52+00:00" }, { "name": "maximebf/debugbar", @@ -13059,16 +13087,16 @@ }, { "name": "php-webdriver/webdriver", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb" + "reference": "b27ddf458d273c7d4602106fcaf978aa0b7fe15a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/99d4856ed7dffcdf6a52eccd6551e83d8d557ceb", - "reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/b27ddf458d273c7d4602106fcaf978aa0b7fe15a", + "reference": "b27ddf458d273c7d4602106fcaf978aa0b7fe15a", "shasum": "" }, "require": { @@ -13118,9 +13146,9 @@ ], "support": { "issues": "https://github.com/php-webdriver/php-webdriver/issues", - "source": "https://github.com/php-webdriver/php-webdriver/tree/1.12.0" + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.12.1" }, - "time": "2021-10-14T09:30:02+00:00" + "time": "2022-05-03T12:16:34+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -14797,16 +14825,16 @@ }, { "name": "symfony/debug", - "version": "v4.4.37", + "version": "v4.4.41", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "5de6c6e7f52b364840e53851c126be4d71e60470" + "reference": "6637e62480b60817b9a6984154a533e8e64c6bd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/5de6c6e7f52b364840e53851c126be4d71e60470", - "reference": "5de6c6e7f52b364840e53851c126be4d71e60470", + "url": "https://api.github.com/repos/symfony/debug/zipball/6637e62480b60817b9a6984154a533e8e64c6bd5", + "reference": "6637e62480b60817b9a6984154a533e8e64c6bd5", "shasum": "" }, "require": { @@ -14845,7 +14873,7 @@ "description": "Provides tools to ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug/tree/v4.4.37" + "source": "https://github.com/symfony/debug/tree/v4.4.41" }, "funding": [ { @@ -14861,7 +14889,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-04-12T15:19:55+00:00" }, { "name": "symfony/polyfill-php70", @@ -15120,16 +15148,16 @@ }, { "name": "zircote/swagger-php", - "version": "3.3.4", + "version": "3.3.6", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "7313ff7d1991d00e52d0e852087693d4482df631" + "reference": "5016342f966fca29dda84455de066c5c90d37941" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7313ff7d1991d00e52d0e852087693d4482df631", - "reference": "7313ff7d1991d00e52d0e852087693d4482df631", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/5016342f966fca29dda84455de066c5c90d37941", + "reference": "5016342f966fca29dda84455de066c5c90d37941", "shasum": "" }, "require": { @@ -15187,9 +15215,9 @@ ], "support": { "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/3.3.4" + "source": "https://github.com/zircote/swagger-php/tree/3.3.6" }, - "time": "2022-02-22T21:09:06+00:00" + "time": "2022-05-21T01:52:14+00:00" } ], "aliases": [], From 51455cacef95d9d53c3f7b9db5981745df90f9a4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 25 May 2022 16:34:43 +1000 Subject: [PATCH 3/6] Page numbering for PDFs --- app/Console/Commands/CheckData.php | 46 +++++++++++++++++++++- app/DataMapper/CompanySettings.php | 4 ++ app/Jobs/Entity/CreateEntityPdf.php | 21 +++++++--- app/Jobs/Util/PreviewPdf.php | 9 ++++- app/Models/Company.php | 7 ++++ app/Utils/Traits/Pdf/PDF.php | 32 ++++++++++++---- app/Utils/Traits/Pdf/PageNumbering.php | 53 ++++++++++++++------------ app/Utils/Traits/Pdf/PdfMaker.php | 1 - 8 files changed, 133 insertions(+), 40 deletions(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index a57375b47612..b1d2bd5bc02f 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -74,7 +74,7 @@ class CheckData extends Command /** * @var string */ - protected $signature = 'ninja:check-data {--database=} {--fix=} {--client_id=} {--vendor_id=} {--paid_to_date=} {--client_balance=} {--ledger_balance=}'; + protected $signature = 'ninja:check-data {--database=} {--fix=} {--client_id=} {--vendor_id=} {--paid_to_date=} {--client_balance=} {--ledger_balance=} {--balance_status=}'; /** * @var string @@ -89,6 +89,9 @@ class CheckData extends Command protected $wrong_balances = 0; + protected $wrong_paid_status = 0; + + public function handle() { $time_start = microtime(true); @@ -109,6 +112,7 @@ class CheckData extends Command $this->checkVendorContacts(); $this->checkEntityInvitations(); $this->checkCompanyData(); + $this->checkBalanceVsPaidStatus(); if(Ninja::isHosted()) $this->checkAccountStatuses(); @@ -856,4 +860,44 @@ class CheckData extends Command }); } + public function checkBalanceVsPaidStatus() + { + $this->wrong_paid_status = 0; + + foreach(Invoice::with(['payments'])->whereHas('payments')->where('status_id', 4)->where('balance', '>', 0)->where('is_deleted',0)->cursor() as $invoice) + { + + $this->logMessage("# {$invoice->id} " . ' - '.$invoice->number." - Marked as paid, but balance = {$invoice->balance}"); + + if($this->option('balance_status')){ + + $val = $invoice->balance; + + $invoice->balance = 0; + $invoice->paid_to_date=$val; + $invoice->save(); + + $p = $invoice->payments->first(); + + if($p && (int)$p->amount == 0) + { + $p->amount = $val; + $p->applied = $val; + $p->save(); + + $pivot = $p->paymentables->first(); + $pivot->amount = $val; + $pivot->save(); + } + + + $this->logMessage("Fixing {$invoice->id} settings payment to {$val}"); + + } + + } + + $this->logMessage($this->wrong_paid_status." wrong invoices with bad balance state"); + + } } \ No newline at end of file diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index eef7c3f41555..b253b9397f99 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -249,6 +249,9 @@ class CompanySettings extends BaseSettings public $primary_color = '#298AAB'; public $secondary_color = '#7081e0'; + public $page_numbering = false; + public $page_numbering_alignment = 'C'; //C,R,L + public $hide_paid_to_date = false; //@TODO where? public $embed_documents = false; //@TODO where? public $all_pages_header = false; //@deprecated 31-05-2021 @@ -274,6 +277,7 @@ class CompanySettings extends BaseSettings public $auto_archive_invoice_cancelled = false; public static $casts = [ + 'page_numbering' => 'bool', 'auto_archive_invoice_cancelled' => 'bool', 'email_from_name' => 'string', 'show_all_tasks_client_portal' => 'string', diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index ba7bfb75dd50..54bba3c058b7 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -34,6 +34,8 @@ use App\Utils\PhantomJS\Phantom; use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesInvoiceHtml; use App\Utils\Traits\NumberFormatter; +use App\Utils\Traits\Pdf\PageNumbering; +use App\Utils\Traits\Pdf\PDF; use App\Utils\Traits\Pdf\PdfMaker; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -43,10 +45,11 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Lang; use Illuminate\Support\Facades\Storage; +use setasign\Fpdi\PdfParser\StreamReader; class CreateEntityPdf implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash; + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, NumberFormatter, MakesInvoiceHtml, PdfMaker, MakesHash, PageNumbering; public $entity; @@ -102,6 +105,7 @@ class CreateEntityPdf implements ShouldQueue public function handle() { + MultiDB::setDb($this->company->db); /* Forget the singleton*/ @@ -186,9 +190,15 @@ class CreateEntityPdf implements ShouldQueue if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){ $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); + $pdf = $this->pageNumbering($pdf, $this->company); + } else { + $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); + + $pdf = $this->pageNumbering($pdf, $this->company); + } } catch (\Exception $e) { @@ -203,10 +213,10 @@ class CreateEntityPdf implements ShouldQueue try{ - if(!Storage::disk($this->disk)->exists($path)) - + if(!Storage::disk($this->disk)->exists($path)) Storage::disk($this->disk)->makeDirectory($path, 0775); - Storage::disk($this->disk)->put($file_path, $pdf, 'public'); + + Storage::disk($this->disk)->put($file_path, $pdf, 'public'); } catch(\Exception $e) @@ -216,7 +226,7 @@ class CreateEntityPdf implements ShouldQueue } } - + return $file_path; } @@ -225,4 +235,5 @@ class CreateEntityPdf implements ShouldQueue } + } diff --git a/app/Jobs/Util/PreviewPdf.php b/app/Jobs/Util/PreviewPdf.php index 3a5b23f7ce0d..fda53302cd19 100644 --- a/app/Jobs/Util/PreviewPdf.php +++ b/app/Jobs/Util/PreviewPdf.php @@ -12,6 +12,7 @@ namespace App\Jobs\Util; use App\Models\Company; +use App\Utils\Traits\Pdf\PageNumbering; use App\Utils\Traits\Pdf\PdfMaker; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -21,7 +22,7 @@ use Illuminate\Queue\SerializesModels; class PreviewPdf implements ShouldQueue { - use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, PdfMaker; + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, PdfMaker, PageNumbering; public $company; @@ -46,6 +47,10 @@ class PreviewPdf implements ShouldQueue public function handle() { - return $this->makePdf(null, null, $this->design_string); + $pdf = $this->makePdf(null, null, $this->design_string); + + $pdf = $this->pageNumbering($pdf, $this->company); + + return $pdf; } } diff --git a/app/Models/Company.php b/app/Models/Company.php index 40300ae8972b..8a08e6f6bb37 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -11,6 +11,7 @@ namespace App\Models; +use App\DataMapper\CompanySettings; use App\Models\Language; use App\Models\Presenters\CompanyPresenter; use App\Models\User; @@ -402,6 +403,12 @@ class Company extends BaseModel return $this->settings->{$setting}; } + $cs = CompanySettings::defaults(); + + if (property_exists($cs, $setting) != false) { + return $cs->{$setting}; + } + return null; } diff --git a/app/Utils/Traits/Pdf/PDF.php b/app/Utils/Traits/Pdf/PDF.php index 9e1e505d96ee..3e966b2c440d 100644 --- a/app/Utils/Traits/Pdf/PDF.php +++ b/app/Utils/Traits/Pdf/PDF.php @@ -1,4 +1,13 @@ SetY(-7); - // $this->SetX(-50); $this->SetXY(0, -5); - // Arial italic 8 - $this->SetFont('Arial','I',8); - // Page number - $this->Cell(0,5, ctrans('texts.page').' '.$this->PageNo().'/{nb}',0,0,'C'); + $this->SetFont('Arial','I',9); + + $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']); + + $this->Cell(0,5, $trans ,0,0, $this->text_alignment); + } + + public function setAlignment($alignment) + { + $this->text_alignment = $alignment; + + return $this; + } + } \ No newline at end of file diff --git a/app/Utils/Traits/Pdf/PageNumbering.php b/app/Utils/Traits/Pdf/PageNumbering.php index e012675c25bd..571853c2017d 100644 --- a/app/Utils/Traits/Pdf/PageNumbering.php +++ b/app/Utils/Traits/Pdf/PageNumbering.php @@ -1,5 +1,4 @@ setSourceFile(StreamReader::createByString($pdf_data_object)); + try + { + $pdf = new PDF(); - $pdf->AliasNbPages(); - for ($i=1; $i <= $pageCount; $i++) { - //import a page then get the id and will be used in the template - $tplId = $pdf->importPage($i); + $pdf->setAlignment($company->getSetting('page_numbering_alignment')); - //create a page - $templateSize = $pdf->getTemplateSize($tplId); - $pdf->AddPage('', [$templateSize['width'], $templateSize['height']]); + $pageCount = $pdf->setSourceFile(StreamReader::createByString($pdf_data_object)); - $pdf->useTemplate($tplId); - } - - - return $pdf->Output(); + $pdf->AliasNbPages(); - } + for ($i=1; $i <= $pageCount; $i++) { + //import a page then get the id and will be used in the template + $tplId = $pdf->importPage($i); -} \ No newline at end of file + //create a page + $templateSize = $pdf->getTemplateSize($tplId); + + $pdf->AddPage($templateSize['orientation'], [$templateSize['width'], $templateSize['height']]); + + $pdf->useTemplate($tplId); + } + + ob_end_flush(); + return $pdf->Output(); + + } + catch(\Exception $e) { + nlog($e->getMessage()); + + } + } +} diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index 7c33990b48e5..f888e66b847f 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -46,7 +46,6 @@ trait PdfMaker if($generated) return $generated; - throw new InternalPDFFailure('There was an issue generating the PDF locally'); } } From a2977ef1adb3de4352fddf72f6d3ef35b4c69b5a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 25 May 2022 20:53:12 +1000 Subject: [PATCH 4/6] minor fixes for self updater --- app/DataMapper/CompanySettings.php | 1 + app/Http/Controllers/SelfUpdateController.php | 16 ++++++++++++---- app/Jobs/Entity/CreateEntityPdf.php | 1 + app/Utils/Traits/Pdf/PDF.php | 6 ++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index b253b9397f99..a3d272a5c410 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -277,6 +277,7 @@ class CompanySettings extends BaseSettings public $auto_archive_invoice_cancelled = false; public static $casts = [ + 'page_numbering_alignment' => 'string', 'page_numbering' => 'bool', 'auto_archive_invoice_cancelled' => 'bool', 'email_from_name' => 'string', diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 6c53ead3b902..c220c1f0400a 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -134,13 +134,21 @@ class SelfUpdateController extends BaseController nlog("Extracting zip"); - $zipFile = new \PhpZip\ZipFile(); + // $zipFile = new \PhpZip\ZipFile(); - $zipFile->openFile($file); + // $zipFile->openFile($file); - $zipFile->extractTo(base_path()); + // $zipFile->extractTo(base_path()); - $zipFile->close(); + // $zipFile->close(); + + $zip = new \ZipArchive; + + $res = $zip->open($file); + if ($res === TRUE) { + $zip->extractTo(base_path()); + $zip->close(); + } nlog("Finished extracting files"); diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index 54bba3c058b7..2383ee735ec5 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -190,6 +190,7 @@ class CreateEntityPdf implements ShouldQueue if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){ $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); + $pdf = $this->pageNumbering($pdf, $this->company); } diff --git a/app/Utils/Traits/Pdf/PDF.php b/app/Utils/Traits/Pdf/PDF.php index 3e966b2c440d..56bfbff87e0d 100644 --- a/app/Utils/Traits/Pdf/PDF.php +++ b/app/Utils/Traits/Pdf/PDF.php @@ -23,7 +23,8 @@ class PDF extends FPDI $this->SetXY(0, -5); - $this->SetFont('Arial','I',9); + $this->SetFont('Arial','I', 9); + $this->SetTextColor(135,135,135); $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']); @@ -33,7 +34,8 @@ class PDF extends FPDI public function setAlignment($alignment) { - $this->text_alignment = $alignment; + if(in_array($alignment, ['C','L','R'])) + $this->text_alignment = $alignment; return $this; } From b6f48c0d8ce0d41e73f2b245a3ab68da57e147a3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 25 May 2022 22:00:17 +1000 Subject: [PATCH 5/6] Page numbering for PDFs --- app/Http/Controllers/ActivityController.php | 26 ++++++++++++++++++- .../ClientPortal/InvitationController.php | 1 - app/Jobs/Entity/CreateEntityPdf.php | 13 +++++++--- app/Jobs/Entity/CreateRawPdf.php | 15 +++++++++-- app/Jobs/Util/PreviewPdf.php | 5 +++- app/Listeners/Payment/PaymentNotification.php | 3 +++ app/Utils/PhantomJS/Phantom.php | 9 ++++++- app/Utils/Traits/Pdf/PDF.php | 3 --- app/Utils/Traits/Pdf/PageNumbering.php | 10 ++++--- 9 files changed, 69 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 752f9a366fcc..01c432465659 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -17,6 +17,7 @@ use App\Transformers\ActivityTransformer; use App\Utils\HostedPDF\NinjaPdf; use App\Utils\Ninja; use App\Utils\PhantomJS\Phantom; +use App\Utils\Traits\Pdf\PageNumbering; use App\Utils\Traits\Pdf\PdfMaker; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -27,7 +28,7 @@ use stdClass; class ActivityController extends BaseController { - use PdfMaker; + use PdfMaker, PageNumbering; protected $entity_type = Activity::class; @@ -164,12 +165,35 @@ class ActivityController extends BaseController if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') { $pdf = (new Phantom)->convertHtmlToPdf($html_backup); + + $numbered_pdf = $this->pageNumbering($pdf, $activity->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + + } elseif(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){ $pdf = (new NinjaPdf())->build($html_backup); + + $numbered_pdf = $this->pageNumbering($pdf, $activity->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + + + } else { $pdf = $this->makePdf(null, null, $html_backup); + + $numbered_pdf = $this->pageNumbering($pdf, $activity->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + + + } if (isset($activity->invoice_id)) { diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index f15b1beb8704..199497ccd7df 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -191,7 +191,6 @@ class InvitationController extends Controller return response()->json(["message" => "no record found"], 400); $file_name = $invitation->{$entity}->numberFormatter().'.pdf'; - nlog($file_name); $file = CreateRawPdf::dispatchNow($invitation, $invitation->company->db); diff --git a/app/Jobs/Entity/CreateEntityPdf.php b/app/Jobs/Entity/CreateEntityPdf.php index 2383ee735ec5..a0821fab9773 100644 --- a/app/Jobs/Entity/CreateEntityPdf.php +++ b/app/Jobs/Entity/CreateEntityPdf.php @@ -190,15 +190,22 @@ class CreateEntityPdf implements ShouldQueue if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){ $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); - - $pdf = $this->pageNumbering($pdf, $this->company); + + $numbered_pdf = $this->pageNumbering($pdf, $this->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; } else { $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); - $pdf = $this->pageNumbering($pdf, $this->company); + $numbered_pdf = $this->pageNumbering($pdf, $this->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + } diff --git a/app/Jobs/Entity/CreateRawPdf.php b/app/Jobs/Entity/CreateRawPdf.php index cc822255c3eb..a67eeecaef2b 100644 --- a/app/Jobs/Entity/CreateRawPdf.php +++ b/app/Jobs/Entity/CreateRawPdf.php @@ -1,5 +1,4 @@ buffer($pdf) != 'application/pdf; charset=binary') { $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); + + $numbered_pdf = $this->pageNumbering($pdf, $this->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + } } else { $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); + + $numbered_pdf = $this->pageNumbering($pdf, $this->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; } } catch (\Exception $e) { diff --git a/app/Jobs/Util/PreviewPdf.php b/app/Jobs/Util/PreviewPdf.php index fda53302cd19..f681d51b7264 100644 --- a/app/Jobs/Util/PreviewPdf.php +++ b/app/Jobs/Util/PreviewPdf.php @@ -49,8 +49,11 @@ class PreviewPdf implements ShouldQueue { $pdf = $this->makePdf(null, null, $this->design_string); - $pdf = $this->pageNumbering($pdf, $this->company); + $numbered_pdf = $this->pageNumbering($pdf, $this->company); + if($numbered_pdf) + $pdf = $numbered_pdf; + return $pdf; } } diff --git a/app/Listeners/Payment/PaymentNotification.php b/app/Listeners/Payment/PaymentNotification.php index 8ce34c221f4f..652106158926 100644 --- a/app/Listeners/Payment/PaymentNotification.php +++ b/app/Listeners/Payment/PaymentNotification.php @@ -92,6 +92,9 @@ class PaymentNotification implements ShouldQueue $analytics_id = $company->google_analytics_key; + if(!strlen($analytics_id) > 2) + return; + $client = $payment->client; $amount = $payment->amount; diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index d563a5ac37c2..87addb599ee3 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -25,6 +25,7 @@ use App\Services\PdfMaker\PdfMaker as PdfMakerService; use App\Utils\CurlUtils; use App\Utils\HtmlEngine; use App\Utils\Traits\MakesHash; +use App\Utils\Traits\Pdf\PageNumbering; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Storage; @@ -33,7 +34,7 @@ use Illuminate\Support\Str; class Phantom { - use MakesHash; + use MakesHash, PageNumbering; /** * Generate a PDF from the @@ -99,6 +100,12 @@ class Phantom $this->checkMime($pdf, $invitation, $entity); + $numbered_pdf = $this->pageNumbering($pdf, $invitation->company); + + if($numbered_pdf) + $pdf = $numbered_pdf; + + if(!Storage::disk(config('filesystems.default'))->exists($path)) Storage::disk(config('filesystems.default'))->makeDirectory($path, 0775); diff --git a/app/Utils/Traits/Pdf/PDF.php b/app/Utils/Traits/Pdf/PDF.php index 56bfbff87e0d..f0a87ae5c970 100644 --- a/app/Utils/Traits/Pdf/PDF.php +++ b/app/Utils/Traits/Pdf/PDF.php @@ -20,14 +20,11 @@ class PDF extends FPDI function Footer() { - $this->SetXY(0, -5); - $this->SetFont('Arial','I', 9); $this->SetTextColor(135,135,135); $trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']); - $this->Cell(0,5, $trans ,0,0, $this->text_alignment); } diff --git a/app/Utils/Traits/Pdf/PageNumbering.php b/app/Utils/Traits/Pdf/PageNumbering.php index 571853c2017d..8b3ac3c2b7db 100644 --- a/app/Utils/Traits/Pdf/PageNumbering.php +++ b/app/Utils/Traits/Pdf/PageNumbering.php @@ -17,7 +17,10 @@ trait PageNumbering { private function pageNumbering($pdf_data_object, $company) { - + + // if(!$company->settings->page_numbering) + // return $pdf_data_object; + try { $pdf = new PDF(); @@ -39,9 +42,8 @@ trait PageNumbering $pdf->useTemplate($tplId); } - - ob_end_flush(); - return $pdf->Output(); + + return $pdf->Output('S'); } catch(\Exception $e) { From a6fea388ad50bc684cc13fed73de78421bd76062 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 26 May 2022 11:13:46 +1000 Subject: [PATCH 6/6] Enable page numbering logic --- app/Utils/Traits/Pdf/PageNumbering.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Utils/Traits/Pdf/PageNumbering.php b/app/Utils/Traits/Pdf/PageNumbering.php index 8b3ac3c2b7db..357a28778df3 100644 --- a/app/Utils/Traits/Pdf/PageNumbering.php +++ b/app/Utils/Traits/Pdf/PageNumbering.php @@ -18,8 +18,8 @@ trait PageNumbering private function pageNumbering($pdf_data_object, $company) { - // if(!$company->settings->page_numbering) - // return $pdf_data_object; + if(!$company->settings->page_numbering) + return $pdf_data_object; try {