diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c5414d6c89c..0eadfba7ad0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -100,9 +100,10 @@ class Form * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @param string $paramid Key of parameter for id ('id', 'socid') + * @param string $help Tooltip help * @return string HTML edit field */ - public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id') + public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') { global $conf, $langs; @@ -116,14 +117,22 @@ class Form $tmp = explode(':', $typeofdata); $ret .= '
'; if ($fieldrequired) $ret .= ''; - $ret .= $langs->trans($text); + if ($help) { + $ret .= $this->textwithpicto($langs->trans($text), $help); + } else { + $ret .= $langs->trans($text); + } if ($fieldrequired) $ret .= ''; $ret .= '
'."\n"; } else { if ($fieldrequired) $ret .= ''; - $ret .= $langs->trans($text); + if ($help) { + $ret .= $this->textwithpicto($langs->trans($text), $help); + } else { + $ret .= $langs->trans($text); + } if ($fieldrequired) $ret .= ''; } } @@ -131,7 +140,11 @@ class Form { if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= ''; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 49ee793b285..d6b9ef35acf 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -310,7 +310,8 @@ class SocieteAccount extends CommonObject $sql .= " WHERE sa.fk_soc = " . $id; $sql .= " AND sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status); - $sql .= " AND key_account IS NOT NULL AND key_account <> ''"; + $sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''"; + $sql .= " AND (sa.site_account = '' OR sa.site_account IS NULL OR sa.site_account = '".$this->db->escape($site_account)."')"; $sql .= " ORDER BY sa.site_account DESC"; // To get the entry with a site_account defined in priority dol_syslog(get_class($this) . "::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index ddc667ef12e..44f391d529a 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -81,8 +81,7 @@ if (!empty($conf->stripe->enabled)) // Force to use the correct API key global $stripearrayofkeysbyenv; - $site_account = $stripearrayofkeysbyenv[$servicestatus]['public_key']; - //var_dump($site_account); + $site_account = $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; $stripe = new Stripe($db); $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account (no remote access to Stripe here) @@ -848,7 +847,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $permissiontowrite = $user->rights->societe->creer; // Stripe customer key 'cu_....' stored into llx_societe_account print '
'; if ($fieldrequired) $ret .= ''; - $ret .= $langs->trans($text); + if ($help) { + $ret .= $this->textwithpicto($langs->trans($text), $help); + } else { + $ret .= $langs->trans($text); + } if ($fieldrequired) $ret .= ''; if (!empty($notabletag)) $ret .= ' '; if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= '
'; - print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); + print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid', 'Publishable key '.$site_account); print ''; print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account')