From 94fd2b40c73448181ea035907f8fc9f7f09e5e8e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 5 Feb 2020 12:04:27 +0100 Subject: [PATCH 1/2] new fix Count of Stripe payment mode must take test/live into account fix error message for if no stripe enabled https://github.com/Dolibarr/dolibarr/commit/0b891d5e0cc7251595e0b757b1bd5fb7af4390ff --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 3f7536368f1..30fad0b9f8f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -207,8 +207,8 @@ function societe_prepare_head(Societe $object) $sql = "SELECT COUNT(n.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n"; - $sql .= " WHERE fk_soc = ".$object->id; - $sql .= " AND status = ".$servicestatus; + $sql .= " WHERE n.fk_soc = ".$object->id; + if (!empty($conf->stripe->enabled)) $sql .= " AND n.status = ".$servicestatus; $resql = $db->query($sql); if ($resql) From f8daed7f565b08c4bae34d544adda7d075a05068 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2020 12:49:56 +0100 Subject: [PATCH 2/2] Update company.lib.php --- htdocs/core/lib/company.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 30fad0b9f8f..2e5583610db 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -208,8 +208,12 @@ function societe_prepare_head(Societe $object) $sql = "SELECT COUNT(n.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n"; $sql .= " WHERE n.fk_soc = ".$object->id; - if (!empty($conf->stripe->enabled)) $sql .= " AND n.status = ".$servicestatus; - + if (empty($conf->stripe->enabled)) { + $sql .= " AND n.stripe_card_ref IS NULL"; + } else { + $sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".$servicestatus."))"; + } + $resql = $db->query($sql); if ($resql) {