From efb9a30ec16c800c527df927e97a1248710aeaae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Jun 2019 17:17:07 +0200 Subject: [PATCH] Fix compatibility with payment modes --- htdocs/societe/paymentmodes.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 24329a48a33..6a3596f6e24 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -614,8 +614,14 @@ if (empty($reshook)) { try { $cu=$stripe->customerStripe($object, $stripeacc, $servicestatus); - $cu->default_source = (string) $source; // Old - $cu->invoice_settings->default_payment_method = (string) $source; // New + if (preg_match('/pm_/', $source)) + { + $cu->invoice_settings->default_payment_method = (string) $source; // New + } + else + { + $cu->default_source = (string) $source; // Old + } $result = $cu->save(); $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id;