Skip to content

Commit

Permalink
Fix error when delete stripe customer
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Sep 6, 2018
1 parent b25a0ca commit da4e902
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions htdocs/societe/paymentmodes.php
Expand Up @@ -550,13 +550,17 @@

$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;
Expand Down

0 comments on commit da4e902

Please sign in to comment.