Completed
Branch develop (0ef7c9)
by
unknown
20:24
created
htdocs/public/stripe/ipn.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 		if (!empty($user->email)) {
185 185
 			$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
186 186
 		} else {
187
-			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
187
+			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
188 188
 		}
189 189
 		$replyto = $sendto;
190 190
 		$sendtocc = '';
191 191
 		if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
192
-			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
192
+			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
193 193
 		}
194 194
 
195 195
 		$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 		if (!empty($user->email)) {
275 275
 			$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
276 276
 		} else {
277
-			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
277
+			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
278 278
 		}
279 279
 		$replyto = $sendto;
280 280
 		$sendtocc = '';
281 281
 		if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
282
-			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
282
+			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
283 283
 		}
284 284
 
285 285
 		$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
 	$db->commit();
320 320
 } elseif ($event->type == 'payment_intent.succeeded') {		// Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
321 321
 	//dol_syslog("object = ".var_export($event->data, true));
322
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
322
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
323 323
 	global $stripearrayofkeysbyenv;
324 324
 	$error = 0;
325 325
 	$object = $event->data->object;
326
-	$TRANSACTIONID = $object->id;	// Example pi_123456789...
326
+	$TRANSACTIONID = $object->id; // Example pi_123456789...
327 327
 	$ipaddress = $object->metadata->ipaddress;
328 328
 	$now = dol_now();
329 329
 	$currencyCodeType = strtoupper($object->currency);
330 330
 	$paymentmethodstripeid = $object->payment_method;
331 331
 	$customer_id = $object->customer;
332 332
 	$invoice_id = "";
333
-	$paymentTypeCode = "";			// payment type according to Stripe
334
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
333
+	$paymentTypeCode = ""; // payment type according to Stripe
334
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
335 335
 	$payment_amount = 0;
336 336
 	$payment_amountInDolibarr = 0;
337 337
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 		$s = new \Stripe\StripeClient($stripeacc);
397 397
 
398 398
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
399
-		$paymentTypeCode =  $paymentmethodstripe->type;
399
+		$paymentTypeCode = $paymentmethodstripe->type;
400 400
 		if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") {
401 401
 			$paymentTypeCode = "PRE";
402 402
 		} elseif ($paymentTypeCode == "card") {
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 			$paiement->datepaye = $now;
423 423
 			$paiement->date = $now;
424 424
 			if ($currencyCodeType == $conf->currency) {
425
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
425
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
426 426
 			} else {
427
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
427
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
428 428
 
429 429
 				$postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')';
430 430
 				$ispostactionok = -1;
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 
448 448
 			$paiement->num_payment = '';
449 449
 			$paiement->note_public = '';
450
-			$paiement->note_private = 'StripeSepa payment received by IPN webhook - ' . dol_print_date($now, 'standard') . ' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
451
-			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];		// May be we should store py_... instead of pi_... but we started with pi_... so we continue.
450
+			$paiement->note_private = 'StripeSepa payment received by IPN webhook - '.dol_print_date($now, 'standard').' (TZ server) using servicestatus='.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID;
451
+			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue.
452 452
 			$paiement->ext_payment_site = $service;
453 453
 
454 454
 			$ispaymentdone = 0;
@@ -466,20 +466,20 @@  discard block
 block discarded – undo
466 466
 			$db->begin();
467 467
 
468 468
 			if (!$error && !$ispaymentdone) {
469
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.');
469
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.');
470 470
 
471 471
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
472 472
 				$paiement_id = $paiement->create($user, 1);
473 473
 				if ($paiement_id < 0) {
474
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
474
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
475 475
 					$ispostactionok = -1;
476 476
 					$error++;
477 477
 
478
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
478
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
479 479
 				} else {
480 480
 					$postactionmessages[] = 'Payment created';
481 481
 
482
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
482
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
483 483
 				}
484 484
 			}
485 485
 
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
 						$label = '(CustomerInvoicePayment)';
510 510
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
511 511
 						if ($result < 0) {
512
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
512
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
513 513
 							$ispostactionok = -1;
514 514
 							$error++;
515 515
 						} else {
516 516
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
517 517
 						}
518 518
 					} else {
519
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
519
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
520 520
 						$ispostactionok = -1;
521 521
 						$error++;
522 522
 					}
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 			$error++;
681 681
 		}
682 682
 
683
-		if (! $error) {
683
+		if (!$error) {
684 684
 			$db->commit();
685 685
 		} else {
686 686
 			$db->rollback();
Please login to merge, or discard this patch.
htdocs/compta/bank/bankentries_list.php 1 patch
Spacing   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $search_type = GETPOST("search_type", 'alpha');
78 78
 $search_account = GETPOST("search_account", 'int') ? GETPOST("search_account", 'int') : GETPOST("account", 'int');
79 79
 $search_accountancy_code = GETPOST('search_accountancy_code', 'alpha') ? GETPOST('search_accountancy_code', 'alpha') : GETPOST('accountancy_code', 'alpha');
80
-$search_bid = GETPOST("search_bid", 'int') ? GETPOST("search_bid", 'int') : GETPOST("bid", 'int');		// Category id
80
+$search_bid = GETPOST("search_bid", 'int') ? GETPOST("search_bid", 'int') : GETPOST("bid", 'int'); // Category id
81 81
 $search_ref = GETPOST('search_ref', 'alpha');
82 82
 $search_description = GETPOST("search_description", 'alpha');
83 83
 $search_dt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_start_dtmonth'), GETPOSTINT('search_start_dtday'), GETPOSTINT('search_start_dtyear'));
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 $search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
151 151
 
152 152
 $arrayfields = array(
153
-	'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1,'position' => 10),
154
-	'b.label' => array('label' => $langs->trans("Description"), 'checked' => 1,'position' => 20),
155
-	'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => -1,'position' => 30),
156
-	'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => 1,'position' => 40),
157
-	'type' => array('label' => $langs->trans("Type"), 'checked' => 1,'position' => 50),
158
-	'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => 0,'position' => 60),
153
+	'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1, 'position' => 10),
154
+	'b.label' => array('label' => $langs->trans("Description"), 'checked' => 1, 'position' => 20),
155
+	'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => -1, 'position' => 30),
156
+	'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => 1, 'position' => 40),
157
+	'type' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 50),
158
+	'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => 0, 'position' => 60),
159 159
 	'b.fk_bordereau' => array('label' => $langs->trans("ChequeNumber"), 'checked' => 0, 'position' => 65),
160 160
 	'bu.label' => array('label' => $langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked' => 1, 'position' => 70),
161 161
 	'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => (($id > 0 || !empty($ref)) ? 0 : 1), 'position' => 80),
@@ -652,20 +652,20 @@  discard block
 block discarded – undo
652 652
 	$sql .= " AND b.rappro = ".((int) $search_conciliated);
653 653
 }
654 654
 if ($search_fk_bordereau > 0) {
655
-	$sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
655
+	$sql .= " AND b.fk_bordereau = ".((int) $search_fk_bordereau);
656 656
 }
657 657
 if ($search_thirdparty_user) {
658 658
 	$sql .= " AND (b.rowid IN ";
659 659
 	$sql .= " 	( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
660 660
 	$sql .= "	 JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
661 661
 	$sql .= "	 JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
662
-	$sql .= "	  WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, 0, 1).")";
662
+	$sql .= "	  WHERE ".natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, 0, 1).")";
663 663
 
664 664
 	$sql .= " OR b.rowid IN ";
665 665
 	$sql .= " 	( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
666 666
 	$sql .= "	 JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
667 667
 	$sql .= "	 JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
668
-	$sql .= "	  WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, 0, 1);
668
+	$sql .= "	  WHERE ".natural_search(array("subSoc.nom"), $search_thirdparty_user, 0, 1);
669 669
 	$sql .= "))";
670 670
 }
671 671
 if ($search_description) {
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 	}
1092 1092
 
1093 1093
 	$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1094
-	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
1094
+	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1095 1095
 	$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1096 1096
 	$selectedfields .= ($action == 'reconcile' ? $form->showCheckAddButtons('checkforselect', 1) : '');
1097 1097
 
@@ -1459,10 +1459,10 @@  discard block
 block discarded – undo
1459 1459
 			$backgroundcolor = "class='oddeven'";
1460 1460
 		} else {
1461 1461
 			if ($objp->amount < 0) {
1462
-				$color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
1462
+				$color = '#'.getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
1463 1463
 				$backgroundcolor = 'style="background: '.$color.';"';
1464 1464
 			} else {
1465
-				$color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
1465
+				$color = '#'.getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
1466 1466
 				$backgroundcolor = 'style="background: '.$color.';"';
1467 1467
 			}
1468 1468
 		}
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 				}
1612 1612
 			}
1613 1613
 
1614
-			print $labeltoshow;	// Already escaped
1614
+			print $labeltoshow; // Already escaped
1615 1615
 
1616 1616
 			print '</td>';
1617 1617
 			if (!$i) {
@@ -1713,8 +1713,7 @@  discard block
 block discarded – undo
1713 1713
 					$companylinked_id = $donstatic->socid;
1714 1714
 					if (!$companylinked_id) {
1715 1715
 						$thirdstr = ($donstatic->societe !== "" ?
1716
-									$donstatic->societe :
1717
-									$donstatic->firstname." ".$donstatic->lastname);
1716
+									$donstatic->societe : $donstatic->firstname." ".$donstatic->lastname);
1718 1717
 					}
1719 1718
 				}
1720 1719
 				if ($links[$key]['type'] == 'payment_expensereport') {
@@ -1860,7 +1859,7 @@  discard block
 block discarded – undo
1860 1859
 
1861 1860
 		// Fields from hook
1862 1861
 		$parameters = array('arrayfields' => $arrayfields, 'obj' => $objp, 'i' => $i, 'totalarray' => &$totalarray);
1863
-		$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);    // Note that $action and $objecttmpect may have been modified by hook
1862
+		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $objecttmpect may have been modified by hook
1864 1863
 		print $hookmanager->resPrint;
1865 1864
 
1866 1865
 		// Action edit/delete and select
Please login to merge, or discard this patch.