Skip to content

Commit

Permalink
Merge pull request #184 from PrestaShop/dev
Browse files Browse the repository at this point in the history
thank you @sLorenzini && @NeOMakinG
  • Loading branch information
Touxten authored Aug 1, 2022
2 parents a11c76e + 583b013 commit 5d84188
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 13 deletions.
4 changes: 2 additions & 2 deletions _dev/front/js/components/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
// eslint-disable-next-line
const itemsFiltered = productsAlreadyTagged.filter(
(e) => e.id_product === this.productId.toString()
&& e.quantity === quantity.value
(e) => parseInt(e.id_product, 10) === this.productId
&& e.quantity.toString() === quantity.value
&& parseInt(e.id_product_attribute, 10) === this.productAttributeId,
);
Expand Down
2 changes: 1 addition & 1 deletion blockwishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct()
{
$this->name = 'blockwishlist';
$this->tab = 'front_office_features';
$this->version = '2.1.1';
$this->version = '2.1.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>blockwishlist</name>
<displayName><![CDATA[Wishlist block]]></displayName>
<version><![CDATA[2.1.1]]></version>
<version><![CDATA[2.1.2]]></version>
<description><![CDATA[Adds a block containing the customer&#039;s wishlists.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
Expand Down
25 changes: 25 additions & 0 deletions controllers/front/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ private function addProductToWishListAction($params)
private function createNewWishListAction($params)
{
if (isset($params['name'])) {
if (!Validate::isGenericName($params['name'])) {
return $this->ajaxRender(
json_encode([
'success' => false,
'message' => $this->trans('The list name is invalid.', [], 'Modules.Blockwishlist.Shop'),
'datas' => [
'name' => $params['name'],
],
])
);
}

$wishlist = new WishList();
$wishlist->name = $params['name'];
$wishlist->id_shop_group = $this->context->shop->id_shop_group;
Expand Down Expand Up @@ -164,6 +176,19 @@ private function createNewWishListAction($params)
private function renameWishListAction($params)
{
if (isset($params['idWishList'], $params['name'])) {
if (!Validate::isGenericName($params['name'])) {
return $this->ajaxRender(
json_encode([
'success' => false,
'message' => $this->trans('The list name is invalid', [], 'Modules.Blockwishlist.Shop'),
'datas' => [
'name' => $params['name'],
'id_whishlist' => $params['idWishList'],
],
])
);
}

$wishlist = new WishList($params['idWishList']);
// Exit if not owner of the wishlist
$this->assertWriteAccess($wishlist);
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function init()
[],
'Modules.Blockwishlist.Shop'
);
$this->setTemplate('errors/forbidden');
$this->template = 'module:blockwishlist/views/templates/errors/forbidden.tpl';

return;
}
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/button.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/create.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions public/product.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/wishlistcontainer.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions views/templates/errors/forbidden.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{**
* 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 3.0 (AFL-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 [email protected] 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
{extends file='errors/forbidden.tpl'}

{block name='content'}

{/block}

0 comments on commit 5d84188

Please sign in to comment.