Skip to content

Commit

Permalink
Merge pull request #119 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release v2.4.0
  • Loading branch information
matks authored Nov 15, 2022
2 parents 654f950 + 87a5e48 commit c0bc96c
Show file tree
Hide file tree
Showing 11 changed files with 347 additions and 91 deletions.
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>ps_emailalerts</name>
<displayName><![CDATA[Mail alerts]]></displayName>
<version><![CDATA[2.3.3]]></version>
<version><![CDATA[2.4.0]]></version>
<description><![CDATA[Sends e-mail notifications to customers and merchants regarding stock and order modifications.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
Expand Down
10 changes: 5 additions & 5 deletions controllers/front/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function processAdd()
exit(json_encode(
[
'error' => true,
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Mailalerts.Shop'),
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Emailalerts.Shop'),
]
));
}
Expand All @@ -117,14 +117,14 @@ public function processAdd()
exit(json_encode(
[
'error' => true,
'message' => $this->trans('You already have an alert for this product', [], 'Modules.Mailalerts.Shop'),
'message' => $this->trans('You already have an alert for this product', [], 'Modules.Emailalerts.Shop'),
]
));
} elseif (!Validate::isLoadedObject($product)) {
exit(json_encode(
[
'error' => true,
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Mailalerts.Shop'),
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Emailalerts.Shop'),
]
));
}
Expand All @@ -142,15 +142,15 @@ public function processAdd()
exit(json_encode(
[
'error' => false,
'message' => $this->trans('Request notification registered', [], 'Modules.Mailalerts.Shop'),
'message' => $this->trans('Request notification registered', [], 'Modules.Emailalerts.Shop'),
]
));
}

exit(json_encode(
[
'error' => true,
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Mailalerts.Shop'),
'message' => $this->trans('Your e-mail address is invalid', [], 'Modules.Emailalerts.Shop'),
]
));
}
Expand Down
52 changes: 52 additions & 0 deletions js/admin/ps_emailalerts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* 2007-2022 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 [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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2022 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
*/

$(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');
});
2 changes: 1 addition & 1 deletion js/mailalerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $(document).on('ready', function() {
const mailAlertWrapper = $('.js-mailalert');
const mailAlertSubmitButton = mailAlertWrapper.find(mailAlertSubmitButtonClass);

if (mailAlertWrapper.find('#gdpr_consent').length) {
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);
Expand Down
Loading

0 comments on commit c0bc96c

Please sign in to comment.