From e98a474db95bce664514b283cfcd9791da5c5cc6 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Thu, 17 Oct 2019 14:10:03 +0200 Subject: [PATCH 01/33] Add missing domains --- gamification.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamification.php b/gamification.php index a09e67f..bf4b20c 100644 --- a/gamification.php +++ b/gamification.php @@ -54,8 +54,8 @@ public function __construct() parent::__construct(); - $this->displayName = $this->l('Merchant Expertise'); - $this->description = $this->l('Become an e-commerce expert within the blink of an eye!'); + $this->displayName = $this->trans('Merchant Expertise', array(), 'Modules.Merchantexpertise.Admin); + $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', array(), 'Modules.Merchantexpertise.Admin); $this->cache_data = __DIR__.'/data/'; if (self::TEST_MODE === true) { From 23e84101d36d9316739241a4a163896c799d2044 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Thu, 17 Oct 2019 17:06:05 +0200 Subject: [PATCH 02/33] Update gamification.php Co-Authored-By: GoT --- gamification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamification.php b/gamification.php index bf4b20c..c0f6fcf 100644 --- a/gamification.php +++ b/gamification.php @@ -54,7 +54,7 @@ public function __construct() parent::__construct(); - $this->displayName = $this->trans('Merchant Expertise', array(), 'Modules.Merchantexpertise.Admin); + $this->displayName = $this->trans('Merchant Expertise', array(), 'Modules.Merchantexpertise.Admin'); $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', array(), 'Modules.Merchantexpertise.Admin); $this->cache_data = __DIR__.'/data/'; From cda2297caf07e0e0091a1224b2eff57bc3403ee2 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Thu, 17 Oct 2019 17:06:15 +0200 Subject: [PATCH 03/33] Update gamification.php Co-Authored-By: GoT --- gamification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamification.php b/gamification.php index c0f6fcf..d133bc6 100644 --- a/gamification.php +++ b/gamification.php @@ -55,7 +55,7 @@ public function __construct() parent::__construct(); $this->displayName = $this->trans('Merchant Expertise', array(), 'Modules.Merchantexpertise.Admin'); - $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', array(), 'Modules.Merchantexpertise.Admin); + $this->description = $this->trans('Check your completion rate and unblock all badges to become an e-commerce expert within the blink of an eye!', array(), 'Modules.Merchantexpertise.Admin'); $this->cache_data = __DIR__.'/data/'; if (self::TEST_MODE === true) { From 258dcec0cdb61edac908b3ba871417661d499b82 Mon Sep 17 00:00:00 2001 From: Pablo Borowicz Date: Tue, 31 Dec 2019 15:29:03 -0300 Subject: [PATCH 04/33] Add license file --- LICENSE.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..5e4bd60 --- /dev/null +++ b/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. From fba6c2517be7f34a901548f3cde62675869ae957 Mon Sep 17 00:00:00 2001 From: Pablo Borowicz Date: Tue, 31 Dec 2019 15:31:19 -0300 Subject: [PATCH 05/33] Update readme --- Readme.md | 56 ++++++++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/Readme.md b/Readme.md index bb774a5..138c26b 100644 --- a/Readme.md +++ b/Readme.md @@ -2,52 +2,40 @@ ## About -Become an e-commerce expert within the blink of an eye! +Become an e-commerce expert within the blink of an eye! This module displays tips in your Back Office to help you make the best out of your shop. -## Contributing - -PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements. +### Execute the test suite -### Requirements +This module is shipped with a test suite using PHPUnit, you need Composer to install the dependencies: -Contributors **must** follow the following rules: - -* **Make your Pull Request on the "dev" branch**, NOT the "master" branch. -* Do not update the module's version number. -* Follow [the coding standards][1]. +``` +composer install +composer test +``` -### Process in details +### Supported PrestaShop versions -Contributors wishing to edit a module's files should follow the following process: +This module is compatible with 1.6.1.x and 1.7.x versions. -1. Create your GitHub account, if you do not have one already. -2. Fork the gamification project to your GitHub account. -3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation. -4. Create a branch in your local clone of the module for your changes. -5. Change the files in your branch. Be sure to follow [the coding standards][1]! -6. Push your changed branch to your fork in your GitHub account. -7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3]. -8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code. +> As of 31th of october, 2018, PrestaShop 1.6.1.x will only receives security patches. -That's it: you have contributed to this open-source project! Congratulations! +This module is maintained for 1.7.4.x and above *only*. -[1]: http://doc.prestashop.com/display/PS16/Coding+Standards -[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message -[3]: https://help.github.com/articles/using-pull-requests +## Reporting issues -### Execute the testsuite +You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue]. -This module is shipped with a testsuite using PHPUnit, you need Composer to install the dependencies: +## Contributing -``` -composer install -composer test -``` +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! -### Versions of PrestaShop supported +Just make sure to follow our [contribution guidelines][contribution-guidelines]. -This module is compatible with 1.6.1.x and 1.7.x versions. +## License -> As of 31th of october, 2018, PrestaShop 1.6.1.x will only receives security patches. +This module is released under the [Academic Free License 3.0][AFL-3.0] -This module is maintained for 1.7.4.x and above *only*. \ No newline at end of file +[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 From 7b27fffd5c68291b341a4e824ec492f8e5a4c901 Mon Sep 17 00:00:00 2001 From: David Gonzalez Date: Mon, 17 Feb 2020 21:05:10 +0100 Subject: [PATCH 06/33] Fix gamification PNG Error on NGINX https://github.com/PrestaShop/PrestaShop/issues/17038 --- classes/Badge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Badge.php b/classes/Badge.php index b27914c..136bb3e 100644 --- a/classes/Badge.php +++ b/classes/Badge.php @@ -48,7 +48,7 @@ class Badge extends ObjectModel public $awb; - const BAGDE_IMG_URL = '../modules/gamification/views/img/badges/'; + const BAGDE_IMG_URL = '/modules/gamification/views/img/badges/'; /** * @see ObjectModel::$definition From d8c69b1541611fc12b700e949acfb83f4419e953 Mon Sep 17 00:00:00 2001 From: David Gonzalez Date: Tue, 18 Feb 2020 17:35:12 +0100 Subject: [PATCH 07/33] Fix BAGDE_IMG_URL --- classes/Badge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Badge.php b/classes/Badge.php index 136bb3e..0e8ecf5 100644 --- a/classes/Badge.php +++ b/classes/Badge.php @@ -48,7 +48,7 @@ class Badge extends ObjectModel public $awb; - const BAGDE_IMG_URL = '/modules/gamification/views/img/badges/'; + const BAGDE_IMG_URL = _MODULE_DIR_ . 'gamification/views/img/badges/'; /** * @see ObjectModel::$definition From db788eb0894f0e73e3951347d9c4dc6ec72799c3 Mon Sep 17 00:00:00 2001 From: Thomas Nabord Date: Mon, 18 May 2020 17:50:18 +0100 Subject: [PATCH 08/33] Rename function name to avoid conflicts --- upgrade/install-2.3.2.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upgrade/install-2.3.2.php b/upgrade/install-2.3.2.php index efd0793..b82fd64 100644 --- a/upgrade/install-2.3.2.php +++ b/upgrade/install-2.3.2.php @@ -34,13 +34,13 @@ * * @return true|string True if everything goes fine, error details otherwise */ -function removeFromFsDuringUpgrade(array $files) +function removeGamificationPhpUnitFromFsDuringUpgrade(array $files) { $files = array_reverse($files); foreach ($files as $file) { if (is_dir($file)) { $iterator = new FilesystemIterator($file, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS); - removeFromFsDuringUpgrade(iterator_to_array($iterator)); + removeGamificationPhpUnitFromFsDuringUpgrade(iterator_to_array($iterator)); if (!rmdir($file) && file_exists($file)) { return 'Deletion of directory ' . $file . 'failed'; } @@ -59,7 +59,7 @@ function upgrade_module_2_3_2($module) { $path = __DIR__ . '/../vendor/phpunit'; if (file_exists($path)) { - $result = removeFromFsDuringUpgrade(array($path)); + $result = removeGamificationPhpUnitFromFsDuringUpgrade(array($path)); if ($result !== true) { PrestaShopLogger::addLog('Could not delete PHPUnit from module. ' . $result, 3); return false; From 45b9503e507094eb23058822ac28d85c2281f336 Mon Sep 17 00:00:00 2001 From: Valentin Szczupak Date: Mon, 10 Aug 2020 16:51:35 +0200 Subject: [PATCH 09/33] Add lazy native attribute to images to avoid loading when hidden --- views/templates/admin/gamification/helpers/view/view.tpl | 2 +- views/templates/admin/gamification/helpers/view/view_bt.tpl | 2 +- views/templates/hook/notification.tpl | 2 +- views/templates/hook/notification_bt.tpl | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/views/templates/admin/gamification/helpers/view/view.tpl b/views/templates/admin/gamification/helpers/view/view.tpl index d6bdd67..f3e6ec8 100644 --- a/views/templates/admin/gamification/helpers/view/view.tpl +++ b/views/templates/admin/gamification/helpers/view/view.tpl @@ -75,7 +75,7 @@ {foreach from=$badges_type key=key item=type}
- {$type.name|escape:html:'UTF-8'} {$type.name|escape:html:'UTF-8'} + {$type.name|escape:html:'UTF-8'} {$type.name|escape:html:'UTF-8'} {include file='./filters.tpl' type=$key}