[-] MO : fixed bug #PSCFV-3791- customer privacy module error bug
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17073 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -372,6 +372,7 @@ class AuthControllerCore extends FrontController
|
||||
*/
|
||||
protected function processSubmitAccount()
|
||||
{
|
||||
Hook::exec('actionBeforeSubmitAccount');
|
||||
$this->create_account = true;
|
||||
if (Tools::isSubmit('submitAccount'))
|
||||
$this->context->smarty->assign('email_create', 1);
|
||||
|
||||
@@ -49,7 +49,7 @@ class Blockcustomerprivacy extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
$return = (parent::install() && $this->registerHook('createAccountForm'));
|
||||
$return = (parent::install() && $this->registerHook('createAccountForm') && $this->registerHook('header') && $this->registerHook('actionBeforeSubmitAccount'));
|
||||
Configuration::updateValue('CUSTPRIV_MESSAGE', array($this->context->language->id =>
|
||||
$this->l('The personal data you provide is used to answer to your queries, process your orders or allow you to access specific information.').' '.
|
||||
$this->l('You have a right to modify and delete all the personal information which we hold concerning yourself in the "my account" page.')
|
||||
@@ -153,18 +153,41 @@ class Blockcustomerprivacy extends Module
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function hookCreateAccountForm($params)
|
||||
public function checkConfig()
|
||||
{
|
||||
if (!$this->active)
|
||||
return;
|
||||
return false;
|
||||
|
||||
$message = Configuration::get('CUSTPRIV_MESSAGE', $this->context->language->id);
|
||||
if (empty($message))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
if (!$this->checkConfig())
|
||||
return;
|
||||
$this->context->controller->addJS(($this->_path).'blockcustomerprivacy.js');
|
||||
}
|
||||
|
||||
public function hookActionBeforeSubmitAccount($params)
|
||||
{
|
||||
if (!$this->checkConfig())
|
||||
return;
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'privacy_message' => $message,
|
||||
'error_message' => $this->l('Please agree with the customer data privacy by ticking the checkbox below.')
|
||||
));
|
||||
if (!Tools::getValue('customer_privacy'))
|
||||
$this->context->controller->errors[] = $this->l('Please agree with the customer data privacy by ticking the checkbox below.');
|
||||
}
|
||||
|
||||
public function hookCreateAccountForm($params)
|
||||
{
|
||||
if (!$this->checkConfig())
|
||||
return;
|
||||
|
||||
$this->smarty->assign('privacy_message', Configuration::get('CUSTPRIV_MESSAGE', $this->context->language->id));
|
||||
|
||||
return $this->display(__FILE__, 'blockcustomerprivacy.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,33 +23,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var error_message = "<p>{$error_message}</p>";
|
||||
{literal}
|
||||
$(document).ready(function(){
|
||||
if ($().live) {
|
||||
$("#account-creation_form").live("submit", function(){
|
||||
if($("#customer_privacy").length > 0 && !$("#customer_privacy").is(":checked")) {
|
||||
$("div.error_customerprivacy").empty().append(error_message);
|
||||
return false;
|
||||
} else {
|
||||
$("div.error_customerprivacy").empty();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#account-creation_form").submit(function(){
|
||||
if($("#customer_privacy").length > 0 && !$("#customer_privacy").is(":checked")) {
|
||||
$("div.error_customerprivacy").empty().append(error_message);
|
||||
return false;
|
||||
} else {
|
||||
$("div.error_customerprivacy").empty();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<div class="error_customerprivacy" style="color:red;"></div>
|
||||
<fieldset class="account_creation customerprivacy">
|
||||
<h3>{l s='Customer data privacy' mod='blockcustomerprivacy'}</h3>
|
||||
|
||||
Reference in New Issue
Block a user