Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-01-29 23:08:51 +01:00
commit 4b0ca24ca3
6 changed files with 12 additions and 11 deletions

View File

@ -1466,7 +1466,7 @@ class ExtraFields
} }
// We have to join on extrafield table // We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) { if (strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
$sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4];
} else { } else {

View File

@ -1345,7 +1345,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
{ {
foreach ($arrayofcss as $cssfile) foreach ($arrayofcss as $cssfile)
{ {
if (preg_match('/^http/i', $cssfile)) if (preg_match('/^(http|\/\/)/i', $cssfile))
{ {
$urltofile = $cssfile; $urltofile = $cssfile;
} }
@ -1497,7 +1497,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<!-- Includes JS added by page -->'."\n"; print '<!-- Includes JS added by page -->'."\n";
foreach ($arrayofjs as $jsfile) foreach ($arrayofjs as $jsfile)
{ {
if (preg_match('/^http/i', $jsfile)) if (preg_match('/^(http|\/\/)/i', $jsfile))
{ {
print '<script src="'.$jsfile.'"></script>'."\n"; print '<script src="'.$jsfile.'"></script>'."\n";
} }

View File

@ -484,7 +484,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled))
'metadata' => $metadata, 'metadata' => $metadata,
'customer' => $customer->id, 'customer' => $customer->id,
'source' => $card, 'source' => $card,
'statement_descriptor' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) 'statement_descriptor_suffix' => dol_trunc($FULLTAG, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc")); ), array("idempotency_key" => "$FULLTAG", "stripe_account" => "$stripeacc"));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge)) if (empty($charge))

View File

@ -165,7 +165,7 @@ print '<input type="hidden" name="action" value="setvalue">';
dol_fiche_head($head, 'stripeaccount', '', -1); dol_fiche_head($head, 'stripeaccount', '', -1);
$stripearrayofwebhookevents = array('payout.created', 'payout.paid', 'charge.pending', 'charge.refunded', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed', 'payment_method.attached', 'payment_method.updated', 'payment_method.card_automatically_updated', 'payment_method.detached', 'source.chargeable', 'customer.deleted'); $stripearrayofwebhookevents=array('account.updated', 'payout.created', 'payout.paid', 'charge.pending', 'charge.refunded', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed', 'payment_method.attached', 'payment_method.updated', 'payment_method.card_automatically_updated', 'payment_method.detached', 'source.chargeable', 'customer.deleted');
print '<span class="opacitymedium">'.$langs->trans("StripeDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("StripeDesc")."</span><br>\n";

View File

@ -416,7 +416,8 @@ class Stripe extends CommonObject
"currency" => $currency_code, "currency" => $currency_code,
"payment_method_types" => array("card"), "payment_method_types" => array("card"),
"description" => $description, "description" => $description,
"statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
//"save_payment_method" => true,
"setup_future_usage" => "on_session", "setup_future_usage" => "on_session",
"metadata" => $metadata "metadata" => $metadata
); );
@ -933,7 +934,7 @@ class Stripe extends CommonObject
$charge = \Stripe\Charge::create(array( $charge = \Stripe\Charge::create(array(
"amount" => "$stripeamount", "amount" => "$stripeamount",
"currency" => "$currency", "currency" => "$currency",
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
"description" => "Stripe payment: ".$description, "description" => "Stripe payment: ".$description,
"capture" => $capture, "capture" => $capture,
"metadata" => $metadata, "metadata" => $metadata,
@ -943,7 +944,7 @@ class Stripe extends CommonObject
$paymentarray = array( $paymentarray = array(
"amount" => "$stripeamount", "amount" => "$stripeamount",
"currency" => "$currency", "currency" => "$currency",
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
"description" => "Stripe payment: ".$description, "description" => "Stripe payment: ".$description,
"capture" => $capture, "capture" => $capture,
"metadata" => $metadata, "metadata" => $metadata,
@ -973,7 +974,7 @@ class Stripe extends CommonObject
$paymentarray = array( $paymentarray = array(
"amount" => "$stripeamount", "amount" => "$stripeamount",
"currency" => "$currency", "currency" => "$currency",
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) "statement_descriptor_suffix" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
"description" => "Stripe payment: ".$description, "description" => "Stripe payment: ".$description,
"capture" => $capture, "capture" => $capture,
"metadata" => $metadata, "metadata" => $metadata,

View File

@ -55,4 +55,4 @@ else
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
\Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version
\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION) ? "2019-05-16" : $conf->global->STRIPE_FORCE_VERSION); // force version API \Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION) ? "2019-09-09" : $conf->global->STRIPE_FORCE_VERSION); // force version API