Fix error when delete stripe customer
This commit is contained in:
parent
b25a0ca672
commit
da4e902645
@ -550,13 +550,17 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
if (empty($newcu)) {
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity;
|
||||||
|
} else {
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account";
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account";
|
||||||
$sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'";
|
$sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'";
|
||||||
$sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
|
$sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
if (empty($num))
|
if (empty($num) && !empty($newcu))
|
||||||
{
|
{
|
||||||
$societeaccount = new SocieteAccount($db);
|
$societeaccount = new SocieteAccount($db);
|
||||||
$societeaccount->fk_soc = $object->id;
|
$societeaccount->fk_soc = $object->id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user