From c2c835faca407b8e11c6bbaaa3c475f19d28bab6 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Tue, 22 Apr 2025 23:48:43 +0200 Subject: [PATCH] Add initial files and templates for ps_emailalerts module - Created LICENSE file for composer dependencies. - Added autoload files: autoload_classmap.php, autoload_namespaces.php, autoload_psr4.php, autoload_real.php, and autoload_static.php. - Initialized installed.json for composer. - Added index.php and form templates for admin configuration. - Implemented front-end templates for email alerts, including account management and product notifications. - Included necessary headers and copyright notices in all new files. --- .vscode/ftp-kr.sync.cache.json | 16 +- modules/ps_cashondelivery/LICENSE.md | 47 + modules/ps_cashondelivery/README.md | 24 + modules/ps_cashondelivery/composer.json | 40 + modules/ps_cashondelivery/composer.lock | 1442 +++++++++ modules/ps_cashondelivery/config.xml | 11 + modules/ps_cashondelivery/config_pl.xml | 12 + .../controllers/front/index.php | 28 + .../controllers/front/validation.php | 131 + .../ps_cashondelivery/controllers/index.php | 28 + modules/ps_cashondelivery/index.php | 28 + modules/ps_cashondelivery/logo.png | Bin 0 -> 8755 bytes modules/ps_cashondelivery/logo.webp | Bin 0 -> 716 bytes .../ps_cashondelivery/ps_cashondelivery.php | 297 ++ modules/ps_cashondelivery/tests/index.php | 35 + modules/ps_cashondelivery/tests/phpstan.sh | 28 + .../ps_cashondelivery/tests/phpstan/index.php | 35 + .../tests/phpstan/phpstan-1.7.6.neon | 12 + .../tests/phpstan/phpstan-1.7.7.neon | 8 + .../tests/phpstan/phpstan-1.7.8.neon | 6 + .../tests/phpstan/phpstan-latest.neon | 6 + .../tests/phpstan/phpstan.neon | 12 + .../ps_cashondelivery/translations/index.php | 28 + modules/ps_cashondelivery/translations/pl.php | 0 modules/ps_cashondelivery/upgrade/index.php | 28 + .../upgrade/upgrade-1.0.7.php | 40 + .../upgrade/upgrade-2.0.0.php | 57 + modules/ps_cashondelivery/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 445 +++ .../ps_cashondelivery/vendor/composer/LICENSE | 21 + .../vendor/composer/autoload_classmap.php | 11 + .../vendor/composer/autoload_namespaces.php | 9 + .../vendor/composer/autoload_psr4.php | 9 + .../vendor/composer/autoload_real.php | 43 + .../vendor/composer/autoload_static.php | 21 + .../vendor/composer/installed.json | 1 + modules/ps_cashondelivery/views/img/index.php | 28 + .../img/orderstate/PS_OS_COD_VALIDATION.gif | Bin 0 -> 1028 bytes .../views/img/orderstate/index.php | 28 + modules/ps_cashondelivery/views/index.php | 28 + .../hook/displayOrderConfirmation.tpl | 25 + .../views/templates/hook/index.php | 28 + .../paymentOptions-additionalInformation.tpl | 22 + .../views/templates/hook/payment_return.tpl | 32 + .../hook/ps_cashondelivery_intro.tpl | 30 + .../views/templates/index.php | 28 + modules/ps_emailalerts/CONTRIBUTORS.md | 11 + modules/ps_emailalerts/LICENSE.md | 47 + modules/ps_emailalerts/MailAlert.php | 318 ++ modules/ps_emailalerts/README.md | 39 + modules/ps_emailalerts/composer.json | 25 + modules/ps_emailalerts/composer.lock | 2694 +++++++++++++++++ modules/ps_emailalerts/config.xml | 13 + modules/ps_emailalerts/config_pl.xml | 12 + .../controllers/front/account.php | 63 + .../controllers/front/actions.php | 175 ++ .../controllers/front/index.php | 28 + modules/ps_emailalerts/controllers/index.php | 28 + modules/ps_emailalerts/index.php | 28 + .../ps_emailalerts/js/admin/ps_emailalerts.js | 46 + modules/ps_emailalerts/js/index.php | 28 + modules/ps_emailalerts/js/mailalerts.js | 97 + modules/ps_emailalerts/logo.png | Bin 0 -> 4942 bytes modules/ps_emailalerts/logo.webp | Bin 0 -> 1568 bytes modules/ps_emailalerts/mailalerts-account.php | 67 + modules/ps_emailalerts/mailalerts-ajax.php | 27 + modules/ps_emailalerts/mailalerts-extra.php | 119 + .../ps_emailalerts/mails/en/customer_qty.html | 115 + .../ps_emailalerts/mails/en/customer_qty.txt | 15 + modules/ps_emailalerts/mails/en/index.php | 28 + .../ps_emailalerts/mails/en/new_order.html | 401 +++ modules/ps_emailalerts/mails/en/new_order.txt | 59 + .../mails/en/order_changed.html | 130 + .../ps_emailalerts/mails/en/order_changed.txt | 21 + .../mails/en/productcoverage.html | 115 + .../mails/en/productcoverage.txt | 13 + .../mails/en/productoutofstock.html | 115 + .../mails/en/productoutofstock.txt | 16 + .../ps_emailalerts/mails/en/return_slip.html | 169 ++ .../ps_emailalerts/mails/en/return_slip.txt | 36 + modules/ps_emailalerts/mails/index.php | 28 + .../ps_emailalerts/mails/sk/customer_qty.html | 115 + .../ps_emailalerts/mails/sk/customer_qty.txt | 15 + .../ps_emailalerts/mails/sk/new_order.html | 401 +++ modules/ps_emailalerts/mails/sk/new_order.txt | 59 + .../mails/sk/order_changed.html | 132 + .../ps_emailalerts/mails/sk/order_changed.txt | 20 + .../mails/sk/productcoverage.html | 115 + .../mails/sk/productcoverage.txt | 13 + .../mails/sk/productoutofstock.html | 115 + .../mails/sk/productoutofstock.txt | 16 + .../ps_emailalerts/mails/sk/return_slip.html | 169 ++ .../ps_emailalerts/mails/sk/return_slip.txt | 37 + modules/ps_emailalerts/ps_emailalerts.php | 1339 ++++++++ modules/ps_emailalerts/tests/php/phpstan.sh | 28 + .../tests/php/phpstan/phpstan-1.7.6.neon | 9 + .../tests/php/phpstan/phpstan-1.7.7.neon | 7 + .../tests/php/phpstan/phpstan-1.7.8.neon | 7 + .../tests/php/phpstan/phpstan-8.0.neon | 7 + .../tests/php/phpstan/phpstan-latest.neon | 7 + .../tests/php/phpstan/phpstan.neon | 14 + modules/ps_emailalerts/translations/index.php | 28 + modules/ps_emailalerts/translations/pl.php | 0 modules/ps_emailalerts/upgrade/index.php | 28 + .../ps_emailalerts/upgrade/install-2.1.0.php | 29 + .../ps_emailalerts/upgrade/install-2.3.4.php | 27 + .../ps_emailalerts/upgrade/upgrade-2.3.1.php | 28 + .../ps_emailalerts/upgrade/upgrade-2.3.3.php | 28 + .../ps_emailalerts/upgrade/upgrade-2.4.0.php | 51 + .../ps_emailalerts/upgrade/upgrade-2.4.1.php | 27 + modules/ps_emailalerts/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 445 +++ .../ps_emailalerts/vendor/composer/LICENSE | 21 + .../vendor/composer/autoload_classmap.php | 9 + .../vendor/composer/autoload_namespaces.php | 9 + .../vendor/composer/autoload_psr4.php | 9 + .../vendor/composer/autoload_real.php | 43 + .../vendor/composer/autoload_static.php | 15 + .../vendor/composer/installed.json | 1 + modules/ps_emailalerts/views/index.php | 28 + .../admin/_configure/helpers/form/form.tpl | 68 + .../admin/_configure/helpers/form/index.php | 28 + .../admin/_configure/helpers/index.php | 28 + .../templates/admin/_configure/index.php | 28 + .../views/templates/admin/index.php | 28 + .../views/templates/front/index.php | 28 + .../front/mailalerts-account-line.tpl | 34 + .../templates/front/mailalerts-account.tpl | 35 + .../views/templates/hook/index.php | 28 + .../templates/hook/my-account-footer.tpl | 22 + .../views/templates/hook/my-account.tpl | 22 + .../views/templates/hook/product.tpl | 44 + .../ps_emailalerts/views/templates/index.php | 28 + 133 files changed, 12218 insertions(+), 2 deletions(-) create mode 100644 modules/ps_cashondelivery/LICENSE.md create mode 100644 modules/ps_cashondelivery/README.md create mode 100644 modules/ps_cashondelivery/composer.json create mode 100644 modules/ps_cashondelivery/composer.lock create mode 100644 modules/ps_cashondelivery/config.xml create mode 100644 modules/ps_cashondelivery/config_pl.xml create mode 100644 modules/ps_cashondelivery/controllers/front/index.php create mode 100644 modules/ps_cashondelivery/controllers/front/validation.php create mode 100644 modules/ps_cashondelivery/controllers/index.php create mode 100644 modules/ps_cashondelivery/index.php create mode 100644 modules/ps_cashondelivery/logo.png create mode 100644 modules/ps_cashondelivery/logo.webp create mode 100644 modules/ps_cashondelivery/ps_cashondelivery.php create mode 100644 modules/ps_cashondelivery/tests/index.php create mode 100644 modules/ps_cashondelivery/tests/phpstan.sh create mode 100644 modules/ps_cashondelivery/tests/phpstan/index.php create mode 100644 modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.6.neon create mode 100644 modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.7.neon create mode 100644 modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.8.neon create mode 100644 modules/ps_cashondelivery/tests/phpstan/phpstan-latest.neon create mode 100644 modules/ps_cashondelivery/tests/phpstan/phpstan.neon create mode 100644 modules/ps_cashondelivery/translations/index.php create mode 100644 modules/ps_cashondelivery/translations/pl.php create mode 100644 modules/ps_cashondelivery/upgrade/index.php create mode 100644 modules/ps_cashondelivery/upgrade/upgrade-1.0.7.php create mode 100644 modules/ps_cashondelivery/upgrade/upgrade-2.0.0.php create mode 100644 modules/ps_cashondelivery/vendor/autoload.php create mode 100644 modules/ps_cashondelivery/vendor/composer/ClassLoader.php create mode 100644 modules/ps_cashondelivery/vendor/composer/LICENSE create mode 100644 modules/ps_cashondelivery/vendor/composer/autoload_classmap.php create mode 100644 modules/ps_cashondelivery/vendor/composer/autoload_namespaces.php create mode 100644 modules/ps_cashondelivery/vendor/composer/autoload_psr4.php create mode 100644 modules/ps_cashondelivery/vendor/composer/autoload_real.php create mode 100644 modules/ps_cashondelivery/vendor/composer/autoload_static.php create mode 100644 modules/ps_cashondelivery/vendor/composer/installed.json create mode 100644 modules/ps_cashondelivery/views/img/index.php create mode 100644 modules/ps_cashondelivery/views/img/orderstate/PS_OS_COD_VALIDATION.gif create mode 100644 modules/ps_cashondelivery/views/img/orderstate/index.php create mode 100644 modules/ps_cashondelivery/views/index.php create mode 100644 modules/ps_cashondelivery/views/templates/hook/displayOrderConfirmation.tpl create mode 100644 modules/ps_cashondelivery/views/templates/hook/index.php create mode 100644 modules/ps_cashondelivery/views/templates/hook/paymentOptions-additionalInformation.tpl create mode 100644 modules/ps_cashondelivery/views/templates/hook/payment_return.tpl create mode 100644 modules/ps_cashondelivery/views/templates/hook/ps_cashondelivery_intro.tpl create mode 100644 modules/ps_cashondelivery/views/templates/index.php create mode 100644 modules/ps_emailalerts/CONTRIBUTORS.md create mode 100644 modules/ps_emailalerts/LICENSE.md create mode 100644 modules/ps_emailalerts/MailAlert.php create mode 100644 modules/ps_emailalerts/README.md create mode 100644 modules/ps_emailalerts/composer.json create mode 100644 modules/ps_emailalerts/composer.lock create mode 100644 modules/ps_emailalerts/config.xml create mode 100644 modules/ps_emailalerts/config_pl.xml create mode 100644 modules/ps_emailalerts/controllers/front/account.php create mode 100644 modules/ps_emailalerts/controllers/front/actions.php create mode 100644 modules/ps_emailalerts/controllers/front/index.php create mode 100644 modules/ps_emailalerts/controllers/index.php create mode 100644 modules/ps_emailalerts/index.php create mode 100644 modules/ps_emailalerts/js/admin/ps_emailalerts.js create mode 100644 modules/ps_emailalerts/js/index.php create mode 100644 modules/ps_emailalerts/js/mailalerts.js create mode 100644 modules/ps_emailalerts/logo.png create mode 100644 modules/ps_emailalerts/logo.webp create mode 100644 modules/ps_emailalerts/mailalerts-account.php create mode 100644 modules/ps_emailalerts/mailalerts-ajax.php create mode 100644 modules/ps_emailalerts/mailalerts-extra.php create mode 100644 modules/ps_emailalerts/mails/en/customer_qty.html create mode 100644 modules/ps_emailalerts/mails/en/customer_qty.txt create mode 100644 modules/ps_emailalerts/mails/en/index.php create mode 100644 modules/ps_emailalerts/mails/en/new_order.html create mode 100644 modules/ps_emailalerts/mails/en/new_order.txt create mode 100644 modules/ps_emailalerts/mails/en/order_changed.html create mode 100644 modules/ps_emailalerts/mails/en/order_changed.txt create mode 100644 modules/ps_emailalerts/mails/en/productcoverage.html create mode 100644 modules/ps_emailalerts/mails/en/productcoverage.txt create mode 100644 modules/ps_emailalerts/mails/en/productoutofstock.html create mode 100644 modules/ps_emailalerts/mails/en/productoutofstock.txt create mode 100644 modules/ps_emailalerts/mails/en/return_slip.html create mode 100644 modules/ps_emailalerts/mails/en/return_slip.txt create mode 100644 modules/ps_emailalerts/mails/index.php create mode 100644 modules/ps_emailalerts/mails/sk/customer_qty.html create mode 100644 modules/ps_emailalerts/mails/sk/customer_qty.txt create mode 100644 modules/ps_emailalerts/mails/sk/new_order.html create mode 100644 modules/ps_emailalerts/mails/sk/new_order.txt create mode 100644 modules/ps_emailalerts/mails/sk/order_changed.html create mode 100644 modules/ps_emailalerts/mails/sk/order_changed.txt create mode 100644 modules/ps_emailalerts/mails/sk/productcoverage.html create mode 100644 modules/ps_emailalerts/mails/sk/productcoverage.txt create mode 100644 modules/ps_emailalerts/mails/sk/productoutofstock.html create mode 100644 modules/ps_emailalerts/mails/sk/productoutofstock.txt create mode 100644 modules/ps_emailalerts/mails/sk/return_slip.html create mode 100644 modules/ps_emailalerts/mails/sk/return_slip.txt create mode 100644 modules/ps_emailalerts/ps_emailalerts.php create mode 100644 modules/ps_emailalerts/tests/php/phpstan.sh create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.6.neon create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.7.neon create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.8.neon create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan-8.0.neon create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan-latest.neon create mode 100644 modules/ps_emailalerts/tests/php/phpstan/phpstan.neon create mode 100644 modules/ps_emailalerts/translations/index.php create mode 100644 modules/ps_emailalerts/translations/pl.php create mode 100644 modules/ps_emailalerts/upgrade/index.php create mode 100644 modules/ps_emailalerts/upgrade/install-2.1.0.php create mode 100644 modules/ps_emailalerts/upgrade/install-2.3.4.php create mode 100644 modules/ps_emailalerts/upgrade/upgrade-2.3.1.php create mode 100644 modules/ps_emailalerts/upgrade/upgrade-2.3.3.php create mode 100644 modules/ps_emailalerts/upgrade/upgrade-2.4.0.php create mode 100644 modules/ps_emailalerts/upgrade/upgrade-2.4.1.php create mode 100644 modules/ps_emailalerts/vendor/autoload.php create mode 100644 modules/ps_emailalerts/vendor/composer/ClassLoader.php create mode 100644 modules/ps_emailalerts/vendor/composer/LICENSE create mode 100644 modules/ps_emailalerts/vendor/composer/autoload_classmap.php create mode 100644 modules/ps_emailalerts/vendor/composer/autoload_namespaces.php create mode 100644 modules/ps_emailalerts/vendor/composer/autoload_psr4.php create mode 100644 modules/ps_emailalerts/vendor/composer/autoload_real.php create mode 100644 modules/ps_emailalerts/vendor/composer/autoload_static.php create mode 100644 modules/ps_emailalerts/vendor/composer/installed.json create mode 100644 modules/ps_emailalerts/views/index.php create mode 100644 modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/form.tpl create mode 100644 modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/index.php create mode 100644 modules/ps_emailalerts/views/templates/admin/_configure/helpers/index.php create mode 100644 modules/ps_emailalerts/views/templates/admin/_configure/index.php create mode 100644 modules/ps_emailalerts/views/templates/admin/index.php create mode 100644 modules/ps_emailalerts/views/templates/front/index.php create mode 100644 modules/ps_emailalerts/views/templates/front/mailalerts-account-line.tpl create mode 100644 modules/ps_emailalerts/views/templates/front/mailalerts-account.tpl create mode 100644 modules/ps_emailalerts/views/templates/hook/index.php create mode 100644 modules/ps_emailalerts/views/templates/hook/my-account-footer.tpl create mode 100644 modules/ps_emailalerts/views/templates/hook/my-account.tpl create mode 100644 modules/ps_emailalerts/views/templates/hook/product.tpl create mode 100644 modules/ps_emailalerts/views/templates/index.php diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 35a13fe5..ef2d8a87 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -708,8 +708,8 @@ }, "Product.php": { "type": "-", - "size": 317879, - "lmtime": 1744577629429, + "size": 317882, + "lmtime": 1744927324329, "modified": false }, "ProductPresenterFactory.php": { @@ -1029,6 +1029,12 @@ "lmtime": 0, "modified": true }, + "image_log.json": { + "type": "-", + "size": 977, + "lmtime": 0, + "modified": false + }, "images.inc.php": { "type": "-", "size": 4830, @@ -1514,6 +1520,12 @@ "lmtime": 0, "modified": false }, + "import-product.php": { + "type": "-", + "size": 22539, + "lmtime": 1744926713383, + "modified": false + }, "index.php": { "type": "-", "size": 1169, diff --git a/modules/ps_cashondelivery/LICENSE.md b/modules/ps_cashondelivery/LICENSE.md new file mode 100644 index 00000000..5e4bd602 --- /dev/null +++ b/modules/ps_cashondelivery/LICENSE.md @@ -0,0 +1,47 @@ +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + +1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + a) to reproduce the Original Work in copies, either alone or as part of a collective work; + + b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + d) to perform the Original Work publicly; and + + e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + +5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + +6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + +9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + +10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + +12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + +13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + +16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/modules/ps_cashondelivery/README.md b/modules/ps_cashondelivery/README.md new file mode 100644 index 00000000..2145a571 --- /dev/null +++ b/modules/ps_cashondelivery/README.md @@ -0,0 +1,24 @@ +# Cash on delivery (COD) + +## About + +Accept cash on delivery payments + +## Reporting issues + +You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue]. + +## Contributing + +PrestaShop modules are open source extensions to the [PrestaShop e-commerce platform][prestashop]. Everyone is welcome and even encouraged to contribute with their own improvements! + +Just make sure to follow our [contribution guidelines][contribution-guidelines]. + +## License + +This module is released under the [Academic Free License 3.0][AFL-3.0] + +[report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose +[prestashop]: https://www.prestashop.com/ +[contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/ +[AFL-3.0]: https://opensource.org/licenses/AFL-3.0 diff --git a/modules/ps_cashondelivery/composer.json b/modules/ps_cashondelivery/composer.json new file mode 100644 index 00000000..0b5dfa61 --- /dev/null +++ b/modules/ps_cashondelivery/composer.json @@ -0,0 +1,40 @@ +{ + "name": "prestashop/ps_cashondelivery", + "description": "PrestaShop module ps_cashondelivery", + "homepage": "https://github.com/PrestaShop/ps_cashondelivery", + "license": "AFL-3.0", + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "prestashop/php-dev-tools": "~3.0" + }, + "config": { + "platform": { + "php": "5.6.0" + }, + "preferred-install": "dist", + "classmap-authoritative": true, + "optimize-autoloader": true, + "prepend-autoloader": false + }, + "autoload": { + "classmap": [ + "ps_cashondelivery.php", + "controllers" + ] + }, + "scripts": { + "set-license-header": [ + "@php ./vendor/bin/header-stamp --license=vendor/prestashop/header-stamp/assets/afl.txt --exclude=.github,node_modules,vendor,tests,_dev" + ] + }, + "type": "prestashop-module", + "author": "PrestaShop" +} \ No newline at end of file diff --git a/modules/ps_cashondelivery/composer.lock b/modules/ps_cashondelivery/composer.lock new file mode 100644 index 00000000..ffb500fa --- /dev/null +++ b/modules/ps_cashondelivery/composer.lock @@ -0,0 +1,1442 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "3397fb623bb10effc17bec7a201b4b5b", + "packages": [], + "packages-dev": [ + { + "name": "composer/pcre", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "time": "2022-01-21T20:24:37+00:00" + }, + { + "name": "composer/semver", + "version": "3.2.9", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2022-02-04T13:58:43+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/9e36aeed4616366d2b690bdce11f71e9178c579a", + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a", + "shasum": "" + }, + "require": { + "composer/pcre": "^1", + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2022-02-24T20:20:32+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-02-24T16:22:25+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8", + "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "time": "2019-06-08T11:03:04+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.19.3", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.2 || ^2.0", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^5.6 || ^7.0 || ^8.0", + "php-cs-fixer/diff": "^1.3", + "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" + }, + "require-dev": { + "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.4", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.4.2", + "php-cs-fixer/accessible-object": "^1.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy-phpunit": "^1.1 || ^2.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunitgoodpractices/polyfill": "^1.5", + "phpunitgoodpractices/traits": "^1.9.1", + "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", + "symfony/phpunit-bridge": "^5.2.1", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters.", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.19-dev" + } + }, + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationCaseFactory.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php", + "tests/Test/IntegrationCaseFactoryInterface.php", + "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", + "tests/Test/TokensWithObservedTransformers.php", + "tests/TestCase.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2021-11-15T17:17:55+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-02-28T20:30:58+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.21", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "96c132c7f2f7bc3230723b66e89f8f150b29d5ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/96c132c7f2f7bc3230723b66e89f8f150b29d5ae", + "reference": "96c132c7f2f7bc3230723b66e89f8f150b29d5ae", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "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" + ], + "time": "2022-02-16T17:07:03+00:00" + }, + { + "name": "php-cs-fixer/diff", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", + "symfony/process": "^3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2020-10-14T08:39:05+00:00" + }, + { + "name": "prestashop/autoindex", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/autoindex.git", + "reference": "92e10242f94a99163dece280f6bd7b7c2b79c158" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/autoindex/zipball/92e10242f94a99163dece280f6bd7b7c2b79c158", + "reference": "92e10242f94a99163dece280f6bd7b7c2b79c158", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^3.1", + "php": ">=5.6", + "symfony/console": "^3.4", + "symfony/finder": "^3.4" + }, + "bin": [ + "bin/autoindex" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\AutoIndex\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Automatically add an 'index.php' in all the current or specified directories and all sub-directories.", + "homepage": "https://github.com/PrestaShopCorp/autoindex", + "time": "2020-03-11T13:37:03+00:00" + }, + { + "name": "prestashop/header-stamp", + "version": "v1.7", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/header-stamp.git", + "reference": "d77ce6d0a7f066670a4774be88f05e5f07b4b6fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/header-stamp/zipball/d77ce6d0a7f066670a4774be88f05e5f07b4b6fc", + "reference": "d77ce6d0a7f066670a4774be88f05e5f07b4b6fc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^3.1", + "php": ">=5.6", + "symfony/console": "^3.4 || ~4.0 || ~5.0", + "symfony/finder": "^3.4 || ~4.0 || ~5.0" + }, + "require-dev": { + "prestashop/php-dev-tools": "1.*" + }, + "bin": [ + "bin/header-stamp" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\HeaderStamp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Rewrite your file headers to add the license or to make them up-to-date", + "homepage": "https://github.com/PrestaShopCorp/header-stamp", + "time": "2020-12-09T16:40:38+00:00" + }, + { + "name": "prestashop/php-dev-tools", + "version": "v3.16.1", + "source": { + "type": "git", + "url": "https://github.com/PrestaShop/php-dev-tools.git", + "reference": "785108c29ef6f580930372d88b8f551740fdee98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/785108c29ef6f580930372d88b8f551740fdee98", + "reference": "785108c29ef6f580930372d88b8f551740fdee98", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^2.14", + "php": ">=5.6.0", + "prestashop/autoindex": "^1.0", + "prestashop/header-stamp": "^1.0", + "squizlabs/php_codesniffer": "^3.4", + "symfony/console": "~3.2 || ~4.0 || ~5.0", + "symfony/filesystem": "~3.2 || ~4.0 || ~5.0" + }, + "conflict": { + "friendsofphp/php-cs-fixer": "2.18.3" + }, + "bin": [ + "bin/prestashop-coding-standards" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\CodingStandards\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PrestaShop coding standards", + "time": "2021-10-18T07:48:21+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.6.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2021-12-12T21:44:58+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", + "reference": "ab42889de57fdfcfcc0759ab102e2fd4ea72dcae", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "31fde73757b6bad247c54597beef974919ec6860" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/31fde73757b6bad247c54597beef974919ec6860", + "reference": "31fde73757b6bad247c54597beef974919ec6860", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/debug": "~3.4|~4.4", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", + "reference": "b6b6ad3db3edb1b4b1c1896b1975fb684994de6e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2020-11-16T17:02:08+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744", + "reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", + "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b5f7b932ee6fa802fc792eabd77c4c88084517ce", + "reference": "b5f7b932ee6fa802fc792eabd77c4c88084517ce", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3fe414077251a81a1b15b1c709faf5c2fbae3d4e", + "reference": "3fe414077251a81a1b15b1c709faf5c2fbae3d4e", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "beecef6b463b06954638f02378f52496cb84bacc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/beecef6b463b06954638f02378f52496cb84bacc", + "reference": "beecef6b463b06954638f02378f52496cb84bacc", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.19-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-10-23T09:01:57+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/298b81faad4ce60e94466226b2abbb8c9bca7462", + "reference": "298b81faad4ce60e94466226b2abbb8c9bca7462", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2020-10-24T10:57:07+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.6" + }, + "platform-dev": [], + "platform-overrides": { + "php": "5.6.0" + } +} diff --git a/modules/ps_cashondelivery/config.xml b/modules/ps_cashondelivery/config.xml new file mode 100644 index 00000000..5e344a4e --- /dev/null +++ b/modules/ps_cashondelivery/config.xml @@ -0,0 +1,11 @@ + + +ps_cashondelivery + + + + + 0 + 1 + + diff --git a/modules/ps_cashondelivery/config_pl.xml b/modules/ps_cashondelivery/config_pl.xml new file mode 100644 index 00000000..919789b7 --- /dev/null +++ b/modules/ps_cashondelivery/config_pl.xml @@ -0,0 +1,12 @@ + + + ps_cashondelivery + + + + + + 0 + 1 + + \ No newline at end of file diff --git a/modules/ps_cashondelivery/controllers/front/index.php b/modules/ps_cashondelivery/controllers/front/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/controllers/front/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/controllers/front/validation.php b/modules/ps_cashondelivery/controllers/front/validation.php new file mode 100644 index 00000000..49c666e5 --- /dev/null +++ b/modules/ps_cashondelivery/controllers/front/validation.php @@ -0,0 +1,131 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +/** + * This Controller receives customer after approval on checkout page + */ +class Ps_CashondeliveryValidationModuleFrontController extends ModuleFrontController +{ + /** + * {@inheritdoc} + */ + public $ssl = true; + + /** + * @var PaymentModule + */ + public $module; + + /** + * {@inheritdoc} + */ + public function postProcess() + { + if (false === $this->checkIfContextIsValid() || false === $this->checkIfPaymentOptionIsAvailable()) { + Tools::redirect($this->context->link->getPageLink( + 'order', + true, + (int) $this->context->language->id, + [ + 'step' => 1, + ] + )); + } + + $customer = new Customer($this->context->cart->id_customer); + + if (false === Validate::isLoadedObject($customer)) { + Tools::redirect($this->context->link->getPageLink( + 'order', + true, + (int) $this->context->language->id, + [ + 'step' => 1, + ] + )); + } + + $this->module->validateOrder( + (int) $this->context->cart->id, + (int) Configuration::getGlobalValue(Ps_Cashondelivery::CONFIG_OS_CASH_ON_DELIVERY), + (float) $this->context->cart->getOrderTotal(true, Cart::BOTH), + $this->module->displayName, + null, + [], + (int) $this->context->currency->id, + false, + $customer->secure_key + ); + + Tools::redirect($this->context->link->getPageLink( + 'order-confirmation', + true, + (int) $this->context->language->id, + [ + 'id_cart' => (int) $this->context->cart->id, + 'id_module' => (int) $this->module->id, + 'id_order' => (int) $this->module->currentOrder, + 'key' => $customer->secure_key, + ] + )); + } + + /** + * Check if the context is valid + * - Cart is loaded + * - Cart has a Customer + * - Cart has a delivery address + * - Cart has an invoice address + * - Cart doesn't contains virtual product + * + * @return bool + */ + private function checkIfContextIsValid() + { + return true === Validate::isLoadedObject($this->context->cart) + && true === Validate::isUnsignedInt($this->context->cart->id_customer) + && true === Validate::isUnsignedInt($this->context->cart->id_address_delivery) + && true === Validate::isUnsignedInt($this->context->cart->id_address_invoice) + && false === $this->context->cart->isVirtualCart(); + } + + /** + * Check that this payment option is still available in case the customer changed + * his address just before the end of the checkout process + * + * @return bool + */ + private function checkIfPaymentOptionIsAvailable() + { + $modules = Module::getPaymentModules(); + + if (empty($modules)) { + return false; + } + + foreach ($modules as $module) { + if (isset($module['name']) && $this->module->name === $module['name']) { + return true; + } + } + + return false; + } +} diff --git a/modules/ps_cashondelivery/controllers/index.php b/modules/ps_cashondelivery/controllers/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/controllers/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/index.php b/modules/ps_cashondelivery/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/logo.png b/modules/ps_cashondelivery/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a6005367c428624a48743b976cabd7a4127f6947 GIT binary patch literal 8755 zcmV-3BFx>1P)PyB?MXyIRCodHT?c%WRklA#CcTi5Knf*5=u#yrf)opg4Z(t|uA)BI-pfAUy6d|7 zTz7TXUAwD3+v>V1t`$W=K~$6`2!hmrfkYs^_vD@bojH?lCR4s|N-_iA{rzU{S8hG` z|DAj8z2}}AK`vZJM@RJ5+U9v3?d|g@A|jtUD5rxul3WBe9~~wXh@gmCilAcZ=vWsK z8Tsz$q?mUjA|hIxs~6$?U~6^L{PvEHhZ!Jw&hO0oBZmSEpxu!X5qFMGiG4>~Ydc_= zt3+-&hA2(&rJ$wC;+TPs(BX8L-W$4fLjXioLnR(<=h4^UziloQh>1%Y0ltk zDPmrGq5!ZG=_!Eu&ZK}d1x&y=Q^dUYNC6Wt9?4_Abf$m_7-x!@_Z}%=0>&eG%$Lp- zurEG3zc`%kdHKU-b$A8V<#Y3)dkP%ZfB{hCS9YL|wto9Fl^?99=$I(V8JtR^CudPy zLNw1^n!s@n5yv-&Enol?UL#|G)Y6-eY@oGE3mt3DckxNlbo%9E=!`4IP-LVDnl1!# z@gQPzRfB7O?ILivJOWVK+S;gaTNyom>q@FDY4lk1u_xrv^?#W`aq-a}!^)t=CA>b16Xca$zUlLe1WhMs!U`}(z;gEWxioV@c4tjJT*W6^=(78U(a2+ZxeaB4#!8y7SsE|` zmUC{-qmjp^s- z{o`r$lnfd-HIt$&Q3_lL+uYbp?>x5K1dV(lPJYM(#t2w0xML(un3==s3o)viZM>$` z(%ej~Ev?kr)=I4Fpq{h+6S72EI9xP?Cx)V;tbl20YN96oHP$zppm73<+=et@jDqFp zlloIkY@7lNbX))!aE;a${_!>M+*7(Q08EsH0TUg=Kh}rgd%SCIX0S9gP*Y>02^v9& zlOM8x@dYfgaq$e8SOo?E1|Wc%1G*;oqIt)Agej7_3OEaV6_&XVfYr=kX=tc7LE{7z zxeZCc_zITTxHttC075_@id5*1aE<41;3~M5AKn2}CTIj2uKkb$jK5$3*MJkiNVSE# z$h`nZ8`cDkP{+L=Qu8o@1d9McIEdyT^giuIH^W-D`0{Fmd3gks;|+%|42Y!)OX-CvJS<7dGGN8+Oe+EYjOb1 z^S}FAt%`dM9Kr#*ZEtlTz|vITN?UkC{e~6$X!oWPDnG<)KKu;M5)(-&>G6~|hE*1( z^`~*X{k0e02gTWz6gGW%h_-xFraOyuyuW+ZM+G$Xj6C}ih3?2960lnU<1bhm>so2? z3mfUP*SAx1Q=3cDwKns{`=9I7Z|%~b)aLrBXAPlw*Nmt1oWP#kgGEiOelLHkz-3uH zJzVnARyzK)!D_}CTr1pM&;jEwSXM0BMQ=Z`ff{Oz?PP3k@1QT=+s$9}9y)_9G|azl z0)N&1HxKFqu+&u6)4pxhh7;VsvywSu9c5%C8;%b8bm~-YaL-d1?GX30*s!pp%x}6fbj<`(1d&O z_p52=hLV8OYX7cEdgiW`+*rOPtvC$0Oh-HQ>J!JS+Q!Kj#oJ#p`X%~SfDnjfyvAM% z?Jrn9dT}eQTlSNeT!>P7$5C=xoY!#90l;bAd3vMsV_o-JAvKyuWqIRMbj8yK8ag3e zS-#Rf3#aRV0>)pkR2*!i51!rJg?{~qrPBRxo<&DZ$)?zN3k$I0>EVyhp<5n5u}fGz z4;H`h1C{+;t0!oeFxL4P=+#8f^z-{Eze^ww4^F*oxEdjO2oln-0tOg=!2-plH~+St zwfr52&1jh0pE`vGj7Xz9o|;7uEuK$jUp<}`n=F(!whv95IlwT1Aqc_Fw#8f|DyqP2sJuO|*K+9>uX_oyi{9>7rnZ{&gUSs64br7y8ugYpAT)y-8PqWgdei&bD6) z%H_gc@R5Y0^9eA41Ph1;Ii$JKQP|ZIGdZ<$_}qV38XY%hFts$b(s*8E%%7D@i7D2t zu@YxwekM(yKa3u_`csdy#MPzxWf+-*!K7X3&(%D0ypl?b>LtrAzTzy`jcOD2> zlpGYMU_m7f118X5K_MEvs3#N^bjm3h9bNn9X^7_04L&NJ7T!IXC+fa*8xA8fs753t zI|9x*f&*BJtCaoUlKtMnf^90;t^%+??g@9WfG&n)m|%bfg=lGU&t33--k-*4%L>2J`jvlh_{_pY)B0XNDX?0)lEY=VX265X4N4@Iy@nc$bRJ)8Xv%~ZwK zDYVb!+D?c7UU+UPTSmbI3$p0j-}_QO)`9Lm_kB8sWfp|T9LkSt4-nJ^v~K5yPJtND zYpUFjVAA>|Xrnq@3(=L#5(3>2$^%!%Ao=)U4Si9{x<8sp&a7Aq&CE!oQ!|q(CEChW zB~Bm(Y_EU`HdsIe$Pk#2^EQzN^@Nr0>_QZ`?xYJw+TRs!FINgx_6JTEdE@#xJ+a<~ z3RtAUQK~(4&Gf;6YWljYj#^zTo*v*qz`u*C=p7cwXE1Qi%1WVZ=CA;Zq!S3>cm#}I zu%JTot{+OU&jOPhVnqRh9-N+nj+vT6U;ClX5XCFU=dhC0tcyAUv%$+;&4d~KRr$1k zM!_;=ZVt`8W~ADO9Vh`;8W`pJuCjsNXAo?zc0YXAmcNN*xla$((o+8Ar^eIV>=YW6 z9P0oagxAw1+H~dGEntj*1&MvJXg`gd)Sm{9u-a!a0v5!dbkabd00Uj#sb}TUsh5tn zPwpW-xEbdSQ}Zzg3%f2KVE$(86vs2(dm1bPlooDubUENC`+YoN1x#oygAKo-i7|9; zP6{2H#$B*&NH2LA1&+&6l7OY8sG1(X?JHdeJ(LwU(9^&Emg*{7e43mZe?mW>bZ@7e zF@!F^=XeLOh~95%Mgm=O*KrCw&VMKWVuXXh+mm3CysKN==q>J6uHINgPwy%787$6q z-NoJ6pLdqhjhl*T1#_O3woc_Q0giJVclTWYg9ISxwXij&*B)9&HRbMwM(0E;4l?_E z?g!_`y6(}XoPE_e6*h`(<|d`aQl9}yUUf&l{df>`IUK;$I&_vo0Q`vXF-B zF0dd!aa*gK=)D6~w5~$`jI+cw;-~S)_)G4RF6@^~$m;=%HyKU(nz_f@N*oHirL+#es>c30j%Rc%=N z=tbjQ-%uV#U;g{astDTpmg<;iK{w+E)!+L&uBNKR-JWn7O8&;Z@gQ4u$q=JSOA(} zx>4K(U(P@|nSp}F#ZLetfRX3$wQdPd20mF(N;_(;T<_I=RW!SABAvz)fvGW8n4nG$ zfKds6n7sFgZr^DM z?i|SZi@-<+lXQz7-{2fn-D6R4%9%sxY~Cu{hlvU23t04aLsIrN6)d0dMB9%w`bU?l za6bG^=Uo$5Fh?27GvxvXJwRz;rtmfo-~X|b4bxRu;J9pa;a!n9Sgwv zrlm(u&Y)>?huABir$9n*tL)THOJ3f>AlSmEk95vO?A~0;!s_uVIV}O8ICb~Sa}*a$ z?iEWZ87$=Su-@4P3oMckR*iqV^?<`-pu7u|AI-oxt4};FWOY?^4boQP3utgJKgqk6 z=U-mkS3xiRR6!Mf&hglX)pnxtK2;2>8|v$*p{|}vSr~flzU{n^$MctS%&FOQ?oCHg za<62iG$cbeDYPqJ@&s5KxetBrH(%5DU;gYWC|&>8>6CwRu6hT8=yj4upg9ZjN7`@z zOR&12L>}dwo0&it^YA!>KL%%jcmfK*0gwPJ08JpAz3-4lfReH@Y|I+&INYH(OUf7j zZaBSm{|=9!flLw429U7@Ln`5^fYOi(EG!^CaobATw$ACmD9iXRr1WPF&R|q<<7SQ zMgkyXweN-xd1&W7#2|WF-wv;!S^0LMIvC=DTPLZ?NqVk)X-I$tv&#Q>?>8R7f;6D8 zjd*&U;q*K0f%`YXOM(D8oJ$V4r9CnpqE(TgaYRT3_-Cnq~jmsivJTxGmov&-p?KEnxZJxy`iU^J3>>2f+r5Hs5{q{+SSwv=T2=97PJQ%mUJG;oq0t|c9S1>N0`>x${)7q{b; zSC^C)Yme_Kuu-sBwflXa?r-3__~Sr2fvne(~Ee=D4I7x{_5*r}A8iOFW2%;8+$$L zxIDugWhLv(bhmRUK}rL|SMm(+BgV9NESnmQb>*i zCaOH7Z@7*$az~|g`NAY^_}cXKtPM%rs?t`9W_hirZ|BZU^<6Q_aEoJ;Puau*2?U%H|l8xF8`U7_}s*Xs#0 zvfTp4SFj+{`s!ADW4Zd8y%o$?4uiY|ELw25D#K?bwW{mUtETC#%>KN03m7Dd!utZ6 zGp`;&L&vAv%OwqpuBf@Gncn*QX8Sum7kT5;c*ZwX$wnxX)=AoWM?>1UxNd6Tb0BT9 zgLB%>VO`z(5(nuZo)$2;*QN#D{1LC?JhO+l2HO?{UFF~1&pZMKg+V2}g65tPJWs=u zd&NyOenuwEJa33<1Z`!|ps+p(GaE&_j0tHc%*(Z(&8SV&U$7u8Y`N_z2fzqWv|#xU zt6M;rE%dU^(-Y^Im3S^A^~`p=_$KU??t7U{UGyEMBBab{};MWv3f3sDw+< zFkrw@z(v3TaL70SB-{X9ky0rC(|T5VGS(H1o!W;+<_ zFX?Mud%cVZ?e_Irexm^l0S1Y80gVET#ZGXnMG07BRJ810+i3kV@3Xnu!Y3qK=-iu+ zvJQ6{fYO+O1Pk(O5AiQrOOsHzHVhaP+5t2S5KPz0b9KRgs$nskySA9#eR``r*6q)` zVIRC~iRSg;Z9 zg?rYq3}cLMA2%n5@=qC{x;HWL6==>P)y14qPq=S*I}8>GQLj)3iIzS-14a@N(7=a7 zVVnspl@uX&<$re4Hy`eE z4yNmV^yEzYNDEv`frXdtAGvM?tBM9z_XGvfjMjCPFBpO9xyydJu#z?7nCtXSq9)B6 zTrl$UC(VEW1_cnX?A&;e7CmZwlbKXv)Ular7~LIUL7or5yTwe|U^zE)ew= zAFOqJ7-Dz+@nf!xbVc9<<*fhv{BPH=7M*XiVJYdcY9$k;tu~h4 z<<|7QP{1z^BVd8t(%8_%hhVOzs#5(b3(jThKRiW^w!p0_4%X2l*9WH?(&h{MGXA)T zBW&i*XTS(p(74dcee1D}wEKJa#+mgrNSQD9+fn6QHz44K8b92RgG)9I#wPk_-1 zxd6*Ii+9t?MSFB->MmeXS~PQ(T0Tc$Rkwfz<*>Ne$Kh9k7-#OX zqvb9b8LfD$AVjL*Uom=W@zK9h_grkz&9edTD=zvrspU(RiQS~XxL z5B~}fX0devMz{;6>%m>tFWpb=t_;u6eOtw_*EHGB)oy!2VRE4hFsKVa1Mbq+ z)=F!a8dJ9nWm=@?xIfWEPq_ysxIaEePyBETqZ=?XQ3ox$VuSmNLX{|4Y`ig(&x!QM zP3s+R?36NpG7EvYUIF9K9bxX}+rvY40qtk~a;RO+)YrDiV%xSS@tFokit`E>5CWjF z3cRe;y}IQGU_5|s1d|KdAu$@sxHYkoIbR_hK(2Y z++Jh@^>Q0Dy&r?+z6lOnSlkBI@dALsj)^!1-=+O~(QF3IQeH$|QQ1gPy*yl8FE)^U z65F!z2pE6`PP(N1+ryW;aJ$mDnHe;X50^;INOsu5BHY5)#ud;YepXxzUEGg1;j!h* zFBvqSmNil_n~x7yhjR;N_l~3E*u-r#@38O)7*tZg($44X6z>gfeN%UhG9o{fPP%9y z4IJKE8AXbXjpOdf(O`hPxSpN^D4>r34x9!KeggkyWkj(lvIN@9XJda-R!9KI(42A(ALPwN{+bJ)b{2HrBegt^WZK7Oz}9XijWlcQNaiKkI) zlv|ab%L!jTD88`+Me5@gFsh=ctZjt!$t%04cz5?(Z8So}anm#S5UgQ*UL@PPWkZMH zDq5g`5O9h(MiMpC_93%t71^56_7Wk9W;%OqElTg&yN}rTA(ANwg93>nqm&gLj z3_efu6c%LrICVP$763(Y7WUz!PU?DdRYRB330P2}=B6ff#LVZfhpsw9Ok52GSy75ndBU#G5&=?;iu0d<~b-d4dIiCT!l(~6n0QX$? z<8EhG?^rs4!4k`0RrIj=3LNsx4Xp$;_QNT(6_N_TfZ;0-tf6lg7s~69^Rose&;@sn zqU^!F6j#9rNSRQz88xz3)b_RXWCcK1t;4;;PXnGdez%^7<)84de4CHf#=#%PW3#r^ z1O!uQV#(W6rM(fnyWYD34)T_^aPF>Z_;AtBd1SSeM_3gu6u+`~7w0Sn$u#bE;#pQf zqYDQSu*ki7=Y^ZNqJsjA6cAvk;UnlCyLlz;-5Q$ux_xsK=)yZkQa0P|g&{`ig2Yss zD?+%cc&I&d1s-V^_?&?P7L@Dx;L#)o$1t8?!%uMr07b(=oI#?(Xb9kZ zuX)wwGGbF@J(tI-997Mx$^U-C3fi|LG?xG-p45ltUOR%4Qn(9ZSp_2@5o{Hk3kjzyq{})+w;?Gx4?EmHnA50_rY5f4UuQ{?6AHWD3qwU0z3jV;d~{cU3!w>G6B) z9XkD2gK6?<{ncr2YHDBRR&3He3K{NT(bfU&BKN45+`|XQknRd$)H54cmz2zXRN znm>Q&WUUNgg)%(SZ8TzZ+n-k ze^F19VC=LEnt$U6KKD9-!GZ(Jtt-q&au?LoZQ`6ikIvq;jLjkdW;g%xoC9>neI!ph zoqB05O*<#IQyY%KA_rW6qnKQ!J6ghX9^4AMM<>O+8=0S<-@@k8@AMozIByesS!m(C zqiM$ZLnuBm(Rx@XCgU{flO|Y#LwlpCMn**3$!*c14k0S4_+VSVw6hX9k*P)#@-=); zULtGnkE21OGVG_i#%MST(lx>2D|G`KkHPZrQ7LhcBUP(L5nr6S@T$9*`#&7mtX!uC z?ft7CI+}&sG>VI7nT1cQm0|PYGR5z@=Hd4gU>ThpdzX~lI$bDt>>r!=?EJR24ge?M zG7aRF*$Z=N#yNu=hRmkCqG^B-xrEGuZfJB$>^s^bbpZ@sPMY+OXey_9)IsyOTgc~$ z=p4TGX>t$iKz(!LX~2kNn#c!;4jN;f;+Ius0SodqyC6`ZXB;Nw*wjriuQja0Xb1u> dWESVr{6Er8X;lY)SYZGF002ovPDHLkV1nTFr!D{h literal 0 HcmV?d00001 diff --git a/modules/ps_cashondelivery/logo.webp b/modules/ps_cashondelivery/logo.webp new file mode 100644 index 0000000000000000000000000000000000000000..7c0e4589c10b1c6539af671f9171b9821cb89447 GIT binary patch literal 716 zcmV;-0yF(mNk&G*0ssJ4MM6+kP&il$0000G0000V0018V06|PpNR0ph01hM@v8V;B(=03J!UqUk$p2t`ZL0E!l)4vLne28uQ!0HA0q z0y)}qBr(zE7`2P?cJa{?8Ta9CIoCJ5oyv4eg7WS5n0a z#zPco-?|h7Jaq+4CGMtGxD)KQ#%3MD zwbzAz!y~6E`vp$_i|#omqx_|TxnDlsnRgQGv#dD*Po9bbwKO4K|NVxY6dO+A;prIi z#m%!VPyV%Ei2t)LlM%PQ9rh<5rMV}Fz(}I$ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +if (file_exists(__DIR__ . '/vendor/autoload.php')) { + require_once __DIR__ . '/vendor/autoload.php'; +} + +use PrestaShop\PrestaShop\Core\Payment\PaymentOption; + +class Ps_Cashondelivery extends PaymentModule +{ + const HOOKS = [ + 'displayOrderConfirmation', + 'paymentOptions', + ]; + + const CONFIG_OS_CASH_ON_DELIVERY = 'PS_OS_COD_VALIDATION'; + + /** + * {@inheritdoc} + */ + public function __construct() + { + $this->name = 'ps_cashondelivery'; + $this->tab = 'payments_gateways'; + $this->author = 'PrestaShop'; + $this->version = '2.0.1'; + $this->need_instance = 1; + $this->ps_versions_compliancy = ['min' => '1.7.6.0', 'max' => _PS_VERSION_]; + $this->controllers = ['validation']; + $this->currencies = false; + + parent::__construct(); + + $this->displayName = $this->trans('Cash on delivery (COD)', [], 'Modules.Cashondelivery.Admin'); + $this->description = $this->trans('Accept cash payments on delivery to make it easy for customers to purchase on your store.', [], 'Modules.Cashondelivery.Admin'); + } + + /** + * {@inheritdoc} + */ + public function install() + { + return parent::install() + && (bool) $this->registerHook(static::HOOKS) + && $this->installOrderState(); + } + + /** + * @param array{cookie: Cookie, cart: Cart, altern: int} $params + * + * @return array|PaymentOption[] Should always returns an array to avoid issue + */ + public function hookPaymentOptions(array $params) + { + if (empty($params['cart'])) { + return []; + } + + /** @var Cart $cart */ + $cart = $params['cart']; + + if ($cart->isVirtualCart()) { + return []; + } + + $cashOnDeliveryOption = new PaymentOption(); + $cashOnDeliveryOption->setModuleName($this->name); + $cashOnDeliveryOption->setCallToActionText($this->trans('Pay by Cash on Delivery', [], 'Modules.Cashondelivery.Shop')); + $cashOnDeliveryOption->setAction($this->context->link->getModuleLink($this->name, 'validation', [], true)); + $cashOnDeliveryOption->setAdditionalInformation($this->fetch('module:ps_cashondelivery/views/templates/hook/paymentOptions-additionalInformation.tpl')); + + return [$cashOnDeliveryOption]; + } + + /** + * @param array{cookie: Cookie, cart: Cart, altern: int, order: Order, objOrder: Order} $params + * + * @return string + */ + public function hookDisplayOrderConfirmation(array $params) + { + /** @var Order $order */ + $order = (isset($params['objOrder'])) ? $params['objOrder'] : $params['order']; + + if (!Validate::isLoadedObject($order) || $order->module !== $this->name) { + return ''; + } + + $this->context->smarty->assign([ + 'shop_name' => $this->context->shop->name, + 'total' => $this->context->getCurrentLocale()->formatPrice($params['order']->getOrdersTotalPaid(), (new Currency($params['order']->id_currency))->iso_code), + 'reference' => $order->reference, + 'contact_url' => $this->context->link->getPageLink('contact', true), + ]); + + return $this->fetch('module:ps_cashondelivery/views/templates/hook/displayOrderConfirmation.tpl'); + } + + /** + * @return bool + */ + public function installOrderState() + { + if (Configuration::getGlobalValue(Ps_Cashondelivery::CONFIG_OS_CASH_ON_DELIVERY)) { + $orderState = new OrderState((int) Configuration::getGlobalValue(Ps_Cashondelivery::CONFIG_OS_CASH_ON_DELIVERY)); + + if (Validate::isLoadedObject($orderState) && $this->name === $orderState->module_name) { + return true; + } + } + + return $this->createOrderState( + static::CONFIG_OS_CASH_ON_DELIVERY, + [ + 'en' => 'Awaiting Cash On Delivery validation', + 'bs' => 'Čeka validaciju Plaćanje po dostavi', + 'ca' => 'Esperant la validació del pagament contra reemborsament', + 'da' => 'Afventer godkendelse af levering pr. efterkrav', + 'de' => 'Warten auf Zahlungseingang Nachnahme', + 'et' => 'Ootab sularaha kauba kättesaamisel kinnitust', + 'es' => 'En espera de validación por contra reembolso.', + 'mx' => 'En espera de validación por pago contra entrega', + 'fr' => 'En attente de paiement à la livraison', + 'qc' => 'En attente de paiement à la livraison', + 'gl' => 'Agardando a validación do Pago Contra Reembolso', + 'hr' => 'Awaiting cod validation', + 'id' => 'Awaiting cod validation', + 'it' => 'In attesa verifica contrassegno', + 'lv' => 'Gaida skaidrās naudas apmaksas apstiprinājumu', + 'hu' => 'Awaiting cod validation', + 'nl' => 'Wachten op bevestiging (rembours)', + 'no' => 'Awaiting cod validation', + 'pl' => 'Oczekiwanie na płatność przy odbiorze', + 'br' => 'Aguardando validação de pagamento na entrega', + 'pt' => 'Awaiting cod validation', + 'ro' => 'In asteptarea confirmarii platii la livrare', + 'sq' => 'Në pritje të pagesës gjatë dorëzimit', + 'sk' => 'Čaká sa na potvrdenie platby dobierkou', + 'sr' => 'Čeka se potvrda keširanja pri isporuci', + 'fi' => 'Odottaa maksuvahvistusta', + 'sv' => 'Väntar på postförskott validering', + 'tr' => 'Kapıda ödeme onayı bekleniyor', + 'lt' => 'Awaiting cod validation', + 'si' => 'Čaka potrdilo za plačilo po povzetju', + 'vn' => 'Chờ xác nhận thanh toán COD', + 'cs' => 'Čeká se na potvrzení dobírky', + 'el' => 'Αναμονή επικύρωσης Αντικαταβολής', + 'ru' => 'Ожидается подтверждение оплаты наличными', + 'uk' => 'Очікується платіж післяплатою', + 'bg' => 'В очакване на валидиране на плащане при доставка', + 'mk' => 'Awaiting cod validation', + 'he' => 'Awaiting cod validation', + 'fa' => 'Awaiting cod validation', + 'hi' => 'Awaiting Cash On Delivery validation', + 'bn' => 'Awaiting cod validation', + 'ar' => 'بإنتظار المصادقة على الدفع عند الإستلام', + 'ja' => '代金引換払い確認待ち', + 'zh' => '接受远程付费', + 'tw' => '等待貨到付款驗證', + 'ko' => '배송시 현금 지불 확인 대기', + ], + true === (bool) version_compare(_PS_VERSION_, '1.7.7.0', '>=') ? '#4169E1' : '#34219E' + ); + } + + /** + * Create custom OrderState used for payment + * + * @param string $configurationKey Configuration key used to store OrderState identifier + * @param array $nameByLangIsoCode An array of name for all languages, default is en + * @param string $color Color of the label + * @param bool $isLogable consider the associated order as validated + * @param bool $isPaid set the order as paid + * @param bool $isInvoice allow a customer to download and view PDF versions of his/her invoices + * @param bool $isShipped set the order as shipped + * @param bool $isDelivery show delivery PDF + * @param bool $isPdfDelivery attach delivery slip PDF to email + * @param bool $isPdfInvoice attach invoice PDF to email + * @param bool $isSendEmail send an email to the customer when his/her order status has changed + * @param string $template Only letters, numbers and underscores are allowed. Email template for both .html and .txt + * @param bool $isHidden hide this status in all customer orders + * @param bool $isUnremovable Disallow delete action for this OrderState + * @param bool $isDeleted Set OrderState deleted + * + * @return bool + */ + private function createOrderState( + $configurationKey, + array $nameByLangIsoCode, + $color, + $isLogable = false, + $isPaid = false, + $isInvoice = false, + $isShipped = false, + $isDelivery = false, + $isPdfDelivery = false, + $isPdfInvoice = false, + $isSendEmail = false, + $template = '', + $isHidden = false, + $isUnremovable = true, + $isDeleted = false + ) { + $tabNameByLangId = []; + + foreach ($nameByLangIsoCode as $langIsoCode => $name) { + foreach (Language::getLanguages(false) as $language) { + if (Tools::strtolower($language['iso_code']) === $langIsoCode) { + $tabNameByLangId[(int) $language['id_lang']] = $name; + } elseif (isset($nameByLangIsoCode['en'])) { + $tabNameByLangId[(int) $language['id_lang']] = $nameByLangIsoCode['en']; + } + } + } + + $orderState = new OrderState(); + $orderState->module_name = $this->name; + $orderState->name = $tabNameByLangId; + $orderState->color = $color; + $orderState->logable = $isLogable; + $orderState->paid = $isPaid; + $orderState->invoice = $isInvoice; + $orderState->shipped = $isShipped; + $orderState->delivery = $isDelivery; + $orderState->pdf_delivery = $isPdfDelivery; + $orderState->pdf_invoice = $isPdfInvoice; + $orderState->send_email = $isSendEmail; + $orderState->hidden = $isHidden; + $orderState->unremovable = $isUnremovable; + $orderState->template = $template; + $orderState->deleted = $isDeleted; + $result = (bool) $orderState->add(); + + if (false === $result) { + $this->_errors[] = sprintf( + 'Failed to create OrderState %s', + $configurationKey + ); + + return false; + } + + $result = (bool) Configuration::updateGlobalValue($configurationKey, (int) $orderState->id); + + if (false === $result) { + $this->_errors[] = sprintf( + 'Failed to save OrderState %s to Configuration', + $configurationKey + ); + + return false; + } + + $orderStateImgPath = $this->getLocalPath() . 'views/img/orderstate/' . $configurationKey . '.gif'; + + if (false === (bool) Tools::file_exists_cache($orderStateImgPath)) { + $this->_errors[] = sprintf( + 'Failed to find icon file of OrderState %s', + $configurationKey + ); + + return false; + } + + if (false === (bool) Tools::copy($orderStateImgPath, _PS_ORDER_STATE_IMG_DIR_ . $orderState->id . '.gif')) { + $this->_errors[] = sprintf( + 'Failed to copy icon of OrderState %s', + $configurationKey + ); + + return false; + } + + return true; + } +} diff --git a/modules/ps_cashondelivery/tests/index.php b/modules/ps_cashondelivery/tests/index.php new file mode 100644 index 00000000..ed971fff --- /dev/null +++ b/modules/ps_cashondelivery/tests/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/tests/phpstan.sh b/modules/ps_cashondelivery/tests/phpstan.sh new file mode 100644 index 00000000..42a9a268 --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan.sh @@ -0,0 +1,28 @@ +#!/bin/bash +PS_VERSION=$1 + +set -e + +# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled +echo "Pull PrestaShop files (Tag ${PS_VERSION})" + +docker rm -f temp-ps || true +docker volume rm -f ps-volume || true + +docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION + +# Clear previous instance of the module in the PrestaShop volume +echo "Clear previous module" + +docker exec -t temp-ps rm -rf /var/www/html/modules/ps_cashondelivery + +# Run a container for PHPStan, having access to the module content and PrestaShop sources. +# This tool is outside the composer.json because of the compatibility with PHP 5.6 +echo "Run PHPStan using phpstan-${PS_VERSION}.neon file" + +docker run --rm --volumes-from temp-ps \ + -v $PWD:/var/www/html/modules/ps_cashondelivery \ + -e _PS_ROOT_DIR_=/var/www/html \ + --workdir=/var/www/html/modules/ps_cashondelivery phpstan/phpstan:0.12 \ + analyse \ + --configuration=/var/www/html/modules/ps_cashondelivery/tests/phpstan/phpstan-$PS_VERSION.neon diff --git a/modules/ps_cashondelivery/tests/phpstan/index.php b/modules/ps_cashondelivery/tests/phpstan/index.php new file mode 100644 index 00000000..ed971fff --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.6.neon b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.6.neon new file mode 100644 index 00000000..39c67925 --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.6.neon @@ -0,0 +1,12 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$id of class Customer constructor expects null, int given.#' + - '#Parameter \#9 \$secure_key of method PaymentModuleCore\:\:validateOrder\(\) expects bool, string given.#' + - '#Parameter \#4 \$ssl of method LinkCore\:\:getModuleLink\(\) expects null, true given.#' + - '#Parameter \#7 \$currency_special of method PaymentModuleCore\:\:validateOrder\(\) expects null, int given.#' + - '#Property OrderStateCore\:\:\$name \(string\) does not accept array.#' + - '#Parameter \#1 \$hook_name of method ModuleCore\:\:registerHook\(\) expects string, array given.#' + - '#Parameter \#1 \$id of class Currency constructor expects null, int given.#' diff --git a/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.7.neon b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.7.neon new file mode 100644 index 00000000..f10cb0cf --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.7.neon @@ -0,0 +1,8 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#9 \$secure_key of method PaymentModuleCore\:\:validateOrder\(\) expects bool, string given.#' + - '#Parameter \#7 \$currency_special of method PaymentModuleCore\:\:validateOrder\(\) expects null, int given.#' + - '#Property OrderStateCore\:\:\$name \(string\) does not accept array.#' diff --git a/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.8.neon b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.8.neon new file mode 100644 index 00000000..6c76571f --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/phpstan-1.7.8.neon @@ -0,0 +1,6 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Property OrderStateCore\:\:\$template \(array\) does not accept string.#' diff --git a/modules/ps_cashondelivery/tests/phpstan/phpstan-latest.neon b/modules/ps_cashondelivery/tests/phpstan/phpstan-latest.neon new file mode 100644 index 00000000..6c76571f --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/phpstan-latest.neon @@ -0,0 +1,6 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Property OrderStateCore\:\:\$template \(array\) does not accept string.#' diff --git a/modules/ps_cashondelivery/tests/phpstan/phpstan.neon b/modules/ps_cashondelivery/tests/phpstan/phpstan.neon new file mode 100644 index 00000000..de4c3b61 --- /dev/null +++ b/modules/ps_cashondelivery/tests/phpstan/phpstan.neon @@ -0,0 +1,12 @@ +includes: + - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon + +parameters: + paths: + # From PHPStan 0.12, paths to check are relative to the neon file + - ../../ps_cashondelivery.php + - ../../controllers/ + - ../../upgrade/ + ignoreErrors: + reportUnmatchedIgnoredErrors: false + level: 5 diff --git a/modules/ps_cashondelivery/translations/index.php b/modules/ps_cashondelivery/translations/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/translations/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/translations/pl.php b/modules/ps_cashondelivery/translations/pl.php new file mode 100644 index 00000000..e69de29b diff --git a/modules/ps_cashondelivery/upgrade/index.php b/modules/ps_cashondelivery/upgrade/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/upgrade/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/upgrade/upgrade-1.0.7.php b/modules/ps_cashondelivery/upgrade/upgrade-1.0.7.php new file mode 100644 index 00000000..bdbed471 --- /dev/null +++ b/modules/ps_cashondelivery/upgrade/upgrade-1.0.7.php @@ -0,0 +1,40 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +use PrestaShop\PrestaShop\Core\Module\WidgetInterface; + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @param Ps_Cashondelivery $module + * + * @return bool + */ +function upgrade_module_1_0_7($module) +{ + $module->unregisterHook('paymentReturn'); + if (method_exists($module, 'hookDisplayPaymentReturn') || $module instanceof WidgetInterface) { + $module->registerHook('displayPaymentReturn'); + } + + return true; +} diff --git a/modules/ps_cashondelivery/upgrade/upgrade-2.0.0.php b/modules/ps_cashondelivery/upgrade/upgrade-2.0.0.php new file mode 100644 index 00000000..f8678dd5 --- /dev/null +++ b/modules/ps_cashondelivery/upgrade/upgrade-2.0.0.php @@ -0,0 +1,57 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * Update main function for module Version 2.0.0 + * + * @param Ps_Cashondelivery $module + * + * @return bool + */ +function upgrade_module_2_0_0($module) +{ + $orderStateId = (int) Configuration::get('PS_OS_COD_VALIDATION'); + $orderState = new OrderState($orderStateId); + + // If OrderState is not exist, we create it, but it should be installed at PrestaShop setup + if (!Validate::isLoadedObject($orderState)) { + $module->installOrderState(); + } + + // Hook displayOrderConfirmation replace hook displayPaymentReturn + if (!$module->isRegisteredInHook('displayOrderConfirmation')) { + $module->registerHook('displayOrderConfirmation'); + } + + // Hook paymentOptions must be registered + if (!$module->isRegisteredInHook('paymentOptions')) { + $module->registerHook('paymentOptions'); + } + + // Hook displayPaymentReturn is no longer used + if ($module->isRegisteredInHook('displayPaymentReturn')) { + $module->unregisterHook('displayPaymentReturn'); + } + + return true; +} diff --git a/modules/ps_cashondelivery/vendor/autoload.php b/modules/ps_cashondelivery/vendor/autoload.php new file mode 100644 index 00000000..b6ad506f --- /dev/null +++ b/modules/ps_cashondelivery/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/modules/ps_cashondelivery/vendor/composer/LICENSE b/modules/ps_cashondelivery/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/modules/ps_cashondelivery/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/modules/ps_cashondelivery/vendor/composer/autoload_classmap.php b/modules/ps_cashondelivery/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..5db5b62f --- /dev/null +++ b/modules/ps_cashondelivery/vendor/composer/autoload_classmap.php @@ -0,0 +1,11 @@ + $baseDir . '/ps_cashondelivery.php', + 'Ps_CashondeliveryValidationModuleFrontController' => $baseDir . '/controllers/front/validation.php', +); diff --git a/modules/ps_cashondelivery/vendor/composer/autoload_namespaces.php b/modules/ps_cashondelivery/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..b7fc0125 --- /dev/null +++ b/modules/ps_cashondelivery/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInita514d5349db65fb5fb286a7e4710fa94::getInitializer($loader)); + } else { + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->setClassMapAuthoritative(true); + $loader->register(false); + + return $loader; + } +} diff --git a/modules/ps_cashondelivery/vendor/composer/autoload_static.php b/modules/ps_cashondelivery/vendor/composer/autoload_static.php new file mode 100644 index 00000000..46d74090 --- /dev/null +++ b/modules/ps_cashondelivery/vendor/composer/autoload_static.php @@ -0,0 +1,21 @@ + __DIR__ . '/../..' . '/ps_cashondelivery.php', + 'Ps_CashondeliveryValidationModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/validation.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->classMap = ComposerStaticInita514d5349db65fb5fb286a7e4710fa94::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/modules/ps_cashondelivery/vendor/composer/installed.json b/modules/ps_cashondelivery/vendor/composer/installed.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/modules/ps_cashondelivery/vendor/composer/installed.json @@ -0,0 +1 @@ +[] diff --git a/modules/ps_cashondelivery/views/img/index.php b/modules/ps_cashondelivery/views/img/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/views/img/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/views/img/orderstate/PS_OS_COD_VALIDATION.gif b/modules/ps_cashondelivery/views/img/orderstate/PS_OS_COD_VALIDATION.gif new file mode 100644 index 0000000000000000000000000000000000000000..aeed0b4b7463d4d51e2f369d741fac7b8c653dbf GIT binary patch literal 1028 zcmd^;`A?E@0LEX_m9s4g&`4~lS>COC8m*OcdCaY>To)@X*Jx|&!e-ezW<}YwY-`iX zR7NUvXgR?=LO~G)55!PO1y96__l5TbUXJ&h{vAF0?6c?B=Z7aT`B-dRCJ7=z90+np zA>!|MMvHybMU;VeR85(G_lMZg3i2qItouyvtB6zb7(G>t!Se9Gl`%SgsOl?2_v4_x znldS%PJg4$)KHgeD2v}{hC08wIzOYxe?hcqscF+<6AiARAazuv-rxKq02R?;G0jvP zv?z?8X^4aCw;`e^M7R@a+-`1)v50pm1W9uK8MT<%Cd}>-vSlrIO|6>|>1MMe0BNUN zWOTD^D=MdBayr@-Xzku&RR$Vm2VhC0MGPBr85>l`+uHLvZgNTi0Q< zKMd~QJE*!p+m>ih#4k!ymK2xJ&O}Uc1XCo~x)QLS1iLcH-j|AYrXhW2G39w{57VMP zV^v+i2h#9?3%L3sqRO-mW}4O4QSA-8IuqAq;Tje`bltAKV*h*9F>(#l-nNafZR58v z?L&NojgQ~9Yjf)sS+^z-ZlFP7|L98B~Am^W#BrET$hnctguk!UaE2!`ObL(F)siM zUx?*;uq+}>4K7m)VQK-UX0TG=?{2seAWd#WOqj)PSVF*3fJgx<1865el?2uY&|ZM5 zfK?4_8ekhDY+7K~LH}8TaWBu+$~(%#b|B#_LfXwN!oZ*gd1s^5O< z({k_N$vn>bjSyR&CHMWfkNo?DM{s0%MCzkJ7WAi5L5=t3@@iZ2Pkl}(^=j7VRUa?i z?JH@IKxAaz(R0k{Cu@>OB|BpLNi6tj0e$C=W$2AZ1>{Ndxe`vx2!b9zh8X_ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/views/index.php b/modules/ps_cashondelivery/views/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/views/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/views/templates/hook/displayOrderConfirmation.tpl b/modules/ps_cashondelivery/views/templates/hook/displayOrderConfirmation.tpl new file mode 100644 index 00000000..fd33dd93 --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/hook/displayOrderConfirmation.tpl @@ -0,0 +1,25 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +
+

{l s='Your order on %s is complete.' sprintf=[$shop_name] d='Modules.Cashondelivery.Shop'}

+

{l s='You have chosen the cash on delivery method.' d='Modules.Cashondelivery.Shop'}

+

{l s='Your order will be sent very soon.' d='Modules.Cashondelivery.Shop'}

+

{l s='For any questions or for further information, please contact our' d='Modules.Cashondelivery.Shop'} {l s='customer support' d='Modules.Cashondelivery.Shop'}.

+
diff --git a/modules/ps_cashondelivery/views/templates/hook/index.php b/modules/ps_cashondelivery/views/templates/hook/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/hook/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_cashondelivery/views/templates/hook/paymentOptions-additionalInformation.tpl b/modules/ps_cashondelivery/views/templates/hook/paymentOptions-additionalInformation.tpl new file mode 100644 index 00000000..02048508 --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/hook/paymentOptions-additionalInformation.tpl @@ -0,0 +1,22 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +
+

{l s='You pay for the merchandise upon delivery' d='Modules.Cashondelivery.Shop'}

+
diff --git a/modules/ps_cashondelivery/views/templates/hook/payment_return.tpl b/modules/ps_cashondelivery/views/templates/hook/payment_return.tpl new file mode 100644 index 00000000..1f0f794c --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/hook/payment_return.tpl @@ -0,0 +1,32 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +

+ {l s='Your order on %s is complete.' sprintf=[$shop_name] d='Modules.Cashondelivery.Shop'} +

+ {l s='You have chosen the cash on delivery method.' d='Modules.Cashondelivery.Shop'} +

{l s='Your order will be sent very soon.' d='Modules.Cashondelivery.Shop'} +

{l s='For any questions or for further information, please contact our' d='Modules.Cashondelivery.Shop'} {l s='customer support' d='Modules.Cashondelivery.Shop'}. +

diff --git a/modules/ps_cashondelivery/views/templates/hook/ps_cashondelivery_intro.tpl b/modules/ps_cashondelivery/views/templates/hook/ps_cashondelivery_intro.tpl new file mode 100644 index 00000000..865aedbc --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/hook/ps_cashondelivery_intro.tpl @@ -0,0 +1,30 @@ +{* +* 2007-2015 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2015 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
+

+ {l s='You pay for the merchandise upon delivery' d='Modules.Cashondelivery.Shop'} +

+
diff --git a/modules/ps_cashondelivery/views/templates/index.php b/modules/ps_cashondelivery/views/templates/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_cashondelivery/views/templates/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/CONTRIBUTORS.md b/modules/ps_emailalerts/CONTRIBUTORS.md new file mode 100644 index 00000000..2ed9ea39 --- /dev/null +++ b/modules/ps_emailalerts/CONTRIBUTORS.md @@ -0,0 +1,11 @@ +GitHub contributors: +-------------------------------- +- aleeks +- antoin-m +- AntoineMille +- eternoendless +- matks +- maximebiloe +- PierreRambaud +- Progi1984 +- v4lux diff --git a/modules/ps_emailalerts/LICENSE.md b/modules/ps_emailalerts/LICENSE.md new file mode 100644 index 00000000..5e4bd602 --- /dev/null +++ b/modules/ps_emailalerts/LICENSE.md @@ -0,0 +1,47 @@ +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + +1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + a) to reproduce the Original Work in copies, either alone or as part of a collective work; + + b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + d) to perform the Original Work publicly; and + + e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + +5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + +6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + +9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + +10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + +12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + +13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + +16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/modules/ps_emailalerts/MailAlert.php b/modules/ps_emailalerts/MailAlert.php new file mode 100644 index 00000000..5014c997 --- /dev/null +++ b/modules/ps_emailalerts/MailAlert.php @@ -0,0 +1,318 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +class MailAlert extends ObjectModel +{ + public $id_customer; + + public $customer_email; + + public $id_product; + + public $id_product_attribute; + + public $id_shop; + + public $id_lang; + + /** + * @see ObjectModel::$definition + */ + public static $definition = [ + 'table' => 'mailalert_customer_oos', + 'primary' => 'id_customer', + 'fields' => [ + 'id_customer' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true], + 'customer_email' => ['type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true], + 'id_product' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true], + 'id_product_attribute' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true], + 'id_shop' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true], + 'id_lang' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true], + ], + ]; + + public static function customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop = null, $id_lang = null, $guest_email = '') + { + if ($id_shop == null) { + $id_shop = Context::getContext()->shop->id; + } + + if ($id_lang == null) { + $id_lang = Context::getContext()->language->id; + } + + $customer = new Customer($id_customer); + $customer_email = $customer->email; + $guest_email = pSQL($guest_email); + + $id_customer = (int) $id_customer; + $customer_email = pSQL($customer_email); + $where = $id_customer == 0 ? "customer_email = '$guest_email'" : "(id_customer=$id_customer OR customer_email='$customer_email')"; + $sql = ' + SELECT * + FROM `' . _DB_PREFIX_ . self::$definition['table'] . '` + WHERE ' . $where . ' + AND `id_product` = ' . (int) $id_product . ' + AND `id_product_attribute` = ' . (int) $id_product_attribute . ' + AND `id_shop` = ' . (int) $id_shop; + + return count(Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($sql)); + } + + public static function deleteAlert($id_customer, $customer_email, $id_product, $id_product_attribute, $id_shop = null) + { + $sql = ' + DELETE FROM `' . _DB_PREFIX_ . self::$definition['table'] . '` + WHERE ' . (($id_customer > 0) ? '(`customer_email` = \'' . pSQL($customer_email) . '\' OR `id_customer` = ' . (int) $id_customer . ')' : + '`customer_email` = \'' . pSQL($customer_email) . '\'') . + ' AND `id_product` = ' . (int) $id_product . ' + AND `id_product_attribute` = ' . (int) $id_product_attribute . ' + AND `id_shop` = ' . ($id_shop != null ? (int) $id_shop : (int) Context::getContext()->shop->id); + + return Db::getInstance()->execute($sql); + } + + /* + * Get objects that will be viewed on "My alerts" page + */ + public static function getMailAlerts($id_customer, $id_lang, ?Shop $shop = null) + { + if (!Validate::isUnsignedId($id_customer) || !Validate::isUnsignedId($id_lang)) { + exit(Tools::displayError()); + } + + if (!$shop) { + $shop = Context::getContext()->shop; + } + + $customer = new Customer($id_customer); + $products = self::getProducts($customer, $id_lang); + $products_number = count($products); + + if (empty($products) === true || !$products_number) { + return []; + } + + for ($i = 0; $i < $products_number; ++$i) { + $obj = new Product((int) $products[$i]['id_product'], false, (int) $id_lang); + if (!Validate::isLoadedObject($obj)) { + continue; + } + + if (isset($products[$i]['id_product_attribute']) + && Validate::isUnsignedInt($products[$i]['id_product_attribute'])) { + $attributes = self::getProductAttributeCombination($products[$i]['id_product_attribute'], $id_lang); + $products[$i]['attributes_small'] = ''; + + if ($attributes) { + foreach ($attributes as $row) { + $products[$i]['attributes_small'] .= $row['attribute_name'] . ', '; + } + } + + $products[$i]['attributes_small'] = rtrim($products[$i]['attributes_small'], ', '); + $products[$i]['id_shop'] = $shop->id; + + /* Get cover */ + $attrgrps = $obj->getAttributesGroups((int) $id_lang); + foreach ($attrgrps as $attrgrp) { + if ($attrgrp['id_product_attribute'] == (int) $products[$i]['id_product_attribute'] + && $images = Product::_getAttributeImageAssociations((int) $attrgrp['id_product_attribute'])) { + $products[$i]['cover'] = $obj->id . '-' . array_pop($images); + break; + } + } + } + + if (!isset($products[$i]['cover']) || !$products[$i]['cover']) { + $images = $obj->getImages((int) $id_lang); + foreach ($images as $image) { + if ($image['cover']) { + $products[$i]['cover'] = $obj->id . '-' . $image['id_image']; + break; + } + } + } + + if (!isset($products[$i]['cover'])) { + $products[$i]['cover'] = Language::getIsoById($id_lang) . '-default'; + } + $products[$i]['link'] = $obj->getLink(); + $context = Context::getContext(); + $products[$i]['cover_url'] = $context->link->getImageLink($obj->link_rewrite, $products[$i]['cover'], 'small_default'); + } + + return $products; + } + + public static function sendCustomerAlert($id_product, $id_product_attribute) + { + $link = new Link(); + $context = Context::getContext(); + $id_product = (int) $id_product; + $id_product_attribute = (int) $id_product_attribute; + $current_shop = $context->shop->id; + $customers = self::getCustomers($id_product, $id_product_attribute, $current_shop); + + foreach ($customers as $customer) { + $id_shop = (int) $customer['id_shop']; + $id_lang = (int) $customer['id_lang']; + $context->shop->id = $id_shop; + + $product = new Product($id_product, false, $id_lang, $id_shop); + $product_name = Product::getProductName($product->id, $id_product_attribute, $id_lang); + $product_link = $link->getProductLink($product, $product->link_rewrite, null, null, $id_lang, $id_shop, $id_product_attribute); + $template_vars = [ + '{product}' => $product_name, + '{product_link}' => $product_link, + ]; + + if ($customer['id_customer']) { + $customer = new Customer((int) $customer['id_customer']); + $customer_email = (string) $customer->email; + $customer_id = (int) $customer->id; + } else { + $customer_id = 0; + $customer_email = (string) $customer['customer_email']; + } + + $iso = Language::getIsoById($id_lang); + $locale = Language::getLocaleByIso($iso); + + $translator = Context::getContext()->getTranslatorFromLocale($locale); + + if (file_exists(dirname(__FILE__) . '/mails/' . $iso . '/customer_qty.txt') + && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/customer_qty.html')) { + try { + Mail::Send( + $id_lang, + 'customer_qty', + $translator->trans('Product available', [], 'Emails.Subject', $locale), + $template_vars, + $customer_email, + null, + (string) Configuration::get('PS_SHOP_EMAIL', null, null, $id_shop), + (string) Configuration::get('PS_SHOP_NAME', null, null, $id_shop), + null, + null, + dirname(__FILE__) . '/mails/', + false, + $id_shop + ); + } catch (Exception $e) { + /* + * Something went wrong but don't care we need to continue. + * This can be caused by an invalid e-mail address. + */ + PrestaShopLogger::addLog( + sprintf( + 'Mailalert error: Could not send email to address [%s] because %s', + $customer_email, + $e->getMessage() + ), + 3 // It means error + ); + } + } + + Hook::exec( + 'actionModuleMailAlertSendCustomer', + [ + 'product' => $product_name, + 'link' => $product_link, + 'customer' => $customer, + 'product_obj' => $product, + ] + ); + + self::deleteAlert( + $customer_id, + $customer_email, + $id_product, + $id_product_attribute, + $id_shop + ); + } + $context->shop->id = $current_shop; + } + + /* + * Generate correctly the address for an email + */ + public static function getFormatedAddress(Address $address, $line_sep, $fields_style = []) + { + return AddressFormat::generateAddress($address, ['avoid' => []], $line_sep, ' ', $fields_style); + } + + /* + * Get products according to alerts + */ + public static function getProducts($customer, $id_lang) + { + $list_shop_ids = Shop::getContextListShopID(false); + + $sql = ' + SELECT ma.`id_product`, p.`quantity` AS product_quantity, pl.`name`, ma.`id_product_attribute` + FROM `' . _DB_PREFIX_ . self::$definition['table'] . '` ma + JOIN `' . _DB_PREFIX_ . 'product` p ON (p.`id_product` = ma.`id_product`) + ' . Shop::addSqlAssociation('product', 'p') . ' + LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_shop IN (' . implode(', ', $list_shop_ids) . ')) + WHERE product_shop.`active` = 1 + AND (ma.`id_customer` = ' . (int) $customer->id . ' OR ma.`customer_email` = \'' . pSQL($customer->email) . '\') + AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestriction(false, 'ma'); + + return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($sql); + } + + /* + * Get product combinations + */ + public static function getProductAttributeCombination($id_product_attribute, $id_lang) + { + $sql = ' + SELECT al.`name` AS attribute_name + FROM `' . _DB_PREFIX_ . 'product_attribute_combination` pac + LEFT JOIN `' . _DB_PREFIX_ . 'attribute` a ON (a.`id_attribute` = pac.`id_attribute`) + LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`) + LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = ' . (int) $id_lang . ') + LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = ' . (int) $id_lang . ') + LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (pac.`id_product_attribute` = pa.`id_product_attribute`) + ' . Shop::addSqlAssociation('product_attribute', 'pa') . ' + WHERE pac.`id_product_attribute` = ' . (int) $id_product_attribute; + + return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($sql); + } + + /* + * Get customers waiting for alert on the specified product/product attribute + * in shop `$id_shop` and if the shop group shares the stock in all shops of the shop group + */ + public static function getCustomers($id_product, $id_product_attribute, $id_shop) + { + $sql = ' + SELECT mc.id_customer, mc.customer_email, mc.id_shop, mc.id_lang + FROM `' . _DB_PREFIX_ . self::$definition['table'] . '` mc + INNER JOIN `' . _DB_PREFIX_ . 'shop` s on s.id_shop = mc.id_shop + INNER JOIN `' . _DB_PREFIX_ . 'shop_group` sg on s.id_shop_group = sg.id_shop_group and (s.id_shop = ' . (int) $id_shop . ' or sg.share_stock = 1) + INNER JOIN `' . _DB_PREFIX_ . 'shop` s2 on s2.id_shop = mc.id_shop and s2.id_shop = ' . (int) $id_shop . ' + WHERE mc.`id_product` = ' . (int) $id_product . ' AND mc.`id_product_attribute` = ' . (int) $id_product_attribute; + + return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($sql); + } +} diff --git a/modules/ps_emailalerts/README.md b/modules/ps_emailalerts/README.md new file mode 100644 index 00000000..1a966cb7 --- /dev/null +++ b/modules/ps_emailalerts/README.md @@ -0,0 +1,39 @@ +# Mail alerts + +## About + +Make your everyday life easier, handle mail alerts about stock and orders, addressed to you as well as your customers. + +## Compatibility + +PrestaShop: `1.7.7.0` or later + +## Multistore compatibility + +This module is partially compatible with the multistore feature. Some of its options might not be available. + +## How to test + +Link to specs : https://docs.prestashop-project.org/functional-documentation/functional-documentation/ux-ui/back-office/improve/modules/configure-mail-alerts-ps_mailalerts + +Configure Customer notifications and Merchant notifications +Add stock to product, edit an order, place an order, remove stock from product, set threshold for a product. 
Check that the emails are well sent + +## Reporting issues + +You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue]. + +## Contributing + +PrestaShop modules are open source extensions to the [PrestaShop e-commerce platform][prestashop]. Everyone is welcome and even encouraged to contribute with their own improvements! + +Just make sure to follow our [contribution guidelines][contribution-guidelines]. + +## License + +This module is released under the [Academic Free License 3.0][AFL-3.0] + +[report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose +[prestashop]: https://www.prestashop.com/ +[contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/ +[AFL-3.0]: https://opensource.org/licenses/AFL-3.0 diff --git a/modules/ps_emailalerts/composer.json b/modules/ps_emailalerts/composer.json new file mode 100644 index 00000000..4bc711f6 --- /dev/null +++ b/modules/ps_emailalerts/composer.json @@ -0,0 +1,25 @@ +{ + "name": "prestashop/ps_emailalerts", + "description": "PrestaShop module ps_emailalerts", + "homepage": "https://github.com/PrestaShop/ps_emailalerts", + "license": "AFL-3.0", + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "require": { + "php": ">=7.1.3" + }, + "require-dev": { + "prestashop/php-dev-tools": "^5", + "friendsofphp/php-cs-fixer": "^v3" + }, + "config": { + "preferred-install": "dist", + "prepend-autoloader": false + }, + "type": "prestashop-module", + "author": "PrestaShop" +} diff --git a/modules/ps_emailalerts/composer.lock b/modules/ps_emailalerts/composer.lock new file mode 100644 index 00000000..8ee6c936 --- /dev/null +++ b/modules/ps_emailalerts/composer.lock @@ -0,0 +1,2694 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "5177916e947497ce2f45d3da1a90158c", + "packages": [], + "packages-dev": [ + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-09-19T14:15:21+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "8520451a140d3f46ac33042715115e290cf5785f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2024-08-06T10:04:20+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.65.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.2", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3.1 || ^2.4", + "infection/infection": "^0.29.8", + "justinrainbow/json-schema": "^5.3 || ^6.0", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", + "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2024-11-25T00:39:24+00:00" + }, + { + "name": "prestashop/php-dev-tools", + "version": "v5", + "source": { + "type": "git", + "url": "https://github.com/PrestaShop/php-dev-tools.git", + "reference": "4b284d9b07a274505c81144536924eb4014e6fbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/4b284d9b07a274505c81144536924eb4014e6fbf", + "reference": "4b284d9b07a274505c81144536924eb4014e6fbf", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/console": "~3.2 || ~4.0 || ~5.0 || ~6.0 || ~7.0", + "symfony/filesystem": "~3.2 || ~4.0 || ~5.0 || ~6.0 || ~7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2" + }, + "suggest": { + "phpstan/phpstan": "^0.12", + "prestashop/autoindex": "^2.0", + "prestashop/header-stamp": "^2.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "bin": [ + "bin/prestashop-coding-standards" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\CodingStandards\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PrestaShop" + } + ], + "description": "PrestaShop coding standards", + "support": { + "issues": "https://github.com/PrestaShop/php-dev-tools/issues", + "source": "https://github.com/PrestaShop/php-dev-tools/tree/v5" + }, + "time": "2024-05-23T12:27:45+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/2.0.0" + }, + "time": "2021-07-14T16:41:46+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.16.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.16.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-07-26T10:38:09+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T07:15:17+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.28", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "f4f71842f24c2023b91237c72a365306f3c58827" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", + "reference": "f4f71842f24c2023b91237c72a365306f3c58827", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.28" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-08-07T06:12:30+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.4.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "0ffc48080ab3e9132ea74ef4e09d8dcf26bf897e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0ffc48080ab3e9132ea74ef4e09d8dcf26bf897e", + "reference": "0ffc48080ab3e9132ea74ef4e09d8dcf26bf897e", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.13" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:18:03+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", + "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:20:29+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v5.4.25", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.25" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-31T13:04:02+00:00" + }, + { + "name": "symfony/finder", + "version": "v6.4.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/daea9eca0b08d0ed1dc9ab702a46128fd1be4958", + "reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v6.4.13" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-10-01T08:30:56+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v6.4.16", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "368128ad168f20e22c32159b9f761e456cec0c78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/368128ad168f20e22c32159b9f761e456cec0c78", + "reference": "368128ad168f20e22c32159b9f761e456cec0c78", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v6.4.16" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-20T10:57:02+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "875e90aeea2777b6f135677f618529449334a612" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "42292d99c55abe617799667f454222c54c60e229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-28T09:04:16+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/process", + "version": "v6.4.15", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "3cb242f059c14ae08591c5c4087d1fe443564392" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/3cb242f059c14ae08591c5c4087d1fe443564392", + "reference": "3cb242f059c14ae08591c5c4087d1fe443564392", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.4.15" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-11-06T14:19:14+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-30T19:17:29+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v6.4.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "2cae0a6f8d04937d02f6d19806251e2104d54f92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/2cae0a6f8d04937d02f6d19806251e2104d54f92", + "reference": "2cae0a6f8d04937d02f6d19806251e2104d54f92", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/service-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v6.4.13" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:18:03+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.26", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "1181fe9270e373537475e826873b5867b863883c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/1181fe9270e373537475e826873b5867b863883c", + "reference": "1181fe9270e373537475e826873b5867b863883c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.26" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-06-28T12:46:07+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.3" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/modules/ps_emailalerts/config.xml b/modules/ps_emailalerts/config.xml new file mode 100644 index 00000000..72743a01 --- /dev/null +++ b/modules/ps_emailalerts/config.xml @@ -0,0 +1,13 @@ + + + ps_emailalerts + + + + + + Are you sure you want to delete all customer notifications? + 1 + 0 + + diff --git a/modules/ps_emailalerts/config_pl.xml b/modules/ps_emailalerts/config_pl.xml new file mode 100644 index 00000000..d36ab4e5 --- /dev/null +++ b/modules/ps_emailalerts/config_pl.xml @@ -0,0 +1,12 @@ + + + ps_emailalerts + + + + + + 1 + 0 + + \ No newline at end of file diff --git a/modules/ps_emailalerts/controllers/front/account.php b/modules/ps_emailalerts/controllers/front/account.php new file mode 100644 index 00000000..98e4304f --- /dev/null +++ b/modules/ps_emailalerts/controllers/front/account.php @@ -0,0 +1,63 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +/** + * @since 1.5.0 + */ +class Ps_EmailAlertsAccountModuleFrontController extends ModuleFrontController +{ + public function init() + { + parent::init(); + + require_once $this->module->getLocalPath() . 'MailAlert.php'; + } + + public function getBreadcrumbLinks() + { + $breadcrumb = parent::getBreadcrumbLinks(); + $breadcrumb['links'][] = $this->addMyAccountToBreadcrumb(); + $breadcrumb['links'][] = [ + 'title' => $this->trans('My alerts', [], 'Modules.Emailalerts.Shop'), + 'url' => $this->context->link->getModuleLink('ps_emailalerts', 'account'), + ]; + + return $breadcrumb; + } + + public function initContent() + { + parent::initContent(); + + if (!Context::getContext()->customer->isLogged()) { + Tools::redirect('index.php?controller=authentication&redirect=module&module=ps_emailalerts&action=account'); + } + + if (Context::getContext()->customer->id) { + $this->context->smarty->assign('id_customer', Context::getContext()->customer->id); + $this->context->smarty->assign( + 'mailAlerts', + MailAlert::getMailAlerts((int) Context::getContext()->customer->id, (int) Context::getContext()->language->id) + ); + + $this->setTemplate('module:ps_emailalerts/views/templates/front/mailalerts-account.tpl'); + } + } +} diff --git a/modules/ps_emailalerts/controllers/front/actions.php b/modules/ps_emailalerts/controllers/front/actions.php new file mode 100644 index 00000000..6b087240 --- /dev/null +++ b/modules/ps_emailalerts/controllers/front/actions.php @@ -0,0 +1,175 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +/** + * @since 1.5.0 + */ +class Ps_EmailAlertsActionsModuleFrontController extends ModuleFrontController +{ + /** + * @var int + */ + public $id_product; + public $id_product_attribute; + + public function init() + { + parent::init(); + + require_once $this->module->getLocalPath() . 'MailAlert.php'; + $this->id_product = (int) Tools::getValue('id_product'); + $this->id_product_attribute = (int) Tools::getValue('id_product_attribute'); + } + + public function postProcess() + { + if (Tools::getValue('process') == 'remove') { + $this->processRemove(); + } elseif (Tools::getValue('process') == 'add') { + $this->processAdd(); + } elseif (Tools::getValue('process') == 'check') { + $this->processCheck(); + } + } + + /** + * Remove product alert. + * Prints 0 if success + */ + public function processRemove() + { + // check if product exists + $product = new Product($this->id_product); + if (!Validate::isLoadedObject($product)) { + exit('1'); + } + + $context = Context::getContext(); + if (MailAlert::deleteAlert( + (int) $context->customer->id, + (string) $context->customer->email, + (int) $product->id, + (int) $this->id_product_attribute, + (int) $context->shop->id + )) { + exit('0'); + } + + exit('1'); + } + + /** + * Add a favorite product. + */ + public function processAdd() + { + $context = Context::getContext(); + + if ($context->customer->isLogged()) { + $id_customer = (int) $context->customer->id; + $customer = new Customer($id_customer); + $customer_email = (string) $customer->email; + } elseif (Validate::isEmail((string) Tools::getValue('customer_email'))) { + $customer_email = (string) Tools::getValue('customer_email'); + $customer = $context->customer->getByEmail($customer_email); + $id_customer = (isset($customer->id) && ($customer->id != null)) ? (int) $customer->id : 0; + } else { + exit(json_encode( + [ + 'error' => true, + 'message' => $this->trans('Your email address is invalid.', [], 'Modules.Emailalerts.Shop'), + ] + )); + } + + $id_product = (int) Tools::getValue('id_product'); + $id_product_attribute = (int) Tools::getValue('id_product_attribute'); + $id_shop = (int) $context->shop->id; + $id_lang = (int) $context->language->id; + $product = new Product($id_product, false, $id_lang, $id_shop, $context); + + $mail_alert = MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop, null, $customer_email); + + if ($mail_alert) { + exit(json_encode( + [ + 'error' => true, + 'message' => $this->trans('You already have set an alert for this product.', [], 'Modules.Emailalerts.Shop'), + ] + )); + } elseif (!Validate::isLoadedObject($product)) { + exit(json_encode( + [ + 'error' => true, + 'message' => $this->trans('Your email address is invalid.', [], 'Modules.Emailalerts.Shop'), + ] + )); + } + + $mail_alert = new MailAlert(); + + $mail_alert->id_customer = $id_customer; + $mail_alert->customer_email = $customer_email; + $mail_alert->id_product = $id_product; + $mail_alert->id_product_attribute = $id_product_attribute; + $mail_alert->id_shop = $id_shop; + $mail_alert->id_lang = $id_lang; + + if ($mail_alert->add() !== false) { + exit(json_encode( + [ + 'error' => false, + 'message' => $this->trans('Request notification registered', [], 'Modules.Emailalerts.Shop'), + ] + )); + } + + exit(json_encode( + [ + 'error' => true, + 'message' => $this->trans('Your email address is invalid.', [], 'Modules.Emailalerts.Shop'), + ] + )); + } + + /** + * Add a favorite product. + */ + public function processCheck() + { + if (!(int) $this->context->customer->logged) { + exit('0'); + } + + $id_customer = (int) $this->context->customer->id; + + if (!$id_product = (int) Tools::getValue('id_product')) { + exit('0'); + } + + $id_product_attribute = (int) Tools::getValue('id_product_attribute'); + + if (MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, (int) $this->context->shop->id)) { + exit('1'); + } + + exit('0'); + } +} diff --git a/modules/ps_emailalerts/controllers/front/index.php b/modules/ps_emailalerts/controllers/front/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/controllers/front/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/controllers/index.php b/modules/ps_emailalerts/controllers/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/controllers/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/index.php b/modules/ps_emailalerts/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/js/admin/ps_emailalerts.js b/modules/ps_emailalerts/js/admin/ps_emailalerts.js new file mode 100644 index 00000000..ab54da3a --- /dev/null +++ b/modules/ps_emailalerts/js/admin/ps_emailalerts.js @@ -0,0 +1,46 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +$(document).on('ready', function() { + let $ma_merchant_order_radio_on = $('#MA_MERCHANT_ORDER_on'); + let $ma_merchant_oos_radio_on = $('#MA_MERCHANT_OOS_on'); + let $ma_merchant_return_slip_radio_on = $('#MA_RETURN_SLIP_on'); + + let $order_emails_form_group = $('#MA_MERCHANT_ORDER_EMAILS').parents('.form-group'); + let $oos_emails_form_group = $('#MA_MERCHANT_OOS_EMAILS').parents('.form-group'); + let $return_slip_emails_form_group = $('#MA_RETURN_SLIP_EMAILS').parents('.form-group'); + + // Bind change event + $(document).on('change', '#MA_MERCHANT_ORDER_on, #MA_MERCHANT_ORDER_off', function(){ + $order_emails_form_group.toggle($ma_merchant_order_radio_on.is(':checked') && $ma_merchant_order_radio_on.val() === '1'); + }); + + $(document).on('change', '#MA_MERCHANT_OOS_on, #MA_MERCHANT_OOS_off', function(){ + $oos_emails_form_group.toggle($ma_merchant_oos_radio_on.is(':checked') && $ma_merchant_oos_radio_on.val() === '1'); + }); + + $(document).on('change', '#MA_RETURN_SLIP_on, #MA_RETURN_SLIP_off', function(){ + $return_slip_emails_form_group.toggle($ma_merchant_return_slip_radio_on.is(':checked') && $ma_merchant_return_slip_radio_on.val() === '1'); + }); + + // Check at page load if we need to show or hide the inputs + $ma_merchant_order_radio_on.trigger('change'); + $ma_merchant_oos_radio_on.trigger('change'); + $ma_merchant_return_slip_radio_on.trigger('change'); +}); diff --git a/modules/ps_emailalerts/js/index.php b/modules/ps_emailalerts/js/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/js/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/js/mailalerts.js b/modules/ps_emailalerts/js/mailalerts.js new file mode 100644 index 00000000..8086399a --- /dev/null +++ b/modules/ps_emailalerts/js/mailalerts.js @@ -0,0 +1,97 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ + +function addNotification(productId, productAttributeId) { + // to keep backward compatibility + if (typeof productId === 'undefined') { + var ids = $('div.js-mailalert > input[type=hidden]'); + productId = ids.eq(0).val(); + productIdAttribute = ids.eq(1).val(); + } + + $.ajax({ + type: 'POST', + url: $('div.js-mailalert').data('url'), + data: 'id_product='+productId+'&id_product_attribute='+productAttributeId+'&customer_email='+$('div.js-mailalert input[type=email]').val(), + success: function (resp) { + resp = JSON.parse(resp); + + $('.js-mailalert-alerts').html('').show(); + if (!resp.error) { + $('div.js-mailalert > .js-mailalert-add, div.js-mailalert > input[type=email], div.js-mailalert .gdpr_consent_wrapper').hide(); + } + } + }); + return false; +} + +$(document).on('ready', function() { + const mailAlertSubmitButtonClass = '.js-mailalert-add'; + const mailAlertWrapper = $('.js-mailalert'); + const mailAlertSubmitButton = mailAlertWrapper.find(mailAlertSubmitButtonClass); + + if (mailAlertWrapper.find('#gdpr_consent, .gdpr_consent').length) { + // We use a timeout to put this at the end of the callstack, so it's executed after GPDR module. + setTimeout(() => { + mailAlertSubmitButton.prop('disabled', true); + + mailAlertWrapper.find('[name="psgdpr_consent_checkbox"]').on('change', function (e) { + e.stopPropagation(); + + mailAlertSubmitButton.prop('disabled', !$(this).prop('checked')); + }); + }, 0); + } + + $(document).on('click', mailAlertSubmitButtonClass, function (e) + { + e.preventDefault(); + + addNotification($(this).data('product'), $(this).data('product-attribute')); + }); + + $(document).on('click', '.js-remove-email-alert', function() + { + var self = $(this); + var ids = self.attr('rel').replace('js-id-emailalerts-', ''); + ids = ids.split('-'); + var id_product_mail_alert = ids[0]; + var id_product_attribute_mail_alert = ids[1]; + var parent = self.closest('li'); + + $.ajax({ + url: self.data('url'), + type: "POST", + data: { + 'id_product': id_product_mail_alert, + 'id_product_attribute': id_product_attribute_mail_alert + }, + success: function(result) + { + if (result == '0') + { + parent.fadeOut("normal", function() + { + parent.remove(); + }); + } + } + }); + }); +}); diff --git a/modules/ps_emailalerts/logo.png b/modules/ps_emailalerts/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d575a274af05b216dcab7c1e9a0440ba4ca74634 GIT binary patch literal 4942 zcmd6r*FPH$)W&VGMT}S}603sPs#+r{v1bt_q(*B~D|A>9dylG>+M`BMvu4niDz#dx zYPY3!tsmv>`wzU=@5OVTtMA46oag2|ai+$)ER1}N6ciLJdT5mSKTrH$0qFkCx?Zi@ z|BTY#TvwZ-ZdBkG1qBG8htjgdQ*PTc1Xxb_1X3#^+XAIq*ydwF= zJiocyWhfSW{McXYr0ebX-KV=fSN0@I%fzuCO_m*R%g;L(e>oxyX|H9T_CBxTuv8Oe zprS*x^-(A-9o8y=lRk>OluN6CnZG?bV(vt`c>IXQl6-(1&dj^wyB746u+PRNeTd-n ze%qp&z;J}b-NdZAQTjBve-`ChpgT0Y6r(8lF;rZiUsf3B>Wgkfz)EXT;WU6pQTaPB z!=5o9Kbh8#or~Q-LxHBqUT4JU%Z(v4qs%Y3dqim-DqMK!t4Ep?@l)MsLKk+|d_&kP zE}WZ6r(~a_q-U#!OS{8>h7-VUop|ZT9bM9y33wJ!3Yi8AUF8M>MrL|xS4mWU8T2~*0SHDD@X8JKp` z0YH;~lA*UkXka)zYOPC#Djm_Whc@|tf@?0(T>oZ@3tgF2h{%!t)@3?BPF+{H7@pVp zGbQ}nLz;?dn*JJBb*Qj!ZoUS4*mn)rKRY5iV4dtSzWJqsIjfnCop@|5hk8Y%qC$Qy ziIs=*Mz3o*wK6ll&E@+?9*-4pw}+bsoQ{UlDC_VKemPB$-VtdK^U~5nmbYS%COGqE z5qxq}oCV6%D@gn>vA7leR%#1|A)cc68+b{rM--l3Ui9jsa3PnRH@x=`aCdn0 z!B%PSgOz(1gJx->k5FxBLF}~)7i-X)fS?m73lH4ARht1>hW+|GqMo%yx0b3Z)y$%m zC;M(|cx$W5hPe(HmlJRnoFv6nh@09v{T?N_BqCWNWHiMT!OI9`=IUmdUy$~$TGLt4 zI(Gc(jP!`s7kR-XqPy3gl;-;o?dm|Di>IK0Y~{HB<|`+?Jz z;CjO}h+*{_qfD);WrQy2_%CbHN7UO$av`LlONF3sXYCyQSbtLZ>p~bzVU8>1`Gp~% z--Xud^xj#o1CPiPCs7O-tF0S~TuKO|*c`Ewx=?)2XflOg+Sa*>VY3M_A1=&HruK(U z;1a(v7qU;M+bAN3V?;6$!-VEKx6BD=c`a6Dqu``bqT8AM-V&DQ_b+hUjY)ll@rB7G zx*U7wC|+7+#PS6YGQ`U5@RLI&+g!|*AeVP8HdDTlyL=5}g>RUnm7Q)u220$(J`OIH z*d1b3SWs6NWb}(n!wMX48K*948v>9%oYe7)+!<9ob^I?_9&F4m31=#AEoeC;TWA*M zJTIMEG`}AOYLIjd6wkv7koy--{#Liu+f6YbV@;b-LgOYO_B#l&1xR|&>M1|G&O3^m z?+Mx$*%i-wX4Tg6ft6SFa0IQ5!VT=JOm+`EOn1@-uTVf4XMev(2jChQjE9^1N;KLW z?^vu{A9UKToMLV5Comg?3!pf4xUIh5R@a^imGosc8Ugfgj(jMFu~TAVd(MYHA!^&H zA#;lRqYdl_bGdp?n1n0S|!~e==~@MWu~lUY2pe<*!GGO)+;g2;W>Wn*i^x@ z!<)zEf+^SZALw-=;FO`GNhOb#;1z-pO}D0@$^OXqN!tSvANUP^`>G|&nZ4lE%Q12m z4i+`5+=KiU{2QoytMdZszc6*DUdT+GnakD4Kz!u1oX*v0>|qe*wvEx>2$*S>2378c zshBhWa{CZBzN?O<5LMPDZQN1(<40K^%V5w4GS{P;S+luB33bfv>fpY}-L0Y)g-a}j z^uz!GVF~8*3Ayj1&>3^9_zc9j+}8PrLeB=r;3zs1VANv}pXAGUeK1U?3_smB6L(-{ z1sxH@#gr&a24vY5N(7=)Y42@1u2ZVKawpHoL79;cRYrS9|7+nZ=W*#1bYc=xsWk~u z2*XYwII>>GhCQs|wNh#B7l9eub7rk53RHC!e~$OpRDPYy#@1b>q@mxKI@j&&15zhS zaa2j_qd@*-#OLg<9ZOCNI7G1FZ9AJ40GfMa3>2f6XK|Q>pv_vT@GHe*Zq@PNfFjN& zLyG;|s#g~A`qEhuXfh~zAq!Ph>`88hpICk&7o`w&D+AI@l)VASyI$|gVuNvc*ob-a zjU?Id1H(LTg+X*i65G$?aaYy(S;|sQA1@vaKz7pPu)k^5t()~GRW54r>2SmUB(L4$ zmx&GY)TM@>Eek!vD(oBC0f~L>-0!ijHM8{ADI*d5!}*n*Cr9NuJ?3+-W2Po2sdd-E z%Y)F#r7S)b^|w7NbF^`J4r{iK#&R-4y&LJkJ8lYbWP>cOKpC61X2>Q8UF8Dym?a;J zjyLwnHt2;oKPa)n;@VRNs;)v-nU-lD=%l_WqM03$UN^ZV`5!RE-BcwM?<4i(3&-V7 zG_Z1NF&WxCwFcD6gb5FkVFD(Zd<)AVyVGY8IuB77`Sd-m~gDmukrzcX#-n zgb)3Q9(PmKPnPm9%I@}q+}?eyz$|xv0Ysc$UBJEY6~8_>ikwG>yo^;v@#zSNu%!Ly zr}o-=c$Z(%(VwTfVJT;>tgX_GJNe68Dp(!!6KhnR3OOe)>fi+&_~sxS$-F6__I!Lt z;yiDyA`jRD@dAHVV)qh0is{wf-<@j51(wiz^RE&TVjj>#z)S|c<594@t}|3l6Onfr zpD&E<9Ao*&uSPcoO&--O<1W+3bPSSMC(Uv`O>A7_+}?wg1--g?;eAOvIJ>t6eT1}q z;e%MZK;rYAQ=?tP6A5Ntc5*!P93&ynxoS8qRJ&h@xFLIzY76!#WJoi!5Ove+IQ{LT zw#r|TPx43-HD@@KS-Kg9Tg8iE@fiiS)*Ui&c(Z`NS2+$nB(6!Ka_tfYE8u_6m&>hZWn9L%-5v3(JE$IZ_S06Cw%pTQ-09 zWnS~RYL8dBIKJB_+2qb_$h_RRI|FU^c9PDw|9K!a7_DrevBHkY)X>Q_Qw=(-XyESQ zEWV%mw(;NoMQtPOdZhVDfXQ!nX0-SQPo2GcYcGwbZOCNQQRu3*4>?{ih8|i_KDJ!F zl@dABRI%4r5=7b~;Lu$u{^q15#lBjX5QIM}In1y505_?m$D#ufq1n1Cr*iOsVE(R5 zz5B+`2#sRP*>Ub?Dg{|tzYXo42H)P4p4?*wD_O|BqFU5#lrVCt2SOe{QW%jPi(anC zlI$uDDo`W{51=XSU)NGT%*EYK<}?YIp{Bvb$`5HNTO<#qq!DM~>Ryn0Z)zdgE3SC6 z4Q5X)y03W^-j)07PQlOqTF4(Y_&1w2@61Q9o_j_bh~mI7WNVd5!2aCzw)-gMg;;-! zU-{-EXf1*nAGW%)xrY`q6GV|qtek38_nZN}^?m~~9{T$I&6hXbbR7XL1;0Hwq3bs7 zbWY+~1T(7zjo6lY+S{6Cr#pVMzP3dj<~51^btj=6I7sr;vvHJ9J2)e%q?t*Ks}C@R zp_9KwJ>vX$pEfp2Z^rw`k@6-~gL;R&Xqk3P`tyY;pJ8?C8)3hzkvckjs7Xec#Ix5S z52Gu-QJn~5bjnuSx{1P~!TnC8{*LMC*WE4rJTY!G>T7nJhEbBMf{3GHKg7zPM}K>% zo>~wQ1Pt9Kvr5)FdA+P%OMjm)Q|!>R>f1U{YR7GR%KXuY&e|2IQToMs;0XFx6>T(ji1~Io7N66TL?s zZZ}?#+!Xg@D4OTSC8%`g&{=oy;`2_tzD={Pr>r3pi!3Xs^UvN_+eO@412Tc7AZTFK zFC{A%b9R#CJ__`opZ?4;|9$bg;!{0vk?*l+xtRUJTQ;)w^mv-g@b%iz?Z@lesr8~b zA~Wua<{^$Jup-3bY%^Hy26}1UOD5lW-2imi1v5OIsd^`ng`?&Bw*IN*h#p^2xzHLM zTJ&GSQ}RJN0Z8ZKpshGm=^C`1^6i8tD6Gk$7L9AyBNJ%zf?)KC%OJNzb$K2inMu)9+??(HIPs=bB35A8<3f~`ZyD089+(&GL1&DIw64v zsf2M#-B4Pn5CbSNE?`_slS7AI;1^e7ILr_sHgSjk-|r;oOWv2SGE^sK7VuoL zUg2x;uwfc>)9BV15_9Cx8mnTyr; zb`EY0@gVzJE3EB~5?+0t{Bbdw$kJ@9r5(hh0}dj*8_VBhdWn=VqoVC}w}cqV4t;^| z-~8H1JJ#c%P}t6U+BQEyphgFDBEcU90FO@*X5PY4Ff#iH)&jn z*UT(lwKZsIya3$UThe;UCVN4re7i}xMu5OU)OYMH>3z2%9M+mNG5~EiPf?u5V%bR3 zEWT|9HYxgcFx!#lwX?kz5mceUDJF)z=I6Hm zA_8X;VL1=kU-MFHEbvr|p4YvWvKMAqw43S8EpFzeYs^}>&HqFjS^Pyj^AS@9Vt52S zoGN#J5;a`UbHvvnMn=e|Y1oT5;*K~m^eL~H=I*_{Fjuu1{xdd&DGuX%aP|5A4gsVy zt2nOo7hPY3%uEyh3xJk0HW);6J{d1RXf}F%x^F}+mKRsDnef%_wxjAeB>_Za{IIB= zE|jRKuQHw$dpESkSmaPvqk)qdofF}_d%E2BJ}wp>V`U2zX8vf%VydLVjh&;o0b+Fg zPcqtczbDj4)sq`K(s=?ix8%QnOJBI5 z>eB$jrBp&3!|x&&+pZ#3%SNS4lx+ zXD(^NS1fE@6qkO*%T!wgOEgu@(2Sqpoo?IFPcH(70y5z z1ii}#@HfPCg!Z!GyDA(eF)-Exv59De0 z((bOYYu17N*3Tb}VixsjEP+CGU|*LW7k`f*+zS-)I!c)VnE)ZG%AVi(zh4_Gu3W$L zzEH6)76E=nhO4gpV5H4mdu{cyU!)5#AsYx3@@CfsMD(hTl)|?P(iN)=7;AIShawjo zFSYKSO5M9DJCNcmo36$ZC86Xsfk}n?zi`G$&;W_*XkcAHu+jTZhm(HwTb2v0m`IxV z%TXUIeK%bJ$}0+)q#@kb7oo@u`N`~zQSyU}Fp}b$Act#E#=nA$Lhp_-s!rQ6@_zs) C3keDU literal 0 HcmV?d00001 diff --git a/modules/ps_emailalerts/logo.webp b/modules/ps_emailalerts/logo.webp new file mode 100644 index 0000000000000000000000000000000000000000..8ad5942347426b16e6236d982c2d6625f9221d2a GIT binary patch literal 1568 zcmV+*2H*KoNk&E(1^@t8MM6+kP&il$0000G0001g004gg06|PpNJ#(y01;Q9C;%CV z#+nM_x3fk>1U@(GFA+*&+lus;>{R)Z2skVqD6smi0d-#hBKki8D+%aHEWocvs|GEK z@BjZ_gBCnmX0*2wRv`dZP&go{1pok09{`;JDu4ih06s+;h(scxjo-W!0wP%eG!%6Z zm;47ImnZkfn^g04wfrBr&!0Yn{J=j)b`%U%uEM-94e>G!<-?HJ+Altx(H896`Qs7E-R~@*5DL zI{unBU+&$NoLNiG!rfG60SG(4fLDqJ5P4ckMs*XZUmSxT%3K>}wu)Wk*?xmgUxY)` zwj8`D*^`k_4Jtm3WQc=fV=h7FAbEh zFbZ*V*I?nq-SO9ta27SJLI`JT&N3PT*~!(1jUvw6-08)7o^2Z{!-~2Zg~-)l+;12B z8~Tun)W(GbtU(c$7f?gVJlD3BlR~teT3xozpWk7tUop@zr@a^;H}s}d84WAj7bh(n zYHfcY=R7c&L}e4QCK1xy=hFp6atxLoV7eYp8R?uosd=n$Dx8mrGLY!3C@!J*Ee#?j zOG>5J!S0a`{2|0%zZ~J%X0!t=_{bzRLcPh9Zd%FNSKUZS9jhIpU#w&*-?6_Xx;${# zySO(m^Z>yO4=V0LDGBJlcRw)*$ljd~r^lX=35Q?QcFx-Wy#Ms0L7aL+KisU!qM`tx z0giFTI1^<*sEeZq@2>TCQiuc+EEBfxbu&kCBeAwP{H znfKZTfIr#o#)}eD7}z^0ozL=5lYulhAKYYCnK@U1b$jzCyAm#4L2WAkuIUYE8N`tG zn~_;@tO z6oCA?2U@`B*=sSYB2aKAcezb=y?HT}W*4p}pWB^qMdZ`#RFm_ban{>aCV=`gEoGEqxfb8X>y-kg6xo|rvnK$7)E4f+tx^$LRc=Zj3?CUpN;sy|80-RO2_%U z8Ll>6Y^ada;hbwVe0$WHcNa1M4oY^N&4ng#0PStxeRnQn>_$qB7D2x5 z+=)g&_4a}P`Rg8EecvQ=yJx!H%*9HaA}aLLg;)-^h@+AEwIo?_^#1(oQ-3dfsqqYo S1K@aNKszTH@N3${6u + * @copyright 2007-2020 PrestaShop SA + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +/* SSL Management */ +$useSSL = true; + +include dirname(__FILE__).'/../../config/config.inc.php'; +include dirname(__FILE__).'/../../header.php'; +include_once dirname(__FILE__).'/mailalerts.php'; + +// Instance of module class for translations +$module = new MailAlerts(); + +$errors = array(); + +if ($cookie->isLogged()) { + if (Tools::getValue('action') == 'delete') { + $id_customer = (int) $cookie->id_customer; + if (!$id_product = (int) Tools::getValue('id_product')) { + $errors[] = $module->trans('You must have a product to delete an alert.', array(), 'Modules.Mailalerts.Admin'); + } + $id_product_attribute = (int) Tools::getValue('id_product_attribute'); + $customer = new Customer((int) $id_customer); + MailAlerts::deleteAlert((int) $id_customer, (string) $customer->email, (int) $id_product, (int) $id_product_attribute); + } + $this->context->smarty->assign('mailAlerts', MailAlert::getProductsAlerts((int) $cookie->id_customer, (int) $cookie->id_lang)); +} else { + $errors[] = $module->trans('You must be logged in to manage your alerts.', array(), 'Modules.Mailalerts.Admin'); +} + +$this->context->smarty->assign(array( + 'id_customer' => (int) $cookie->id_customer, + 'errors' => $errors, +)); + +if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/mailalerts/myalerts.tpl')) { + $smarty->display(_PS_THEME_DIR_.'modules/mailalerts/myalerts.tpl'); +} elseif (Tools::file_exists_cache(dirname(__FILE__).'/myalerts.tpl')) { + $smarty->display(dirname(__FILE__).'/myalerts.tpl'); +} else { + echo $module->trans('No template found', array(), 'Modules.Mailalerts.Admin'); +} + +include dirname(__FILE__).'/../../footer.php'; diff --git a/modules/ps_emailalerts/mailalerts-ajax.php b/modules/ps_emailalerts/mailalerts-ajax.php new file mode 100644 index 00000000..f2c634c3 --- /dev/null +++ b/modules/ps_emailalerts/mailalerts-ajax.php @@ -0,0 +1,27 @@ + + * @copyright 2007-2020 PrestaShop SA + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + * International Registered Trademark & Property of PrestaShop SA + */ +require_once dirname(__FILE__).'/../../config/config.inc.php'; +require_once dirname(__FILE__).'/../../init.php'; diff --git a/modules/ps_emailalerts/mailalerts-extra.php b/modules/ps_emailalerts/mailalerts-extra.php new file mode 100644 index 00000000..74373b3f --- /dev/null +++ b/modules/ps_emailalerts/mailalerts-extra.php @@ -0,0 +1,119 @@ +{* +* 2007-2020 PrestaShop. +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License 3.0 (AFL-3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* https://opensource.org/licenses/AFL-3.0 +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2020 PrestaShop SA +* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + +{if !$isCustomerMailAlert AND $isLogged} +
  • + {l s='Add this product to my favorites' mod='mailalerts'} +
  • +{/if} +{if $isCustomerMailAlert AND $isLogged} +
  • + {l s='Remove this product from my favorites' mod='mailalerts'} +
  • +{/if} + +
  • + {l s='Remove this product from my favorites' mod='mailalerts'} +
  • +
  • + {l s='Add this product to my favorites' mod='mailalerts'} +
  • diff --git a/modules/ps_emailalerts/mails/en/customer_qty.html b/modules/ps_emailalerts/mails/en/customer_qty.html new file mode 100644 index 00000000..58772b23 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/customer_qty.html @@ -0,0 +1,115 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Hi, + +
    + + + + + + +
      + +

    + {product} is now available.

    + + This item is once again in-stock.

    + You can access the product page by clicking on the link: {product}
    + You can order it right now from our online shop.
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/customer_qty.txt b/modules/ps_emailalerts/mails/en/customer_qty.txt new file mode 100644 index 00000000..82aedb0e --- /dev/null +++ b/modules/ps_emailalerts/mails/en/customer_qty.txt @@ -0,0 +1,15 @@ + +[{shop_url}] + +Hi, + +This item is once again in-stock. + +You can access the product page by clicking on the link: {product} +[{product_link}] + +You can order it right now from our online shop. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/en/index.php b/modules/ps_emailalerts/mails/en/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/mails/en/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/mails/en/new_order.html b/modules/ps_emailalerts/mails/en/new_order.html new file mode 100644 index 00000000..a3ca33ad --- /dev/null +++ b/modules/ps_emailalerts/mails/en/new_order.html @@ -0,0 +1,401 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Congratulations! + +
    + + A new order was placed on {shop_name} by the following customer: {firstname} {lastname} ({email}) + +
    + + + + + + +
      + +

    + Order details

    + + Order: {order_name} Placed on {date}

    + Payment: {payment} +
    +
    +
     
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ReferenceProductUnit priceQuantityTotal price
    +   {items} +
    + + + + + + +
      + + Products + +  
    +
    + + + + + + +
      + + {total_products} + +  
    +
    + + + + + + +
      + + Discounts + +  
    +
    + + + + + + +
      + + {total_discounts} + +  
    +
    + + + + + + +
      + + Gift-wrapping + +  
    +
    + + + + + + +
      + + {total_wrapping} + +  
    +
    + + + + + + +
      + + Shipping + +  
    +
    + + + + + + +
      + + {total_shipping} + +  
    +
    + + + + + + +
      + + Total Tax paid + +  
    +
    + + + + + + +
      + + {total_tax_paid} + +  
    +
    + + + + + + +
      + + Total paid + +  
    +
    + + + + + + +
      + + {total_paid} + +  
    +
    +
    +
    + + + + + + +
      + +

    + Carrier:

    + + {carrier} + +
    +
     
    +
    + + + + + + +
    + + + + + + +
      + +

    + Delivery address

    + + {delivery_block_html} + +
    +
     
    +
      + + + + + + +
      + +

    + Billing address

    + + {invoice_block_html} + +
    +
     
    +
    +
    + + + + + + +
      + +

    + Customer message:

    + + {message} + +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/new_order.txt b/modules/ps_emailalerts/mails/en/new_order.txt new file mode 100644 index 00000000..5dc1a947 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/new_order.txt @@ -0,0 +1,59 @@ + +[{shop_url}] + +Congratulations! + +A new order was placed on {shop_name} by the following customer: +{firstname} {lastname} ({email}) + +ORDER: {order_name} Placed on {date} + +PAYMENT: {payment} + +REFERENCE + +PRODUCT + +UNIT PRICE + +QUANTITY + +TOTAL PRICE + +{items} + +PRODUCTS + +{total_products} + +DISCOUNTS + +{total_discounts} + +GIFT-WRAPPING + +{total_wrapping} + +SHIPPING + +{total_shipping} + +TOTAL TAX PAID + +{total_tax_paid} + +TOTAL PAID + +{total_paid} + +{carrier} + +{delivery_block_html} + +{invoice_block_html} + +{message} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/en/order_changed.html b/modules/ps_emailalerts/mails/en/order_changed.html new file mode 100644 index 00000000..d6a22596 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/order_changed.html @@ -0,0 +1,130 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Hi {firstname} {lastname}, + +
    + + + + + + +
      + +

    + Order {order_name} - Order edited

    + + Your order with the reference {order_name} from {shop_name} has been modified. +
    +
     
    +
    + + + You can review your order and download your invoice from the "Order history" section of your customer account by clicking "My account" on our shop. + +
    + + + If you have a guest account, you can follow your order via the "Guest Tracking" section on our shop. + +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/order_changed.txt b/modules/ps_emailalerts/mails/en/order_changed.txt new file mode 100644 index 00000000..e73e7010 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/order_changed.txt @@ -0,0 +1,21 @@ + +[{shop_url}] + +Hi {firstname} {lastname}, + +Your order with the reference {order_name} from {shop_name} has +been modified. + +You can review your order and download your invoice from the +"Order history" [{history_url}] section of your +customer account by clicking "My account" +[{my_account_url}] on our shop. + +If you have a guest account, you can follow your order via the +"Guest Tracking" +[{guest_tracking_url}?id_order={order_name}] section +on our shop. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/en/productcoverage.html b/modules/ps_emailalerts/mails/en/productcoverage.html new file mode 100644 index 00000000..52bc6dde --- /dev/null +++ b/modules/ps_emailalerts/mails/en/productcoverage.html @@ -0,0 +1,115 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Hi, + +
    + + + + + + +
      + +

    + {product} is almost out of stock.

    + + The stock cover is now less than the specified minimum of: {warning_coverage}.

    + Current stock cover: {current_coverage} +
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/productcoverage.txt b/modules/ps_emailalerts/mails/en/productcoverage.txt new file mode 100644 index 00000000..1b865760 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/productcoverage.txt @@ -0,0 +1,13 @@ + +[{shop_url}] + +Hi, + +The stock cover is now less than the specified minimum of: +{warning_coverage}. + +CURRENT STOCK COVER: {current_coverage} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/en/productoutofstock.html b/modules/ps_emailalerts/mails/en/productoutofstock.html new file mode 100644 index 00000000..3d936f08 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/productoutofstock.html @@ -0,0 +1,115 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Hi, + +
    + + + + + + +
      + +

    + {product} is nearly out of stock.

    + + The remaining stock is now less than the specified minimum of {last_qty}.

    + Remaining stock: {qty}

    + You are advised to open the product's admin Product Page in order to replenish your inventory.
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/productoutofstock.txt b/modules/ps_emailalerts/mails/en/productoutofstock.txt new file mode 100644 index 00000000..a0d36311 --- /dev/null +++ b/modules/ps_emailalerts/mails/en/productoutofstock.txt @@ -0,0 +1,16 @@ + +[{shop_url}] + +Hi, + +The remaining stock is now less than the specified minimum of +{last_qty}. + +REMAINING STOCK: {qty} + +You are advised to open the product's admin Product Page in order to +replenish your inventory. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/en/return_slip.html b/modules/ps_emailalerts/mails/en/return_slip.html new file mode 100644 index 00000000..4ca518be --- /dev/null +++ b/modules/ps_emailalerts/mails/en/return_slip.html @@ -0,0 +1,169 @@ + + + + + + Message from {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Hi, + +
    + You have received a new return request for {shop_name}. +
    +

    + Return details

    + + Order: {order_name} Placed on {date}
    + Customer: {firstname} {lastname}, ({email}) +
    +
    + + + + + + + + + + + + + +
    ReferenceProductQuantity
    + {items} +
    +
    + + + + + + +
    +

    Delivery address

    + + {delivery_block_html} + +
      +

    Billing address

    + + {invoice_block_html} + +
    +
    +

    + Customer message:

    + + {message} + +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/en/return_slip.txt b/modules/ps_emailalerts/mails/en/return_slip.txt new file mode 100644 index 00000000..c569175a --- /dev/null +++ b/modules/ps_emailalerts/mails/en/return_slip.txt @@ -0,0 +1,36 @@ + +[{shop_url}] + +Hi, + +You have received a new return request for {shop_name}. + +Return details + +ORDER: {order_name} Placed on {date} + +CUSTOMER: {firstname} {lastname}, ({email}) + +REFERENCE + +PRODUCT + +QUANTITY + +{items} + +Delivery address + +{delivery_block_html} + +Billing address + +{invoice_block_html} + +Customer message: + +{message} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/index.php b/modules/ps_emailalerts/mails/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/mails/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/mails/sk/customer_qty.html b/modules/ps_emailalerts/mails/sk/customer_qty.html new file mode 100644 index 00000000..af6912c5 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/customer_qty.html @@ -0,0 +1,115 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Dobrý deň, + +
    + + + + + + +
      + +

    + {product} je od teraz dostupný.

    + + Tento produkt je znovu skladom.

    + Stránku produktu môžete zobraziť kliknutím na odkaz: {product}
    + Môžete si ho objednať práve teraz z nášho obchodu.
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/customer_qty.txt b/modules/ps_emailalerts/mails/sk/customer_qty.txt new file mode 100644 index 00000000..842362db --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/customer_qty.txt @@ -0,0 +1,15 @@ + +[{shop_url}] + +Dobrý deň, + +Tento produkt je znovu skladom. + +Stránku produktu môžete zobraziť kliknutím na odkaz: {product} +[{product_link}] + +Môžete si ho objednať práve teraz z nášho obchodu. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/sk/new_order.html b/modules/ps_emailalerts/mails/sk/new_order.html new file mode 100644 index 00000000..956010af --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/new_order.html @@ -0,0 +1,401 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Gratulujeme! + +
    + + Nová objednávka bola vytvorená v obchode {shop_name} zákazníkom: {firstname} {lastname} ({email}) + +
    + + + + + + +
      + +

    + Detaily objednávky

    + + Objednávka: {order_name} Vytvorená {date}

    + Platba: {payment} +
    +
    +
     
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KódProduktJednotková cenaMnožstvoCelková cena
    +   {items} +
    + + + + + + +
      + + Produkty + +  
    +
    + + + + + + +
      + + {total_products} + +  
    +
    + + + + + + +
      + + Zľavy + +  
    +
    + + + + + + +
      + + {total_discounts} + +  
    +
    + + + + + + +
      + + Darčekové balenie + +  
    +
    + + + + + + +
      + + {total_wrapping} + +  
    +
    + + + + + + +
      + + Doručenie + +  
    +
    + + + + + + +
      + + {total_shipping} + +  
    +
    + + + + + + +
      + + Zaplatená daň + +  
    +
    + + + + + + +
      + + {total_tax_paid} + +  
    +
    + + + + + + +
      + + Celkom zaplatené + +  
    +
    + + + + + + +
      + + {total_paid} + +  
    +
    +
    +
    + + + + + + +
      + +

    + Prepravca:

    + + {carrier} + +
    +
     
    +
    + + + + + + +
    + + + + + + +
      + +

    + Adresa doručenia

    + + {delivery_block_html} + +
    +
     
    +
      + + + + + + +
      + +

    + Fakturačná adresa

    + + {invoice_block_html} + +
    +
     
    +
    +
    + + + + + + +
      + +

    + Správa od zákazníka:

    + + {message} + +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/new_order.txt b/modules/ps_emailalerts/mails/sk/new_order.txt new file mode 100644 index 00000000..c83d3a60 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/new_order.txt @@ -0,0 +1,59 @@ + +[{shop_url}] + +Gratulujeme! + +Nová objednávka bola vytvorená v obchode {shop_name} +zákazníkom: {firstname} {lastname} ({email}) + +OBJEDNÁVKA: {order_name} Vytvorená {date} + +PLATBA: {payment} + +KÓD + +PRODUKT + +JEDNOTKOVÁ CENA + +MNOŽSTVO + +CELKOVÁ CENA + +{items} + +PRODUKTY + +{total_products} + +ZĽAVY + +{total_discounts} + +DARČEKOVÉ BALENIE + +{total_wrapping} + +DORUČENIE + +{total_shipping} + +ZAPLATENÁ DAŇ + +{total_tax_paid} + +CELKOM ZAPLATENÉ + +{total_paid} + +{carrier} + +{delivery_block_html} + +{invoice_block_html} + +{message} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/sk/order_changed.html b/modules/ps_emailalerts/mails/sk/order_changed.html new file mode 100644 index 00000000..cd61a12d --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/order_changed.html @@ -0,0 +1,132 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Dobrý deň {firstname} {lastname}, + +
    + + + + + + +
      + +

    + Objednávka {order_name} - Úprava objednávky

    + + Vaša objednávka číslo {order_name} bola upravená. +
    +
     
    +
    + + + Podrobnosti o objednávke spolu s Vašou faktúrou nájdete vo Vašom zákazníckom "Účte" po kliknutí na "História objednávok". + +
    + + + Ak nemáte v našom obchode založený účet, stav objednávky môžete sledovať v časti "Sledovanie objednávok pre neregistrovaných zákazníkov". + +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/order_changed.txt b/modules/ps_emailalerts/mails/sk/order_changed.txt new file mode 100644 index 00000000..d9b30899 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/order_changed.txt @@ -0,0 +1,20 @@ + +[{shop_url}] + +Dobrý deň {firstname} {lastname}, + +Vaša objednávka číslo {order_name} bola upravená. + +Podrobnosti o objednávke spolu s Vašou faktúrou nájdete vo +Vašom zákazníckom "Účte" [{my_account_url}] po +kliknutí na "História objednávok" +[{history_url}]. + +Ak nemáte v našom obchode založený účet, stav objednávky +môžete sledovať v časti "Sledovanie objednávok pre +neregistrovaných zákazníkov" +[{guest_tracking_url}?id_order={order_name}]. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/sk/productcoverage.html b/modules/ps_emailalerts/mails/sk/productcoverage.html new file mode 100644 index 00000000..45ae6c16 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/productcoverage.html @@ -0,0 +1,115 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Dobrý deň, + +
    + + + + + + +
      + +

    + {product} je takmer vypredaný.

    + + Množstvo na sklade je momentálne menšie ako špecifikované minimum: {warning_coverage}.

    + Momentálne množstvo na sklade: {current_coverage} +
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/productcoverage.txt b/modules/ps_emailalerts/mails/sk/productcoverage.txt new file mode 100644 index 00000000..01c3b5f7 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/productcoverage.txt @@ -0,0 +1,13 @@ + +[{shop_url}] + +Dobrý deň, + +Množstvo na sklade je momentálne menšie ako špecifikované +minimum: {warning_coverage}. + +MOMENTÁLNE MNOŽSTVO NA SKLADE: {current_coverage} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/sk/productoutofstock.html b/modules/ps_emailalerts/mails/sk/productoutofstock.html new file mode 100644 index 00000000..d40d3785 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/productoutofstock.html @@ -0,0 +1,115 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
    + + Dobrý deň, + +
    + + + + + + +
      + +

    + {product} je takmer vypredaný.

    + + Množstvo na sklade je momentálne menšie ako špecifikované minimum {last_qty}.

    + Na sklade zostáva: {qty}

    + Odporúčame otvoriť stránku produktu v administrácii a doplniť inventár.
    +
    +
     
    +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/productoutofstock.txt b/modules/ps_emailalerts/mails/sk/productoutofstock.txt new file mode 100644 index 00000000..3174eac2 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/productoutofstock.txt @@ -0,0 +1,16 @@ + +[{shop_url}] + +Dobrý deň, + +Množstvo na sklade je momentálne menšie ako špecifikované +minimum {last_qty}. + +NA SKLADE ZOSTÁVA: {qty} + +Odporúčame otvoriť stránku produktu v administrácii a doplniť +inventár. + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/mails/sk/return_slip.html b/modules/ps_emailalerts/mails/sk/return_slip.html new file mode 100644 index 00000000..1b6375d5 --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/return_slip.html @@ -0,0 +1,169 @@ + + + + + + Správa z obchodu {shop_name} + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + Dobrý deň, + +
    + Obdržali ste novú žiadosť o vrátenie tovaru v obchode {shop_name}. +
    +

    + Detaily k vráteniu tovaru

    + + Objednávka: {order_name} vytvorená dňa {date}
    + Zákazník: {firstname} {lastname}, ({email}) +
    +
    + + + + + + + + + + + + + +
    KódProduktMnožstvo
    + {items} +
    +
    + + + + + + +
    +

    Adresa doručenia

    + + {delivery_block_html} + +
      +

    Fakturačná adresa

    + + {invoice_block_html} + +
    +
    +

    + Správa od zákazníka:

    + + {message} + +
    +
     
    + + \ No newline at end of file diff --git a/modules/ps_emailalerts/mails/sk/return_slip.txt b/modules/ps_emailalerts/mails/sk/return_slip.txt new file mode 100644 index 00000000..a102ba4e --- /dev/null +++ b/modules/ps_emailalerts/mails/sk/return_slip.txt @@ -0,0 +1,37 @@ + +[{shop_url}] + +Dobrý deň, + +Obdržali ste novú žiadosť o vrátenie tovaru v obchode +{shop_name}. + +Detaily k vráteniu tovaru + +OBJEDNÁVKA: {order_name} vytvorená dňa {date} + +ZÁKAZNÍK: {firstname} {lastname}, ({email}) + +KÓD + +PRODUKT + +MNOŽSTVO + +{items} + +Adresa doručenia + +{delivery_block_html} + +Fakturačná adresa + +{invoice_block_html} + +Správa od zákazníka: + +{message} + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/modules/ps_emailalerts/ps_emailalerts.php b/modules/ps_emailalerts/ps_emailalerts.php new file mode 100644 index 00000000..6912d92b --- /dev/null +++ b/modules/ps_emailalerts/ps_emailalerts.php @@ -0,0 +1,1339 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +$autoloadPath = __DIR__ . '/vendor/autoload.php'; +if (file_exists($autoloadPath)) { + require_once $autoloadPath; +} + +include_once dirname(__FILE__) . '/MailAlert.php'; + +class Ps_EmailAlerts extends Module +{ + /** @var string Page name */ + public $page_name; + + /** + * @var string Name of the module running on PS 1.6.x. Used for data migration. + */ + const PS_16_EQUIVALENT_MODULE = 'mailalerts'; + + protected $html = ''; + + protected $merchant_new_order_emails; + protected $merchant_oos_emails; + protected $merchant_return_slip_emails; + protected $merchant_order; + protected $merchant_oos; + protected $customer_qty; + protected $merchant_coverage; + protected $product_coverage; + protected $order_edited; + protected $return_slip; + + const __MA_MAIL_DELIMITER__ = ','; + + public function __construct() + { + $this->name = 'ps_emailalerts'; + $this->tab = 'administration'; + $this->version = '3.0.1'; + $this->author = 'PrestaShop'; + $this->need_instance = 0; + + $this->controllers = ['account']; + + $this->bootstrap = true; + parent::__construct(); + + if ($this->id) { + $this->init(); + } + + $this->displayName = $this->trans('Mail alerts', [], 'Modules.Emailalerts.Admin'); + $this->description = $this->trans('Make your everyday life easier, handle mail alerts about stock and orders, addressed to you as well as your customers.', [], 'Modules.Emailalerts.Admin'); + $this->ps_versions_compliancy = [ + 'min' => '1.7.7.0', + 'max' => _PS_VERSION_, + ]; + } + + protected function init() + { + $this->merchant_new_order_emails = (string) Configuration::get('MA_MERCHANT_ORDER_EMAILS'); + $this->merchant_oos_emails = (string) Configuration::get('MA_MERCHANT_OOS_EMAILS'); + $this->merchant_return_slip_emails = (string) Configuration::get('MA_RETURN_SLIP_EMAILS'); + $this->merchant_order = (int) Configuration::get('MA_MERCHANT_ORDER'); + $this->merchant_oos = (int) Configuration::get('MA_MERCHANT_OOS'); + $this->customer_qty = (int) Configuration::get('MA_CUSTOMER_QTY'); + $this->merchant_coverage = (int) Configuration::getGlobalValue('MA_MERCHANT_COVERAGE'); + $this->product_coverage = (int) Configuration::getGlobalValue('MA_PRODUCT_COVERAGE'); + $this->order_edited = (int) Configuration::getGlobalValue('MA_ORDER_EDIT'); + $this->return_slip = (int) Configuration::getGlobalValue('MA_RETURN_SLIP'); + } + + public function install($delete_params = true) + { + if (!parent::install() + || !$this->registerHook('actionValidateOrder') + || !$this->registerHook('actionUpdateQuantity') + || !$this->registerHook('displayCustomerAccount') + || !$this->registerHook('displayMyAccountBlock') + || !$this->registerHook('actionProductDelete') + || !$this->registerHook('actionProductAttributeDelete') + || !$this->registerHook('actionProductAttributeUpdate') + || !$this->registerHook('actionProductCoverage') + || !$this->registerHook('actionOrderReturn') + || !$this->registerHook('actionOrderEdited') + || !$this->registerHook('registerGDPRConsent') + || !$this->registerHook('actionDeleteGDPRCustomer') + || !$this->registerHook('actionExportGDPRData') + || !$this->registerHook('displayProductAdditionalInfo') + || !$this->registerHook('actionFrontControllerSetMedia') + || !$this->registerHook('actionAdminControllerSetMedia')) { + return false; + } + + if ($delete_params && $this->uninstallPrestaShop16Module()) { + Configuration::updateValue('MA_MERCHANT_ORDER', 1); + Configuration::updateValue('MA_MERCHANT_OOS', 1); + Configuration::updateValue('MA_CUSTOMER_QTY', 1); + Configuration::updateValue('MA_ORDER_EDIT', 1); + Configuration::updateValue('MA_RETURN_SLIP', 1); + Configuration::updateValue('MA_MERCHANT_MAILS', Configuration::get('PS_SHOP_EMAIL')); + Configuration::updateValue('MA_LAST_QTIES', (int) Configuration::get('PS_LAST_QTIES')); + Configuration::updateGlobalValue('MA_MERCHANT_COVERAGE', 0); + Configuration::updateGlobalValue('MA_PRODUCT_COVERAGE', 0); + + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '` + ( + `id_customer` int(10) unsigned NOT NULL, + `customer_email` varchar(128) NOT NULL, + `id_product` int(10) unsigned NOT NULL, + `id_product_attribute` int(10) unsigned NOT NULL, + `id_shop` int(10) unsigned NOT NULL, + `id_lang` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_customer`,`customer_email`,`id_product`,`id_product_attribute`,`id_shop`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; + + if (!Db::getInstance()->execute($sql)) { + return false; + } + } + + return true; + } + + public function uninstall($delete_params = true) + { + if ($delete_params) { + Configuration::deleteByName('MA_MERCHANT_ORDER'); + Configuration::deleteByName('MA_MERCHANT_OOS'); + Configuration::deleteByName('MA_CUSTOMER_QTY'); + Configuration::deleteByName('MA_MERCHANT_MAILS'); + Configuration::deleteByName('MA_LAST_QTIES'); + Configuration::deleteByName('MA_MERCHANT_COVERAGE'); + Configuration::deleteByName('MA_PRODUCT_COVERAGE'); + Configuration::deleteByName('MA_ORDER_EDIT'); + Configuration::deleteByName('MA_RETURN_SLIP'); + + if (!Db::getInstance()->execute('DROP TABLE IF EXISTS ' . _DB_PREFIX_ . MailAlert::$definition['table'])) { + return false; + } + } + + return parent::uninstall(); + } + + /** + * Migrate data from 1.6 equivalent module (if applicable), then uninstall + */ + public function uninstallPrestaShop16Module() + { + if (!Module::isInstalled(self::PS_16_EQUIVALENT_MODULE)) { + return true; + } + $oldModule = Module::getInstanceByName(self::PS_16_EQUIVALENT_MODULE); + if ($oldModule) { + // This closure calls the parent class to prevent data to be erased + // It allows the new module to be configured without migration + $parentUninstallClosure = function () { + return parent::uninstall(); + }; + $parentUninstallClosure = $parentUninstallClosure->bindTo($oldModule, get_class($oldModule)); + $parentUninstallClosure(); + } + + return true; + } + + public function reset() + { + if (!$this->uninstall(false)) { + return false; + } + if (!$this->install(false)) { + return false; + } + + return true; + } + + public function getContent() + { + $this->context->controller->addJqueryUi('ui.widget'); + $this->context->controller->addJqueryPlugin('tagify'); + + $this->html = ''; + + $this->postProcess(); + + $this->html .= $this->renderForm(); + + return $this->html; + } + + protected function postProcess() + { + $errors = []; + + if (Tools::isSubmit('submitMailAlert')) { + if (!Configuration::updateValue('MA_CUSTOMER_QTY', (int) Tools::getValue('MA_CUSTOMER_QTY'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateGlobalValue('MA_ORDER_EDIT', (int) Tools::getValue('MA_ORDER_EDIT'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } + } elseif (Tools::isSubmit('submitMAMerchant')) { + $new_order_flag = (int) Tools::getValue('MA_MERCHANT_ORDER'); + $new_order_emails = (string) Tools::getValue('MA_MERCHANT_ORDER_EMAILS'); + + $outofstock_flag = (int) Tools::getValue('MA_MERCHANT_OOS'); + $outofstock_emails = (string) Tools::getValue('MA_MERCHANT_OOS_EMAILS'); + + $return_slip_flag = (int) Tools::getValue('MA_RETURN_SLIP'); + $return_slip_emails = (string) Tools::getValue('MA_RETURN_SLIP_EMAILS'); + + // Check new order e-mails (if setting is active) + if ($new_order_flag && empty($new_order_emails)) { + $errors[] = $this->trans('Please enter one (or more) email address for the new order notification.', [], 'Modules.Emailalerts.Admin'); + } else { + $new_order_emails = explode(self::__MA_MAIL_DELIMITER__, $new_order_emails); + foreach ($new_order_emails as $k => $email) { + $email = trim($email); + if (!empty($email) && !Validate::isEmail($email)) { + // Add error message and remove it + $errors[] = $this->trans('Invalid email:', [], 'Modules.Emailalerts.Admin') . ' ' . Tools::safeOutput($email); + unset($new_order_emails[$k]); + } elseif (!empty($email)) { + $new_order_emails[$k] = $email; + } else { + unset($new_order_emails[$k]); + } + } + $new_order_emails = implode(self::__MA_MAIL_DELIMITER__, $new_order_emails); + + if (!Configuration::updateValue('MA_MERCHANT_ORDER_EMAILS', (string) $new_order_emails)) { + $errors[] = $this->trans('Cannot update new order emails.', [], 'Modules.Emailalerts.Admin'); + } + } + + // Check out of stock e-mails (if setting is active) + if ($outofstock_flag && empty($outofstock_emails)) { + $errors[] = $this->trans('Please enter one (or more) email address for "out of stock" notifications.', [], 'Modules.Emailalerts.Admin'); + } else { + $outofstock_emails = explode(self::__MA_MAIL_DELIMITER__, $outofstock_emails); + foreach ($outofstock_emails as $k => $email) { + $email = trim($email); + if (!empty($email) && !Validate::isEmail($email)) { + // Add error message and remove it + $errors[] = $this->trans('Invalid email:', [], 'Modules.Emailalerts.Admin') . ' ' . Tools::safeOutput($email); + unset($outofstock_emails[$k]); + } elseif (!empty($email)) { + $outofstock_emails[$k] = $email; + } else { + unset($outofstock_emails[$k]); + } + } + $outofstock_emails = implode(self::__MA_MAIL_DELIMITER__, $outofstock_emails); + + if (!Configuration::updateValue('MA_MERCHANT_OOS_EMAILS', (string) $outofstock_emails)) { + $errors[] = $this->trans('Cannot update email for "out of stock" notifications.', [], 'Modules.Emailalerts.Admin'); + } + } + + // Check return slip e-mails (if setting is active) + if ($return_slip_flag && empty($return_slip_emails)) { + $errors[] = $this->trans('Please enter one (or more) email address for "return slip" notifications.', [], 'Modules.Emailalerts.Admin'); + } else { + $return_slip_emails = explode(self::__MA_MAIL_DELIMITER__, $return_slip_emails); + foreach ($return_slip_emails as $k => $email) { + $email = trim($email); + if (!empty($email) && !Validate::isEmail($email)) { + // Add error message and remove it + $errors[] = $this->trans('Invalid email:', [], 'Modules.Emailalerts.Admin') . ' ' . Tools::safeOutput($email); + unset($return_slip_emails[$k]); + } elseif (!empty($email)) { + $return_slip_emails[$k] = $email; + } else { + unset($return_slip_emails[$k]); + } + } + $return_slip_emails = implode(self::__MA_MAIL_DELIMITER__, $return_slip_emails); + + if (!Configuration::updateValue('MA_RETURN_SLIP_EMAILS', (string) $return_slip_emails)) { + $errors[] = $this->trans('Cannot update "return slip" emails.', [], 'Modules.Emailalerts.Admin'); + } + } + + if (!Configuration::updateValue('MA_MERCHANT_ORDER', (int) Tools::getValue('MA_MERCHANT_ORDER'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateValue('MA_MERCHANT_OOS', (int) Tools::getValue('MA_MERCHANT_OOS'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateValue('MA_LAST_QTIES', (int) Tools::getValue('MA_LAST_QTIES'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateGlobalValue('MA_MERCHANT_COVERAGE', (int) Tools::getValue('MA_MERCHANT_COVERAGE'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateGlobalValue('MA_PRODUCT_COVERAGE', (int) Tools::getValue('MA_PRODUCT_COVERAGE'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } elseif (!Configuration::updateGlobalValue('MA_RETURN_SLIP', (int) Tools::getValue('MA_RETURN_SLIP'))) { + $errors[] = $this->trans('Cannot update settings', [], 'Modules.Emailalerts.Admin'); + } + } + + if (count($errors) > 0) { + $this->html .= $this->displayError(implode('
    ', $errors)); + } elseif (Tools::isSubmit('submitMailAlert') || Tools::isSubmit('submitMAMerchant')) { + $this->html .= $this->displayConfirmation($this->trans('Settings updated successfully', [], 'Modules.Emailalerts.Admin')); + } + + $this->init(); + } + + public function getAllMessages($id) + { + $messages = Db::getInstance()->executeS(' + SELECT `message` + FROM `' . _DB_PREFIX_ . 'message` + WHERE `id_order` = ' . (int) $id . ' + ORDER BY `id_message` ASC'); + $result = []; + foreach ($messages as $message) { + $result[] = $message['message']; + } + + return implode('
    ', $result); + } + + /** + * Return current locale + * + * @param Context $context + * + * @return PrestaShop\PrestaShop\Core\Localization\Locale|null + * + * @throws Exception + */ + public static function getContextLocale(Context $context) + { + $locale = $context->getCurrentLocale(); + if (null !== $locale) { + return $locale; + } + + $containerFinder = new PrestaShop\PrestaShop\Adapter\ContainerFinder($context); + $container = $containerFinder->getContainer(); + if (null === $context->container) { + // @phpstan-ignore-next-line + $context->container = $container; + } + + /** @var PrestaShop\PrestaShop\Core\Localization\CLDR\LocaleRepository $localeRepository */ + $localeRepository = $container->get(Controller::SERVICE_LOCALE_REPOSITORY); + $locale = $localeRepository->getLocale( + $context->language->getLocale() + ); + + // @phpstan-ignore-next-line + return $locale; + } + + public function hookActionValidateOrder($params) + { + if (!$this->merchant_order || empty($this->merchant_new_order_emails)) { + return; + } + + // Getting differents vars + $context = Context::getContext(); + $id_lang = (int) $context->language->id; + $locale = $context->language->getLocale(); + // We use use static method from current class to prevent retro compatibility issues with PrestaShop < 1.7.7 + $contextLocale = static::getContextLocale($context); + + $id_shop = (int) $context->shop->id; + $currency = $params['currency']; + $order = $params['order']; + $customer = $params['customer']; + $configuration = Configuration::getMultiple( + [ + 'PS_SHOP_EMAIL', + 'PS_MAIL_METHOD', + 'PS_MAIL_SERVER', + 'PS_MAIL_USER', + 'PS_MAIL_PASSWD', + 'PS_SHOP_NAME', + 'PS_MAIL_COLOR', + ], $id_lang, null, $id_shop + ); + $delivery = new Address((int) $order->id_address_delivery); + $invoice = new Address((int) $order->id_address_invoice); + $order_date_text = Tools::displayDate($order->date_add); + $carrier = new Carrier((int) $order->id_carrier); + $message = $this->getAllMessages($order->id); + + if (!$message || empty($message)) { + $message = $this->trans('No message', [], 'Modules.Emailalerts.Admin'); + } + + $items_table = ''; + + $products = $params['order']->getProducts(); + $customized_datas = Product::getAllCustomizedDatas((int) $params['cart']->id); + Product::addCustomizationPrice($products, $customized_datas); + foreach ($products as $key => $product) { + $unit_price = Product::getTaxCalculationMethod($customer->id) == PS_TAX_EXC ? $product['product_price'] : $product['product_price_wt']; + + $customization_text = ''; + if (isset($customized_datas[$product['product_id']][$product['product_attribute_id']][$order->id_address_delivery][$product['id_customization']])) { + foreach ($customized_datas[$product['product_id']][$product['product_attribute_id']][$order->id_address_delivery][$product['id_customization']] as $customization) { + if (isset($customization[Product::CUSTOMIZE_TEXTFIELD])) { + foreach ($customization[Product::CUSTOMIZE_TEXTFIELD] as $text) { + $customization_text .= $text['name'] . ': ' . $text['value'] . '
    '; + } + $customization_text .= '---
    '; + } + + if (isset($customization[Product::CUSTOMIZE_FILE])) { + $customization_text .= count($customization[Product::CUSTOMIZE_FILE]) . ' ' . $this->trans('image(s)', [], 'Modules.Emailalerts.Admin') . '
    '; + $customization_text .= '---
    '; + } + } + if (method_exists('Tools', 'rtrimString')) { + $customization_text = Tools::rtrimString($customization_text, '---
    '); + } else { + $customization_text = preg_replace('/---
    $/', '', $customization_text); + } + } + + $url = $context->link->getProductLink($product['product_id']); + $items_table .= + ' + ' . $product['product_reference'] . ' + + ' . $product['product_name'] . '' + . (isset($product['attributes_small']) ? ' ' . $product['attributes_small'] : '') + . (!empty($customization_text) ? '
    ' . $customization_text : '') + . '
    + + ' . $contextLocale->formatPrice($unit_price, $currency->iso_code) . ' + ' . (int) $product['product_quantity'] . ' + ' + . $contextLocale->formatPrice($unit_price * $product['product_quantity'], $currency->iso_code) + . ' + '; + } + foreach ($params['order']->getCartRules() as $discount) { + $items_table .= + ' + ' . $this->trans('Voucher code:', [], 'Modules.Emailalerts.Admin') . ' ' . $discount['name'] . ' + -' . $contextLocale->formatPrice($discount['value'], $currency->iso_code) . ' + '; + } + if ($delivery->id_state) { + $delivery_state = new State((int) $delivery->id_state); + } + if ($invoice->id_state) { + $invoice_state = new State((int) $invoice->id_state); + } + + if (Product::getTaxCalculationMethod($customer->id) == PS_TAX_EXC) { + $total_products = $order->getTotalProductsWithoutTaxes(); + } else { + $total_products = $order->getTotalProductsWithTaxes(); + } + + $order_state = $params['orderStatus']; + + // Filling-in vars for email + $template_vars = [ + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{email}' => $customer->email, + '{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"), + '{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"), + '{delivery_block_html}' => MailAlert::getFormatedAddress( + $delivery, '
    ', [ + 'firstname' => '%s', + 'lastname' => '%s', + ] + ), + '{invoice_block_html}' => MailAlert::getFormatedAddress( + $invoice, '
    ', [ + 'firstname' => '%s', + 'lastname' => '%s', + ] + ), + '{delivery_company}' => $delivery->company, + '{delivery_firstname}' => $delivery->firstname, + '{delivery_lastname}' => $delivery->lastname, + '{delivery_address1}' => $delivery->address1, + '{delivery_address2}' => $delivery->address2, + '{delivery_city}' => $delivery->city, + '{delivery_postal_code}' => $delivery->postcode, + '{delivery_country}' => $delivery->country, + '{delivery_state}' => isset($delivery_state->name) ? $delivery_state->name : '', + '{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile, + '{delivery_other}' => $delivery->other, + '{invoice_company}' => $invoice->company, + '{invoice_firstname}' => $invoice->firstname, + '{invoice_lastname}' => $invoice->lastname, + '{invoice_address2}' => $invoice->address2, + '{invoice_address1}' => $invoice->address1, + '{invoice_city}' => $invoice->city, + '{invoice_postal_code}' => $invoice->postcode, + '{invoice_country}' => $invoice->country, + '{invoice_state}' => isset($invoice_state->name) ? $invoice_state->name : '', + '{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile, + '{invoice_other}' => $invoice->other, + '{order_name}' => $order->reference, + '{order_status}' => $order_state->name, + '{shop_name}' => $configuration['PS_SHOP_NAME'], + '{date}' => $order_date_text, + '{carrier}' => (($carrier->name == '0') ? $configuration['PS_SHOP_NAME'] : $carrier->name), + '{payment}' => Tools::substr($order->payment, 0, 32), + '{items}' => $items_table, + '{total_paid}' => $contextLocale->formatPrice($order->total_paid, $currency->iso_code), + '{total_products}' => $contextLocale->formatPrice($total_products, $currency->iso_code), + '{total_discounts}' => $contextLocale->formatPrice($order->total_discounts, $currency->iso_code), + '{total_shipping}' => $contextLocale->formatPrice($order->total_shipping, $currency->iso_code), + '{total_shipping_tax_excl}' => $contextLocale->formatPrice($order->total_shipping_tax_excl, $currency->iso_code), + '{total_shipping_tax_incl}' => $contextLocale->formatPrice($order->total_shipping_tax_incl, $currency->iso_code), + '{total_tax_paid}' => $contextLocale->formatPrice( + $order->total_paid_tax_incl - $order->total_paid_tax_excl, + $currency->iso_code + ), + '{total_wrapping}' => $contextLocale->formatPrice($order->total_wrapping, $currency->iso_code), + '{currency}' => $currency->sign, + '{gift}' => (bool) $order->gift, + '{gift_message}' => $order->gift_message, + '{message}' => $message, + ]; + + // Shop iso + $iso = Language::getIsoById((int) Configuration::get('PS_LANG_DEFAULT')); + + // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients + $merchant_new_order_emails = explode(self::__MA_MAIL_DELIMITER__, $this->merchant_new_order_emails); + foreach ($merchant_new_order_emails as $merchant_mail) { + // Default language + $mail_id_lang = $id_lang; + $mail_iso = $iso; + + // Use the merchant lang if he exists as an employee + $results = Db::getInstance()->executeS(' + SELECT `id_lang` FROM `' . _DB_PREFIX_ . 'employee` + WHERE `email` = \'' . pSQL($merchant_mail) . '\' + '); + if ($results) { + $user_iso = Language::getIsoById((int) $results[0]['id_lang']); + if ($user_iso) { + $mail_id_lang = (int) $results[0]['id_lang']; + $mail_iso = $user_iso; + } + } + + $dir_mail = false; + if (file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/new_order.txt') + && file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/new_order.html')) { + $dir_mail = dirname(__FILE__) . '/mails/'; + } + + if (file_exists(_PS_MAIL_DIR_ . $mail_iso . '/new_order.txt') + && file_exists(_PS_MAIL_DIR_ . $mail_iso . '/new_order.html')) { + $dir_mail = _PS_MAIL_DIR_; + } + + if ($dir_mail) { + Mail::send( + $mail_id_lang, + 'new_order', + $this->trans( + 'New order : #%d - %s', + [ + $order->id, + $order->reference, + ], + 'Emails.Subject', + $locale), + $template_vars, + $merchant_mail, + null, + $configuration['PS_SHOP_EMAIL'], + $configuration['PS_SHOP_NAME'], + null, + null, + $dir_mail, + false, + $id_shop + ); + } + } + } + + public function hookDisplayProductAdditionalInfo($params) + { + if ($params['product']['minimal_quantity'] <= $params['product']['quantity'] + || !$this->customer_qty + || !Configuration::get('PS_STOCK_MANAGEMENT') + || Product::isAvailableWhenOutOfStock($params['product']['out_of_stock'])) { + return; + } + $context = Context::getContext(); + $id_product = (int) $params['product']['id']; + $id_product_attribute = $params['product']['id_product_attribute']; + $id_customer = (int) $context->customer->id; + if ((int) $context->customer->id <= 0) { + $this->context->smarty->assign('email', 1); + } elseif (MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, (int) $context->shop->id)) { + $this->context->smarty->assign('has_notification', 1); + } + $this->context->smarty->assign( + [ + 'id_product' => $id_product, + 'id_product_attribute' => $id_product_attribute, + 'id_module' => $this->id, + ] + ); + + return $this->display(__FILE__, 'product.tpl'); + } + + public function hookActionUpdateQuantity($params) + { + // Do not send email if stock did not change + if (isset($params['delta_quantity']) && (int) $params['delta_quantity'] === 0) { + return; + } + + $id_product = (int) $params['id_product']; + $id_product_attribute = (int) $params['id_product_attribute']; + + $context = Context::getContext(); + $id_shop = (int) $context->shop->id; + $id_lang = (int) $context->language->id; + $locale = $context->language->getLocale(); + $product = new Product($id_product, false, $id_lang, $id_shop, $context); + + if (!Validate::isLoadedObject($product) || $product->active != 1) { + return; + } + + $quantity = (int) $params['quantity']; + $product_has_attributes = $product->hasAttributes(); + $configuration = Configuration::getMultiple( + [ + 'MA_LAST_QTIES', + 'PS_STOCK_MANAGEMENT', + 'PS_SHOP_EMAIL', + 'PS_SHOP_NAME', + ], null, null, $id_shop + ); + $ma_last_qties = (int) $configuration['MA_LAST_QTIES']; + $check_oos = ($product_has_attributes && $id_product_attribute) || (!$product_has_attributes && !$id_product_attribute); + + if ($check_oos + && (int) $quantity <= $ma_last_qties + && !(!$this->merchant_oos || empty($this->merchant_oos_emails)) + && $configuration['PS_STOCK_MANAGEMENT']) { + $iso = Language::getIsoById($id_lang); + $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); + $template_vars = [ + '{qty}' => $quantity, + '{last_qty}' => $ma_last_qties, + '{product}' => $product_name, + ]; + + // Do not send mail if multiples product are created / imported. + if (!defined('PS_MASS_PRODUCT_CREATION') + && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productoutofstock.txt') + && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productoutofstock.html')) { + // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients + $merchant_oos_emails = explode(self::__MA_MAIL_DELIMITER__, $this->merchant_oos_emails); + foreach ($merchant_oos_emails as $merchant_mail) { + Mail::Send( + $id_lang, + 'productoutofstock', + $this->trans('Product out of stock', [], 'Emails.Subject', $locale), + $template_vars, + $merchant_mail, + null, + (string) $configuration['PS_SHOP_EMAIL'], + (string) $configuration['PS_SHOP_NAME'], + null, + null, + dirname(__FILE__) . '/mails/', + false, + $id_shop + ); + } + } + } + + if ($product_has_attributes) { + $sql = 'SELECT `minimal_quantity`, `id_product_attribute` + FROM ' . _DB_PREFIX_ . 'product_attribute + WHERE id_product_attribute = ' . (int) $id_product_attribute; + + $result = Db::getInstance()->getRow($sql); + + if ($result && $this->customer_qty && $quantity >= $result['minimal_quantity']) { + MailAlert::sendCustomerAlert((int) $product->id, (int) $params['id_product_attribute']); + } + } else { + if ($this->customer_qty && $quantity >= $product->minimal_quantity) { + MailAlert::sendCustomerAlert((int) $product->id, (int) $params['id_product_attribute']); + } + } + } + + public function hookActionProductAttributeUpdate($params) + { + $sql = 'SELECT sa.`id_product`, sa.`quantity`, pa.`minimal_quantity` + FROM `' . _DB_PREFIX_ . 'stock_available` sa + LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute pa ON sa.id_product_attribute = pa.id_product_attribute + WHERE sa.`id_product_attribute` = ' . (int) $params['id_product_attribute']; + + $result = Db::getInstance()->getRow($sql); + + if ($result && $this->customer_qty && $result['quantity'] >= $result['minimal_quantity']) { + MailAlert::sendCustomerAlert((int) $result['id_product'], (int) $params['id_product_attribute']); + } + } + + public function hookDisplayCustomerAccount($params) + { + return $this->customer_qty ? $this->display(__FILE__, 'my-account.tpl') : null; + } + + public function hookDisplayMyAccountBlock($params) + { + return $this->customer_qty ? $this->display(__FILE__, 'my-account-footer.tpl') : null; + } + + public function hookActionProductDelete($params) + { + $sql = ' + DELETE FROM `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '` + WHERE `id_product` = ' . (int) $params['product']->id; + + Db::getInstance()->execute($sql); + } + + public function hookActionProductAttributeDelete($params) + { + if ($params['deleteAllAttributes']) { + $sql = ' + DELETE FROM `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '` + WHERE `id_product` = ' . (int) $params['id_product']; + } else { + $sql = ' + DELETE FROM `' . _DB_PREFIX_ . MailAlert::$definition['table'] . '` + WHERE `id_product_attribute` = ' . (int) $params['id_product_attribute'] . ' + AND `id_product` = ' . (int) $params['id_product']; + } + + Db::getInstance()->execute($sql); + } + + public function hookActionProductCoverage($params) + { + // if not advanced stock management, nothing to do + if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { + return; + } + + // retrieves informations + $id_product = (int) $params['id_product']; + $id_product_attribute = (int) $params['id_product_attribute']; + $warehouse = $params['warehouse']; + $product = new Product($id_product); + + if (!Validate::isLoadedObject($product)) { + return; + } + + if (!$product->advanced_stock_management) { + return; + } + + // sets warehouse id to get the coverage + if (!Validate::isLoadedObject($warehouse)) { + $id_warehouse = 0; + } else { + $id_warehouse = (int) $warehouse->id; + } + + // coverage of the product + $warning_coverage = (int) Configuration::getGlobalValue('MA_PRODUCT_COVERAGE'); + + $coverage = StockManagerFactory::getManager()->getProductCoverage($id_product, $id_product_attribute, $warning_coverage, $id_warehouse); + + // if we need to send a notification + if ($product->active == 1 + && ($coverage < $warning_coverage) && !empty($this->merchant_mails) + && Configuration::getGlobalValue('MA_MERCHANT_COVERAGE')) { + $context = Context::getContext(); + $id_lang = (int) $context->language->id; + $locale = $context->language->getLocale(); + $id_shop = (int) $context->shop->id; + $iso = Language::getIsoById($id_lang); + $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); + $template_vars = [ + '{current_coverage}' => $coverage, + '{warning_coverage}' => $warning_coverage, + '{product}' => pSQL($product_name), + ]; + + if (file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productcoverage.txt') + && file_exists(dirname(__FILE__) . '/mails/' . $iso . '/productcoverage.html')) { + // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients + $merchant_oos_emails = explode(self::__MA_MAIL_DELIMITER__, $this->merchant_oos); + foreach ($merchant_oos_emails as $merchant_mail) { + Mail::send( + $id_lang, + 'productcoverage', + $this->trans('Stock coverage', [], 'Emails.Subject', $locale), + $template_vars, + $merchant_mail, + null, + (string) Configuration::get('PS_SHOP_EMAIL'), + (string) Configuration::get('PS_SHOP_NAME'), + null, + null, + dirname(__FILE__) . '/mails/', + false, + $id_shop + ); + } + } + } + } + + public function hookActionFrontControllerSetMedia() + { + $this->context->controller->registerJavascript( + 'mailalerts-js', + 'modules/' . $this->name . '/js/mailalerts.js' + ); + } + + public function hookActionAdminControllerSetMedia() + { + $this->context->controller->addJS($this->_path . 'js/admin/' . $this->name . '.js'); + } + + /** + * Send a mail when a customer return an order. + * + * @param array $params Hook params + */ + public function hookActionOrderReturn($params) + { + if (!$this->return_slip || empty($this->merchant_return_slip_emails)) { + return; + } + + $context = Context::getContext(); + $id_lang = (int) $context->language->id; + $locale = $context->language->getLocale(); + $id_shop = (int) $context->shop->id; + $configuration = Configuration::getMultiple( + [ + 'PS_SHOP_EMAIL', + 'PS_MAIL_METHOD', + 'PS_MAIL_SERVER', + 'PS_MAIL_USER', + 'PS_MAIL_PASSWD', + 'PS_SHOP_NAME', + 'PS_MAIL_COLOR', + ], $id_lang, null, $id_shop + ); + + // Shop iso + $iso = Language::getIsoById((int) Configuration::get('PS_LANG_DEFAULT')); + + $order = new Order((int) $params['orderReturn']->id_order); + $customer = new Customer((int) $params['orderReturn']->id_customer); + $delivery = new Address((int) $order->id_address_delivery); + $invoice = new Address((int) $order->id_address_invoice); + $order_date_text = Tools::displayDate($order->date_add); + if ($delivery->id_state) { + $delivery_state = new State((int) $delivery->id_state); + } + if ($invoice->id_state) { + $invoice_state = new State((int) $invoice->id_state); + } + + $order_return_products = OrderReturn::getOrdersReturnProducts($params['orderReturn']->id, $order); + + $items_table = ''; + foreach ($order_return_products as $key => $product) { + $url = $context->link->getProductLink($product['product_id']); + $items_table .= + ' + ' . $product['product_reference'] . ' + + ' . $product['product_name'] . ' + + + ' . (int) $product['product_quantity'] . ' + '; + } + + $template_vars = [ + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{email}' => $customer->email, + '{delivery_block_txt}' => MailAlert::getFormatedAddress($delivery, "\n"), + '{invoice_block_txt}' => MailAlert::getFormatedAddress($invoice, "\n"), + '{delivery_block_html}' => MailAlert::getFormatedAddress( + $delivery, '
    ', [ + 'firstname' => '%s', + 'lastname' => '%s', + ] + ), + '{invoice_block_html}' => MailAlert::getFormatedAddress( + $invoice, '
    ', [ + 'firstname' => '%s', + 'lastname' => '%s', + ] + ), + '{delivery_company}' => $delivery->company, + '{delivery_firstname}' => $delivery->firstname, + '{delivery_lastname}' => $delivery->lastname, + '{delivery_address1}' => $delivery->address1, + '{delivery_address2}' => $delivery->address2, + '{delivery_city}' => $delivery->city, + '{delivery_postal_code}' => $delivery->postcode, + '{delivery_country}' => $delivery->country, + '{delivery_state}' => isset($delivery_state->name) ? $delivery_state->name : '', + '{delivery_phone}' => isset($delivery->phone) ? $delivery->phone : $delivery->phone_mobile, + '{delivery_other}' => $delivery->other, + '{invoice_company}' => $invoice->company, + '{invoice_firstname}' => $invoice->firstname, + '{invoice_lastname}' => $invoice->lastname, + '{invoice_address2}' => $invoice->address2, + '{invoice_address1}' => $invoice->address1, + '{invoice_city}' => $invoice->city, + '{invoice_postal_code}' => $invoice->postcode, + '{invoice_country}' => $invoice->country, + '{invoice_state}' => isset($invoice_state->name) ? $invoice_state->name : '', + '{invoice_phone}' => isset($invoice->phone) ? $invoice->phone : $invoice->phone_mobile, + '{invoice_other}' => $invoice->other, + '{order_name}' => $order->reference, + '{shop_name}' => $configuration['PS_SHOP_NAME'], + '{date}' => $order_date_text, + '{items}' => $items_table, + '{message}' => Tools::purifyHTML($params['orderReturn']->question), + ]; + + // Send 1 email by merchant mail, because Mail::Send doesn't work with an array of recipients + $merchant_return_slip_emails = explode(self::__MA_MAIL_DELIMITER__, $this->merchant_return_slip_emails); + foreach ($merchant_return_slip_emails as $merchant_mail) { + // Default language + $mail_id_lang = $id_lang; + $mail_iso = $iso; + $mail_locale = $locale; + + // Use the merchant lang if he exists as an employee + $results = Db::getInstance()->executeS(' + SELECT `id_lang` FROM `' . _DB_PREFIX_ . 'employee` + WHERE `email` = \'' . pSQL($merchant_mail) . '\' + '); + if ($results) { + $user_iso = Language::getIsoById((int) $results[0]['id_lang']); + if ($user_iso) { + $mail_id_lang = (int) $results[0]['id_lang']; + $mail_iso = $user_iso; + $mail_locale = Language::getLocaleByIso($user_iso); + } + } + + $dir_mail = false; + if (file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/return_slip.txt') + && file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/return_slip.html')) { + $dir_mail = dirname(__FILE__) . '/mails/'; + } + + if (file_exists(_PS_MAIL_DIR_ . $mail_iso . '/return_slip.txt') + && file_exists(_PS_MAIL_DIR_ . $mail_iso . '/return_slip.html')) { + $dir_mail = _PS_MAIL_DIR_; + } + + if ($dir_mail) { + Mail::send( + $mail_id_lang, + 'return_slip', + $this->trans( + 'New return from order #%d - %s', + [ + $order->id, + $order->reference, + ], + 'Emails.Subject', + $mail_locale + ), + $template_vars, + $merchant_mail, + null, + $configuration['PS_SHOP_EMAIL'], + $configuration['PS_SHOP_NAME'], + null, + null, + $dir_mail, + false, + $id_shop + ); + } + } + } + + /** + * Send a mail when an order is modified. + * + * @param array $params Hook params + */ + public function hookActionOrderEdited($params) + { + if (!$this->order_edited || empty($this->order_edited)) { + return; + } + + $order = $params['order']; + $id_lang = (int) $order->id_lang; + $lang = new Language($id_lang); + if (Validate::isLoadedObject($lang)) { + $locale = $lang->getLocale(); + } else { + $locale = $this->context->language->getLocale(); + } + + $data = [ + '{lastname}' => $order->getCustomer()->lastname, + '{firstname}' => $order->getCustomer()->firstname, + '{id_order}' => (int) $order->id, + '{order_name}' => $order->getUniqReference(), + ]; + + Mail::Send( + (int) $order->id_lang, + 'order_changed', + $this->trans('Your order has been changed', [], 'Emails.Subject', $locale), + $data, + $order->getCustomer()->email, + $order->getCustomer()->firstname . ' ' . $order->getCustomer()->lastname, + null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop); + } + + public function renderForm() + { + $fields_form_1 = [ + 'form' => [ + 'legend' => [ + 'title' => $this->trans('Customer notifications', [], 'Modules.Emailalerts.Admin'), + 'icon' => 'icon-cogs', + ], + 'input' => [ + [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('Product availability', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_CUSTOMER_QTY', + 'desc' => $this->trans('Give the customer the option of receiving a notification when an out of stock product is available again.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ], + [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('Order edit', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_ORDER_EDIT', + 'desc' => $this->trans('Send a notification to the customer when an order is edited.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ], + ], + 'submit' => [ + 'title' => $this->trans('Save', [], 'Admin.Actions'), + 'class' => 'btn btn-default pull-right', + 'name' => 'submitMailAlert', + ], + ], + ]; + + $inputs = [ + [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('New order', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_MERCHANT_ORDER', + 'desc' => $this->trans('Receive a notification when an order is placed.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ], + [ + 'type' => 'emailalerts_tags', + 'label' => $this->trans('Send to:', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_MERCHANT_ORDER_EMAILS', + 'placeholder' => $this->trans('Add email', [], 'Modules.Emailalerts.Admin'), + 'desc' => $this->trans('Enter one or more email address. Use \'Return\' or a comma to separate each address.', [], 'Modules.Emailalerts.Admin'), + ], + [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('Out of stock', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_MERCHANT_OOS', + 'desc' => $this->trans('Receive a notification if the available quantity of a product is below the following threshold.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ], + [ + 'type' => 'emailalerts_tags', + 'label' => $this->trans('Send to:', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_MERCHANT_OOS_EMAILS', + 'placeholder' => $this->trans('Add email', [], 'Modules.Emailalerts.Admin'), + 'desc' => $this->trans('Enter one or more email address. Use \'Return\' or a comma to separate each address.', [], 'Modules.Emailalerts.Admin'), + ], + [ + 'type' => 'text', + 'label' => $this->trans('Threshold', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_LAST_QTIES', + 'class' => 'fixed-width-xs', + 'desc' => $this->trans('Quantity for which a product is considered out of stock.', [], 'Modules.Emailalerts.Admin'), + ], + ]; + + if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { + $inputs[] = [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('Coverage warning', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_MERCHANT_COVERAGE', + 'desc' => $this->trans('Receive a notification when a product has insufficient coverage.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ]; + $inputs[] = [ + 'type' => 'text', + 'label' => $this->trans('Coverage', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_PRODUCT_COVERAGE', + 'class' => 'fixed-width-xs', + 'desc' => $this->trans('Stock coverage, in days. Also, the stock coverage of a given product will be calculated based on this number.', [], 'Modules.Emailalerts.Admin'), + ]; + } + + $inputs[] = [ + 'type' => 'switch', + 'is_bool' => true, // retro compat 1.5 + 'label' => $this->trans('Returns', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_RETURN_SLIP', + 'desc' => $this->trans('Receive a notification when a customer requests a merchandise return.', [], 'Modules.Emailalerts.Admin'), + 'values' => [ + [ + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->trans('Yes', [], 'Admin.Global'), + ], + [ + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->trans('No', [], 'Admin.Global'), + ], + ], + ]; + $inputs[] = [ + 'type' => 'emailalerts_tags', + 'label' => $this->trans('Send to:', [], 'Modules.Emailalerts.Admin'), + 'name' => 'MA_RETURN_SLIP_EMAILS', + 'placeholder' => $this->trans('Add email', [], 'Modules.Emailalerts.Admin'), + 'desc' => $this->trans('Enter one or more email address. Use \'Return\' or a comma to separate each address.', [], 'Modules.Emailalerts.Admin'), + ]; + + $fields_form_2 = [ + 'form' => [ + 'legend' => [ + 'title' => $this->trans('Merchant notifications', [], 'Modules.Emailalerts.Admin'), + 'icon' => 'icon-cogs', + ], + 'input' => $inputs, + 'submit' => [ + 'title' => $this->trans('Save', [], 'Admin.Actions'), + 'class' => 'btn btn-default pull-right', + 'name' => 'submitMAMerchant', + ], + ], + ]; + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->module = $this; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitMailAlertConfiguration'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) + . '&configure=' . $this->name + . '&tab_module=' . $this->tab + . '&module_name=' . $this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = [ + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id, + ]; + + return $helper->generateForm([$fields_form_1, $fields_form_2]); + } + + public function hookActionDeleteGDPRCustomer($customer) + { + if (!empty($customer['email']) && Validate::isEmail($customer['email'])) { + $sql = 'DELETE FROM ' . _DB_PREFIX_ . "mailalert_customer_oos WHERE customer_email = '" . pSQL($customer['email']) . "'"; + if (Db::getInstance()->execute($sql)) { + return json_encode(true); + } + + return json_encode($this->trans('Mail alert: Unable to delete customer using email.', [], 'Modules.Emailalerts.Admin')); + } + } + + public function hookActionExportGDPRData($customer) + { + if (!Tools::isEmpty($customer['email']) && Validate::isEmail($customer['email'])) { + $sql = 'SELECT * FROM ' . _DB_PREFIX_ . "mailalert_customer_oos WHERE customer_email = '" . pSQL($customer['email']) . "'"; + if ($res = Db::getInstance()->ExecuteS($sql)) { + return json_encode($res); + } + + return json_encode($this->trans('Mail alert: Unable to export customer using email.', [], 'Modules.Emailalerts.Admin')); + } + } + + public function getConfigFieldsValues() + { + return [ + 'MA_CUSTOMER_QTY' => Tools::getValue('MA_CUSTOMER_QTY', Configuration::get('MA_CUSTOMER_QTY')), + 'MA_MERCHANT_ORDER' => Tools::getValue('MA_MERCHANT_ORDER', Configuration::get('MA_MERCHANT_ORDER')), + 'MA_MERCHANT_ORDER_EMAILS' => Tools::getValue('MA_MERCHANT_ORDER_EMAILS', Configuration::get('MA_MERCHANT_ORDER_EMAILS')), + 'MA_MERCHANT_OOS' => Tools::getValue('MA_MERCHANT_OOS', Configuration::get('MA_MERCHANT_OOS')), + 'MA_MERCHANT_OOS_EMAILS' => Tools::getValue('MA_MERCHANT_OOS_EMAILS', Configuration::get('MA_MERCHANT_OOS_EMAILS')), + 'MA_LAST_QTIES' => Tools::getValue('MA_LAST_QTIES', Configuration::get('MA_LAST_QTIES')), + 'MA_MERCHANT_COVERAGE' => Tools::getValue('MA_MERCHANT_COVERAGE', Configuration::get('MA_MERCHANT_COVERAGE')), + 'MA_PRODUCT_COVERAGE' => Tools::getValue('MA_PRODUCT_COVERAGE', Configuration::get('MA_PRODUCT_COVERAGE')), + 'MA_MERCHANT_MAILS' => Tools::getValue('MA_MERCHANT_MAILS', Configuration::get('MA_MERCHANT_MAILS')), + 'MA_ORDER_EDIT' => Tools::getValue('MA_ORDER_EDIT', Configuration::get('MA_ORDER_EDIT')), + 'MA_RETURN_SLIP' => Tools::getValue('MA_RETURN_SLIP', Configuration::get('MA_RETURN_SLIP')), + 'MA_RETURN_SLIP_EMAILS' => Tools::getValue('MA_RETURN_SLIP_EMAILS', Configuration::get('MA_RETURN_SLIP_EMAILS')), + ]; + } + + /** + * empty listener for registerGDPRConsent hook + */ + public function hookRegisterGDPRConsent() + { + /* + * registerGDPRConsent is a special kind of hook that doesn't need a listener, see : + * https://build.prestashop.com/howtos/module/how-to-make-your-module-compliant-with-prestashop-official-gdpr-compliance-module/ + * However since Prestashop 1.7.8, modules must implement a listener for all the hooks they register: + * a check is made at module installation. + */ + } + + public function isUsingNewTranslationSystem() + { + return true; + } +} diff --git a/modules/ps_emailalerts/tests/php/phpstan.sh b/modules/ps_emailalerts/tests/php/phpstan.sh new file mode 100644 index 00000000..21b9c236 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan.sh @@ -0,0 +1,28 @@ +#!/bin/bash +PS_VERSION=$1 + +set -e + +# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled +echo "Pull PrestaShop files (Tag ${PS_VERSION})" + +docker rm -f temp-ps || true +docker volume rm -f ps-volume || true + +docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION + +# Clear previous instance of the module in the PrestaShop volume +echo "Clear previous module" + +docker exec -t --user root temp-ps sh -c 'if [ -d "/var/www/html/modules/ps_emailalerts" ]; then find /var/www/html/modules/ps_emailalerts -type f -exec rm {} +; fi' + +# Run a container for PHPStan, having access to the module content and PrestaShop sources. +# This tool is outside the composer.json because of the compatibility with PHP 5.6 +echo "Run PHPStan using phpstan-${PS_VERSION}.neon file" + +docker run --rm --volumes-from temp-ps \ + -v $PWD:/var/www/html/modules/ps_emailalerts \ + -e _PS_ROOT_DIR_=/var/www/html \ + --workdir=/var/www/html/modules/ps_emailalerts phpstan/phpstan:0.12 \ + analyse \ + --configuration=/var/www/html/modules/ps_emailalerts/tests/php/phpstan/phpstan-$PS_VERSION.neon diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.6.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.6.neon new file mode 100644 index 00000000..f8072a4f --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.6.neon @@ -0,0 +1,9 @@ +includes: + - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '~^Parameter #1 \$share of static method ShopCore::getContextListShopID\(\) expects string, false given\.$~' + - '~^Parameter #1 \$share of static method ShopCore::addSqlRestriction\(\) expects int, false given\.$~' + - '~^Parameter #4 \$templateVars of static method MailCore::send\(\) expects string, array given\.$~' + - '~^Parameter #1 \$id of class Customer constructor expects null, int given\.$~' diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.7.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.7.neon new file mode 100644 index 00000000..09d3f951 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.7.neon @@ -0,0 +1,7 @@ +includes: + - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$share of static method ShopCore\:\:getContextListShopID\(\) expects string, false given.#' + - '#Parameter \#1 \$share of static method ShopCore\:\:addSqlRestriction\(\) expects int, false given.#' diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.8.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.8.neon new file mode 100644 index 00000000..09d3f951 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan-1.7.8.neon @@ -0,0 +1,7 @@ +includes: + - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$share of static method ShopCore\:\:getContextListShopID\(\) expects string, false given.#' + - '#Parameter \#1 \$share of static method ShopCore\:\:addSqlRestriction\(\) expects int, false given.#' diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan-8.0.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan-8.0.neon new file mode 100644 index 00000000..21d06fb8 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan-8.0.neon @@ -0,0 +1,7 @@ +includes: + - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$share of static method ShopCore\:\:getContextListShopID\(\) expects string, false given.#' + - '#Parameter \#1 \$share of static method ShopCore\:\:addSqlRestriction\(\) expects int, false given.#' \ No newline at end of file diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan-latest.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan-latest.neon new file mode 100644 index 00000000..09d3f951 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan-latest.neon @@ -0,0 +1,7 @@ +includes: + - %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$share of static method ShopCore\:\:getContextListShopID\(\) expects string, false given.#' + - '#Parameter \#1 \$share of static method ShopCore\:\:addSqlRestriction\(\) expects int, false given.#' diff --git a/modules/ps_emailalerts/tests/php/phpstan/phpstan.neon b/modules/ps_emailalerts/tests/php/phpstan/phpstan.neon new file mode 100644 index 00000000..77f1e143 --- /dev/null +++ b/modules/ps_emailalerts/tests/php/phpstan/phpstan.neon @@ -0,0 +1,14 @@ +includes: + - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon + +parameters: + paths: + # From PHPStan 0.12, paths to check are relative to the neon file + - ../../../ps_emailalerts.php + - ../../../upgrade + - ../../../MailAlert.php + - ../../../controllers + reportUnmatchedIgnoredErrors: false + level: 5 + ignoreErrors: + - '#Unreachable statement \- code above always terminates\.#' diff --git a/modules/ps_emailalerts/translations/index.php b/modules/ps_emailalerts/translations/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/translations/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/translations/pl.php b/modules/ps_emailalerts/translations/pl.php new file mode 100644 index 00000000..e69de29b diff --git a/modules/ps_emailalerts/upgrade/index.php b/modules/ps_emailalerts/upgrade/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/upgrade/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/upgrade/install-2.1.0.php b/modules/ps_emailalerts/upgrade/install-2.1.0.php new file mode 100644 index 00000000..ae0dad4f --- /dev/null +++ b/modules/ps_emailalerts/upgrade/install-2.1.0.php @@ -0,0 +1,29 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_1_0($object) +{ + return $object->registerHook('registerGDPRConsent') + && $object->registerHook('actionDeleteGDPRCustomer') + && $object->registerHook('actionExportGDPRData'); +} diff --git a/modules/ps_emailalerts/upgrade/install-2.3.4.php b/modules/ps_emailalerts/upgrade/install-2.3.4.php new file mode 100644 index 00000000..94148ec1 --- /dev/null +++ b/modules/ps_emailalerts/upgrade/install-2.3.4.php @@ -0,0 +1,27 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_3_4($object) +{ + return $object->unregisterHook('displayProductButtons'); +} diff --git a/modules/ps_emailalerts/upgrade/upgrade-2.3.1.php b/modules/ps_emailalerts/upgrade/upgrade-2.3.1.php new file mode 100644 index 00000000..2977fda2 --- /dev/null +++ b/modules/ps_emailalerts/upgrade/upgrade-2.3.1.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_3_1($object) +{ + return $object->registerHook('actionFrontControllerSetMedia') + && $object->unregisterHook('displayHeader'); +} diff --git a/modules/ps_emailalerts/upgrade/upgrade-2.3.3.php b/modules/ps_emailalerts/upgrade/upgrade-2.3.3.php new file mode 100644 index 00000000..5d171f63 --- /dev/null +++ b/modules/ps_emailalerts/upgrade/upgrade-2.3.3.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_3_3($object) +{ + return $object->unregisterHook('registerGDPRConsent') + && $object->unregisterHook('actionProductOutOfStock'); +} diff --git a/modules/ps_emailalerts/upgrade/upgrade-2.4.0.php b/modules/ps_emailalerts/upgrade/upgrade-2.4.0.php new file mode 100644 index 00000000..5522cd09 --- /dev/null +++ b/modules/ps_emailalerts/upgrade/upgrade-2.4.0.php @@ -0,0 +1,51 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_4_0($object) +{ + $result = true; + + // migrate the saved e-mails to all new fields (if active) + $merchants_emails = Configuration::get('MA_MERCHANT_MAILS'); + if (!empty($merchants_emails)) { + // create an array from saved e-mails + $merchants_emails = explode("\n", Configuration::get('MA_MERCHANT_MAILS')); + // recreate string in the new format + $merchants_emails = implode(',', $merchants_emails); + + // save e-mails to each new Configuration (if active) + if (Configuration::get('MA_MERCHANT_ORDER')) { + $result &= Configuration::updateValue('MA_MERCHANT_ORDER_EMAILS', $merchants_emails); + } + if (Configuration::get('MA_MERCHANT_OOS')) { + $result &= Configuration::updateValue('MA_MERCHANT_OOS_EMAILS', $merchants_emails); + } + if (Configuration::get('MA_RETURN_SLIP')) { + $result &= Configuration::updateValue('MA_RETURN_SLIP_EMAILS', $merchants_emails); + } + } + + $result &= (bool) $object->registerHook('actionAdminControllerSetMedia'); + + return (bool) $result; +} diff --git a/modules/ps_emailalerts/upgrade/upgrade-2.4.1.php b/modules/ps_emailalerts/upgrade/upgrade-2.4.1.php new file mode 100644 index 00000000..2caf0d11 --- /dev/null +++ b/modules/ps_emailalerts/upgrade/upgrade-2.4.1.php @@ -0,0 +1,27 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_2_4_1($object) +{ + return $object->registerHook('registerGDPRConsent'); +} diff --git a/modules/ps_emailalerts/vendor/autoload.php b/modules/ps_emailalerts/vendor/autoload.php new file mode 100644 index 00000000..92126022 --- /dev/null +++ b/modules/ps_emailalerts/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/modules/ps_emailalerts/vendor/composer/LICENSE b/modules/ps_emailalerts/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/modules/ps_emailalerts/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/modules/ps_emailalerts/vendor/composer/autoload_classmap.php b/modules/ps_emailalerts/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..7a91153b --- /dev/null +++ b/modules/ps_emailalerts/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit967db673a7908b03924cd99a5cb70181::getInitializer($loader)); + } else { + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->setClassMapAuthoritative(true); + $loader->register(false); + + return $loader; + } +} diff --git a/modules/ps_emailalerts/vendor/composer/autoload_static.php b/modules/ps_emailalerts/vendor/composer/autoload_static.php new file mode 100644 index 00000000..1d92f584 --- /dev/null +++ b/modules/ps_emailalerts/vendor/composer/autoload_static.php @@ -0,0 +1,15 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/form.tpl b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/form.tpl new file mode 100644 index 00000000..1dbde81a --- /dev/null +++ b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/form.tpl @@ -0,0 +1,68 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +{extends file="helpers/form/form.tpl"} + +{block name="input"} + {if $input.type == 'switch' && $smarty.const._PS_VERSION_|@addcslashes:'\'' < '1.6'} + {foreach $input.values as $value} + + + {if isset($input.br) && $input.br}
    {/if} + {if isset($value.p) && $value.p}

    {$value.p}

    {/if} + {/foreach} + {elseif $input.type == 'emailalerts_tags'} + {literal} + + {/literal} + {assign var='value_text' value=$fields_value[$input.name]} + + {else} + {$smarty.block.parent} + {/if} +{/block} diff --git a/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/index.php b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/form/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/admin/_configure/helpers/index.php b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/admin/_configure/helpers/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/admin/_configure/index.php b/modules/ps_emailalerts/views/templates/admin/_configure/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/admin/_configure/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/admin/index.php b/modules/ps_emailalerts/views/templates/admin/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/admin/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/front/index.php b/modules/ps_emailalerts/views/templates/front/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/front/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/front/mailalerts-account-line.tpl b/modules/ps_emailalerts/views/templates/front/mailalerts-account-line.tpl new file mode 100644 index 00000000..a3cb50ea --- /dev/null +++ b/modules/ps_emailalerts/views/templates/front/mailalerts-account-line.tpl @@ -0,0 +1,34 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + + + + + +
    {$mailAlert.name} + {$mailAlert.attributes_small} +
    +
    + + delete + diff --git a/modules/ps_emailalerts/views/templates/front/mailalerts-account.tpl b/modules/ps_emailalerts/views/templates/front/mailalerts-account.tpl new file mode 100644 index 00000000..b7feb52d --- /dev/null +++ b/modules/ps_emailalerts/views/templates/front/mailalerts-account.tpl @@ -0,0 +1,35 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} +{extends file='customer/page.tpl'} + +{block name='page_title'} + {l s='My alerts' d='Modules.Emailalerts.Shop'} +{/block} + +{block name='page_content'} + {if $mailAlerts} +
      + {foreach from=$mailAlerts item=mailAlert} +
    • {include 'module:ps_emailalerts/views/templates/front/mailalerts-account-line.tpl' mailAlert=$mailAlert}
    • + {/foreach} +
    + {else} + + {/if} +{/block} diff --git a/modules/ps_emailalerts/views/templates/hook/index.php b/modules/ps_emailalerts/views/templates/hook/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/hook/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/ps_emailalerts/views/templates/hook/my-account-footer.tpl b/modules/ps_emailalerts/views/templates/hook/my-account-footer.tpl new file mode 100644 index 00000000..ee116c54 --- /dev/null +++ b/modules/ps_emailalerts/views/templates/hook/my-account-footer.tpl @@ -0,0 +1,22 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +
  • + {l s='My alerts' d='Modules.Emailalerts.Shop'} +
  • diff --git a/modules/ps_emailalerts/views/templates/hook/my-account.tpl b/modules/ps_emailalerts/views/templates/hook/my-account.tpl new file mode 100644 index 00000000..ee116c54 --- /dev/null +++ b/modules/ps_emailalerts/views/templates/hook/my-account.tpl @@ -0,0 +1,22 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +
  • + {l s='My alerts' d='Modules.Emailalerts.Shop'} +
  • diff --git a/modules/ps_emailalerts/views/templates/hook/product.tpl b/modules/ps_emailalerts/views/templates/hook/product.tpl new file mode 100644 index 00000000..64588e40 --- /dev/null +++ b/modules/ps_emailalerts/views/templates/hook/product.tpl @@ -0,0 +1,44 @@ +{** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License version 3.0 + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + *} + +
    +
    + {if empty($has_notification)} + {if !empty($email)} + + {/if} + {if !empty($id_module)} + {capture name='gdprContent'}{hook h='displayGDPRConsent' id_module=$id_module}{/capture} + {if $smarty.capture.gdprContent != ''} + + {/if} + {/if} + +
    + {else} + + {/if} +
    +
    diff --git a/modules/ps_emailalerts/views/templates/index.php b/modules/ps_emailalerts/views/templates/index.php new file mode 100644 index 00000000..296d682e --- /dev/null +++ b/modules/ps_emailalerts/views/templates/index.php @@ -0,0 +1,28 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit;