Fix show correct stripe publishable_key on payment mode page
This commit is contained in:
parent
cb71d5a7bb
commit
95fc14475c
@ -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 .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
|
||||
if ($fieldrequired) $ret .= '<span class="fieldrequired">';
|
||||
$ret .= $langs->trans($text);
|
||||
if ($help) {
|
||||
$ret .= $this->textwithpicto($langs->trans($text), $help);
|
||||
} else {
|
||||
$ret .= $langs->trans($text);
|
||||
}
|
||||
if ($fieldrequired) $ret .= '</span>';
|
||||
$ret .= '</div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fieldrequired) $ret .= '<span class="fieldrequired">';
|
||||
$ret .= $langs->trans($text);
|
||||
if ($help) {
|
||||
$ret .= $this->textwithpicto($langs->trans($text), $help);
|
||||
} else {
|
||||
$ret .= $langs->trans($text);
|
||||
}
|
||||
if ($fieldrequired) $ret .= '</span>';
|
||||
}
|
||||
}
|
||||
@ -131,7 +140,11 @@ class Form
|
||||
{
|
||||
if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
|
||||
if ($fieldrequired) $ret .= '<span class="fieldrequired">';
|
||||
$ret .= $langs->trans($text);
|
||||
if ($help) {
|
||||
$ret .= $this->textwithpicto($langs->trans($text), $help);
|
||||
} else {
|
||||
$ret .= $langs->trans($text);
|
||||
}
|
||||
if ($fieldrequired) $ret .= '</span>';
|
||||
if (!empty($notabletag)) $ret .= ' ';
|
||||
if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= '</td>';
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 '<tr><td class="titlefield">';
|
||||
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 '</td><td>';
|
||||
print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid');
|
||||
if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user