Merge branch 'fix-OnCustomerRemoving'

This commit is contained in:
Marion Muszynski 2017-06-01 10:54:00 +02:00
commit 1364d1214a

View File

@ -1,7 +1,7 @@
<?php
class Customer extends CustomerCore
class Customer extends CustomerCore
{
public function printVersion($value, $params)
public function printVersion($value, $params)
{
$versions = array(
'en' => 1,
@ -11,4 +11,18 @@ class Customer extends CustomerCore
);
return '<img src="/img/l/'.(int) $versions[$value].'.jpg" alt="" />';
}
public function delete()
{
$addresses = $this->getAddresses((int)(Configuration::get('PS_LANG_DEFAULT')));
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('UPDATE `'._DB_PREFIX_.'customer_thread` SET `id_customer` = 0 WHERE `id_customer` = '.(int)($this->id));
Discount::deleteByIdCustomer((int)($this->id));
return parent::delete();
}
}