Fix error when delete stripe customer

This commit is contained in:
ptibogxiv 2018-09-06 11:35:19 +02:00 committed by GitHub
parent b25a0ca672
commit da4e902645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -550,13 +550,17 @@ if (empty($reshook))
$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.= " 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 !
}
$resql = $db->query($sql);
$num = $db->num_rows($resql);
if (empty($num))
if (empty($num) && !empty($newcu))
{
$societeaccount = new SocieteAccount($db);
$societeaccount->fk_soc = $object->id;