From 6de80538ab50163adf74bdecd1490e9c1d8a5882 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Mon, 23 Jul 2012 08:25:56 +0000 Subject: [PATCH] [-] BO : fixed bug #PSCFV-2826 --- classes/Customer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/Customer.php b/classes/Customer.php index 0f2b8b908..034029078 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -198,7 +198,10 @@ class CustomerCore extends ObjectModel $this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days); $this->secure_key = md5(uniqid(rand(), true)); $this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes')); - + + if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) + $this->newsletter_date_add = date('Y-m-d H:i:s'); + if ($this->id_default_group == _PS_DEFAULT_CUSTOMER_GROUP_) if ($this->is_guest) $this->id_default_group = Configuration::get('PS_GUEST_GROUP'); @@ -216,7 +219,8 @@ class CustomerCore extends ObjectModel public function update($nullValues = false) { $this->birthday = (empty($this->years) ? $this->birthday : (int)$this->years.'-'.(int)$this->months.'-'.(int)$this->days); - if ($this->newsletter && !$this->newsletter_date_add) + + if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) $this->newsletter_date_add = date('Y-m-d H:i:s'); $this->updateGroup($this->groupBox); return parent::update(true);