// Do not delete customer addresses when delete it
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17567 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
8657b584c5
commit
f13a64351c
1 file changed
+32
-5
+32
-5
@@ -240,14 +240,41 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
if (!count(Order::getCustomerOrders((int)$this->id)))
|
||||||
foreach ($addresses as $address)
|
|
||||||
{
|
{
|
||||||
$obj = new Address((int)$address['id_address']);
|
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||||
$obj->delete();
|
foreach ($addresses as $address)
|
||||||
|
{
|
||||||
|
$obj = new Address((int)$address['id_address']);
|
||||||
|
$obj->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)$this->id);
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)$this->id);
|
||||||
CartRule::deleteByIdCustomer((int)$this->id);
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'message WHERE id_customer='.(int)$this->id);
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE id_customer='.(int)$this->id);
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'compare WHERE id_customer='.(int)$this->id);
|
||||||
|
|
||||||
|
$carts = Db::getInstance()->executes('SELECT id_cart
|
||||||
|
FROM '._DB_PREFIX_.'cart
|
||||||
|
WHERE id_customer='.(int)$this->id);
|
||||||
|
if ($carts)
|
||||||
|
foreach ($carts as $cart)
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart WHERE id_cart='.(int)$cart['id_cart']);
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_product WHERE id_cart='.(int)$cart['id_cart']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cts = Db::getInstance()->executes('SELECT id_customer_thread
|
||||||
|
FROM '._DB_PREFIX_.'customer_thread
|
||||||
|
WHERE id_customer='.(int)$this->id);
|
||||||
|
if ($cts)
|
||||||
|
foreach ($cts as $ct)
|
||||||
|
{
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_thread WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_message WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Discount::deleteByIdCustomer((int)$this->id);
|
||||||
return parent::delete();
|
return parent::delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user