[-] FO : #FSCFV-903 : Add Mail confirmation sending when subscribing to the newsletter via Accont creation or edition
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15198 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -44,13 +44,15 @@ class IdentityControllerCore extends FrontController
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$origin_newsletter = (bool)$this->customer->newsletter;
|
||||
|
||||
if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days']))
|
||||
$this->customer->birthday = (int)($_POST['years']).'-'.(int)($_POST['months']).'-'.(int)($_POST['days']);
|
||||
|
||||
if (Tools::isSubmit('submitIdentity'))
|
||||
{
|
||||
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) &&
|
||||
!(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
|
||||
!(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
|
||||
$this->errors[] = Tools::displayError('Invalid date of birth');
|
||||
else
|
||||
{
|
||||
@@ -76,8 +78,14 @@ class IdentityControllerCore extends FrontController
|
||||
{
|
||||
$this->customer->id_default_group = (int)$prev_id_default_group;
|
||||
$this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
|
||||
|
||||
if (!isset($_POST['newsletter']))
|
||||
$this->customer->newsletter = 0;
|
||||
elseif (!$origin_newsletter && isset($_POST['newsletter']))
|
||||
if ($module_newsletter = Module::getInstanceByName('blocknewsletter'))
|
||||
if ($module_newsletter->active)
|
||||
$module_newsletter->confirmSubscription($this->customer->email);
|
||||
|
||||
if (!isset($_POST['optin']))
|
||||
$this->customer->optin = 0;
|
||||
if (Tools::getValue('passwd'))
|
||||
@@ -113,15 +121,15 @@ class IdentityControllerCore extends FrontController
|
||||
|
||||
/* Generate years, months and days */
|
||||
$this->context->smarty->assign(array(
|
||||
'years' => Tools::dateYears(),
|
||||
'sl_year' => $birthday[0],
|
||||
'months' => Tools::dateMonths(),
|
||||
'sl_month' => $birthday[1],
|
||||
'days' => Tools::dateDays(),
|
||||
'sl_day' => $birthday[2],
|
||||
'errors' => $this->errors,
|
||||
'genders' => Gender::getGenders(),
|
||||
));
|
||||
'years' => Tools::dateYears(),
|
||||
'sl_year' => $birthday[0],
|
||||
'months' => Tools::dateMonths(),
|
||||
'sl_month' => $birthday[1],
|
||||
'days' => Tools::dateDays(),
|
||||
'sl_day' => $birthday[2],
|
||||
'errors' => $this->errors,
|
||||
'genders' => Gender::getGenders(),
|
||||
));
|
||||
|
||||
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user