remove superfluous spaces

This commit is contained in:
Frédéric FRANCE 2018-08-13 09:00:22 +02:00
parent 1b27cca91c
commit 5d0d8d10fc
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 34 additions and 35 deletions

View File

@ -131,7 +131,7 @@ else if (GETPOST('downloadcsv','alpha'))
{ {
// Make the first fetch to get first line // Make the first fetch to get first line
$obj = $db->fetch_object($res); $obj = $db->fetch_object($res);
if ($obj) if ($obj)
{ {
$previoushash = $block_static->getPreviousHash(0, $obj->rowid); $previoushash = $block_static->getPreviousHash(0, $obj->rowid);
$firstid = $obj->rowid; $firstid = $obj->rowid;

View File

@ -40,13 +40,13 @@ if (isset($_GET['connect'])){
{ {
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY; $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = 0; $servicestatus = 0;
} }
else else
{ {
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY;
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 1; $servicestatus = 1;
} }
} }
else { else {
@ -54,13 +54,13 @@ else {
{ {
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = 0; $servicestatus = 0;
} }
else else
{ {
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY;
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 1; $servicestatus = 1;
} }
} }
$payload = @file_get_contents("php://input"); $payload = @file_get_contents("php://input");
@ -228,35 +228,35 @@ elseif ($event->type == 'charge.failed') {
} }
elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated==true)) { elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated==true)) {
$fulltag=$event->data->object->metadata->FULLTAG; $fulltag=$event->data->object->metadata->FULLTAG;
// Save into $tmptag all metadata // Save into $tmptag all metadata
$tmptag=dolExplodeIntoArray($fulltag,'.','='); $tmptag=dolExplodeIntoArray($fulltag,'.','=');
if (! empty($tmptag['ORD'])){
$order=new Commande($db);
$order->fetch('',$tmptag['ORD']);
$origin='order';
$item=$order->id;
} elseif (! empty($tmptag['INV'])) {
$invoice = new Facture($db);
$invoice->fetch('',$tmptag['INV']);
$origin='invoice';
$item=$invoice->id;
}
$stripe=new Stripe($db); if (! empty($tmptag['ORD'])) {
$stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) $order=new Commande($db);
$stripecu = $stripe->getStripeCustomerAccount($tmptag['CUS'], $servicestatus); // Get thirdparty cu_... $order->fetch('',$tmptag['ORD']);
$origin='order';
$item=$order->id;
} elseif (! empty($tmptag['INV'])) {
$invoice = new Facture($db);
$invoice->fetch('',$tmptag['INV']);
$origin='invoice';
$item=$invoice->id;
}
$stripe=new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here)
$stripecu = $stripe->getStripeCustomerAccount($tmptag['CUS'], $servicestatus); // Get thirdparty cu_...
$charge=$stripe->createPaymentStripe($event->data->object->amount/100,$event->data->object->currency,$origin,$item,$event->data->object->id,$stripecu,$stripeacc,$servicestatus); $charge=$stripe->createPaymentStripe($event->data->object->amount/100,$event->data->object->currency,$origin,$item,$event->data->object->id,$stripecu,$stripeacc,$servicestatus);
if (isset($charge->id) && $charge->statut=='error'){ if (isset($charge->id) && $charge->statut=='error') {
$msg=$charge->message; $msg=$charge->message;
$code=$charge->code; $code=$charge->code;
$error++; $error++;
} }
elseif (isset($charge->id) && $charge->statut=='success' && (! empty($tmptag['ORD']))) { elseif (isset($charge->id) && $charge->statut=='success' && (! empty($tmptag['ORD']))) {
//$order=new Commande($db); //$order=new Commande($db);
//$order->fetch('',$tmptag['ORD']); //$order->fetch('',$tmptag['ORD']);
$invoice = new Facture($db); $invoice = new Facture($db);
$idinv=$invoice->createFromOrder($order,$user); $idinv=$invoice->createFromOrder($order,$user);
@ -272,17 +272,17 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
$ifverif=$invoice->socid; $ifverif=$invoice->socid;
$currency=$invoice->multicurrency_code; $currency=$invoice->multicurrency_code;
$total=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); $total=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
}else{ } else {
$msg=$invoice->error; $msg=$invoice->error;
$error++; $error++;
} }
}else{ } else {
$msg=$invoice->error; $msg=$invoice->error;
$error++; $error++;
} }
} }
if (!$error){ if (!$error) {
$datepaye = dol_now(); $datepaye = dol_now();
$paymentType ="CB"; $paymentType ="CB";
$amounts=array(); $amounts=array();
@ -298,10 +298,10 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
$paiement->note = ''; $paiement->note = '';
} }
if (! $error){ if (! $error) {
$paiement_id=$paiement->create($user, 0); $paiement_id=$paiement->create($user, 0);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && count($invoice->lines)){ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && count($invoice->lines)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
@ -315,17 +315,17 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
$invoice->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $invoice->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
if ($paiement_id < 0){ if ($paiement_id < 0) {
$msg=$paiement->errors; $msg=$paiement->errors;
$error++; $error++;
}else{ } else {
if ($event->data->object->metadata->source=='order') { if ($event->data->object->metadata->source=='order') {
$order->classifyBilled($user); $order->classifyBilled($user);
} }
} }
} }
if (! $error){ if (! $error) {
$label='(CustomerInvoicePayment)'; $label='(CustomerInvoicePayment)';
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)'; if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
$paiement->addPaymentToBank($user,'payment',$label,$conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS,'',''); $paiement->addPaymentToBank($user,'payment',$label,$conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS,'','');
@ -348,4 +348,3 @@ elseif ($event->type == 'customer.deleted') {
$db->query($sql); $db->query($sql);
$db->commit(); $db->commit();
} }