Completed
Branch develop (2e925d)
by
unknown
23:22
created
htdocs/public/stripe/ipn.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 		if (!empty($user->email)) {
205 205
 			$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
206 206
 		} else {
207
-			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
207
+			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
208 208
 		}
209 209
 		$replyto = $sendto;
210 210
 		$sendtocc = '';
211 211
 		if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
212
-			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
212
+			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
213 213
 		}
214 214
 
215 215
 		$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');
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			$typefrom = 'PRE';
271 271
 			$typeto = 'VIR';
272 272
 
273
-			$numChqOrOpe = '';	// TODO Store the po ref from $event->data
273
+			$numChqOrOpe = ''; // TODO Store the po ref from $event->data
274 274
 
275 275
 			$db->begin();
276 276
 
@@ -364,19 +364,19 @@  discard block
 block discarded – undo
364 364
 	dol_syslog("object = ".var_export($event->data, true));
365 365
 	dol_syslog("object = ".var_export($event->data, true), LOG_DEBUG, 0, '_payment');
366 366
 
367
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
367
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
368 368
 	global $stripearrayofkeysbyenv;
369 369
 	$error = 0;
370 370
 	$object = $event->data->object;
371
-	$TRANSACTIONID = $object->id;	// Example 'pi_123456789...'
371
+	$TRANSACTIONID = $object->id; // Example 'pi_123456789...'
372 372
 	$ipaddress = $object->metadata->ipaddress;
373 373
 	$now = dol_now();
374 374
 	$currencyCodeType = strtoupper($object->currency);
375 375
 	$paymentmethodstripeid = $object->payment_method;
376 376
 	$customer_id = $object->customer;
377 377
 	$invoice_id = "";
378
-	$paymentTypeCode = "";				// payment type according to Stripe
379
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
378
+	$paymentTypeCode = ""; // payment type according to Stripe
379
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
380 380
 	$payment_amount = 0;
381 381
 	$payment_amountInDolibarr = 0;
382 382
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		$s = new \Stripe\StripeClient($stripeacc);
450 450
 
451 451
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
452
-		$paymentTypeCode =  $paymentmethodstripe->type;
452
+		$paymentTypeCode = $paymentmethodstripe->type;
453 453
 		if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") {
454 454
 			$paymentTypeCode = "PRE";
455 455
 		} elseif ($paymentTypeCode == "card") {
@@ -479,9 +479,9 @@  discard block
 block discarded – undo
479 479
 			$paiement->datepaye = $now;
480 480
 			$paiement->date = $now;
481 481
 			if ($currencyCodeType == $conf->currency) {
482
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
482
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
483 483
 			} else {
484
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
484
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
485 485
 
486 486
 				$postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')';
487 487
 				$ispostactionok = -1;
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 
505 505
 			$paiement->num_payment = '';
506 506
 			$paiement->note_public = '';
507
-			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - ' . dol_print_date($now, 'standard') . ' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
507
+			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - '.dol_print_date($now, 'standard').' (TZ server) using servicestatus='.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID;
508 508
 
509
-			$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.
509
+			$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.
510 510
 			$paiement->ext_payment_site = $service;
511 511
 
512 512
 			$ispaymentdone = 0;
@@ -525,23 +525,23 @@  discard block
 block discarded – undo
525 525
 			$db->begin();
526 526
 
527 527
 			if (!$error && !$ispaymentdone) {
528
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.');
529
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
528
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.');
529
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
530 530
 
531 531
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
532 532
 				$paiement_id = $paiement->create($user, 1);
533 533
 				if ($paiement_id < 0) {
534
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
534
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
535 535
 					$ispostactionok = -1;
536 536
 					$error++;
537 537
 
538
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
539
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
538
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
539
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
540 540
 				} else {
541 541
 					$postactionmessages[] = 'Payment created';
542 542
 
543
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
544
-					dol_syslog("The payment has been created for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
543
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
544
+					dol_syslog("The payment has been created for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
545 545
 				}
546 546
 			}
547 547
 
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 						$label = '(CustomerInvoicePayment)';
574 574
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
575 575
 						if ($result < 0) {
576
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
576
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
577 577
 							$ispostactionok = -1;
578 578
 							$error++;
579 579
 						} else {
580 580
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
581 581
 						}
582 582
 					} else {
583
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
583
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
584 584
 						$ispostactionok = -1;
585 585
 						$error++;
586 586
 					}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 			$error++;
753 753
 		}
754 754
 
755
-		if (! $error) {
755
+		if (!$error) {
756 756
 			$db->commit();
757 757
 		} else {
758 758
 			$db->rollback();
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 		$companypaymentmode->card_type       = $event->data->object->card->branding;
787 787
 
788 788
 		$companypaymentmode->owner_name      = $event->data->object->billing_details->name;
789
-		$companypaymentmode->proprio         = $companypaymentmode->owner_name;			// We may still need this for modulebuilder code because name of field is "proprio"
789
+		$companypaymentmode->proprio         = $companypaymentmode->owner_name; // We may still need this for modulebuilder code because name of field is "proprio"
790 790
 
791 791
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
792 792
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 		$companypaymentmode->label           = '';
829 829
 		$companypaymentmode->number          = $db->escape($event->data->object->id);
830 830
 		$companypaymentmode->last_four       = $db->escape($event->data->object->card->last4);
831
-		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name);	// deprecated but still needed
831
+		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name); // deprecated but still needed
832 832
 		$companypaymentmode->owner_name      = $db->escape($event->data->object->billing_details->name);
833 833
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
834 834
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -884,8 +884,8 @@  discard block
 block discarded – undo
884 884
 	$paymentmethodstripeid = $object->payment_method;
885 885
 	$customer_id = $object->customer;
886 886
 	$reason = $object->reason;
887
-	$amountdisputestripe = $object->amount;			// In stripe format
888
-	$amountdispute = $stripe->convertAmount($amountdisputestripe, $currencyCodeType, 1);			// In real currency format
887
+	$amountdisputestripe = $object->amount; // In stripe format
888
+	$amountdispute = $stripe->convertAmount($amountdisputestripe, $currencyCodeType, 1); // In real currency format
889 889
 	$statusdispute = $object->status;
890 890
 
891 891
 	$pkey = '';
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	if (!empty($balance_transactions_array) && is_array($balance_transactions_array)) {
901 901
 		foreach ($balance_transactions_array as $tmpval) {
902 902
 			if (isset($tmpval['fee'])) {
903
-				$feesstripe += (int) $tmpval['fee'];		// In stripe format
903
+				$feesstripe += (int) $tmpval['fee']; // In stripe format
904 904
 			}
905 905
 		}
906 906
 	}
907
-	$fees = $stripe->convertAmount($feesstripe, $currencyCodeType, 1);			// In real currency format
907
+	$fees = $stripe->convertAmount($feesstripe, $currencyCodeType, 1); // In real currency format
908 908
 
909 909
 	$invoice_id = 0;
910
-	$paymentTypeCode = "";			// payment type according to Stripe
911
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
910
+	$paymentTypeCode = ""; // payment type according to Stripe
911
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
912 912
 	$payment_amount = 0;
913 913
 	$payment_amountInDolibarr = 0;
914 914
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		// If invoice was closed, we reopen it
989 989
 		if ($tmpinvoice->status == Facture::STATUS_CLOSED) {
990 990
 			// Switch back the invoice to status validated
991
-			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none');	// Trigger will be run later
991
+			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none'); // Trigger will be run later
992 992
 			if ($result < 0) {
993 993
 				$errormsg = $tmpinvoice->error.implode(', ', $tmpinvoice->errors);
994 994
 				$error++;
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 		$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
1061 1061
 		*/
1062 1062
 		$paiement->paiementid   = dol_getIdFromCode($db, 'PRE', 'c_paiement', 'code', 'id', 1);
1063
-		$paiement->num_payment  = $object->id;	// A string like 'du_...'
1063
+		$paiement->num_payment  = $object->id; // A string like 'du_...'
1064 1064
 		$paiement->note_public = 'Fund withdrawn by bank. Reason: '.$reason;
1065 1065
 		$paiement->note_private = '';
1066 1066
 		$paiement->fk_account   = $accountfrom->id;
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 			$error++;
1077 1077
 		}
1078 1078
 
1079
-		if (! $error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
1079
+		if (!$error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
1080 1080
 			// Switch back the invoice to status validated
1081 1081
 			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none');
1082 1082
 			if ($result < 0) {
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			}
1092 1092
 		}
1093 1093
 
1094
-		if (! $error) {
1094
+		if (!$error) {
1095 1095
 			$paiement_id = $paiement->create($user, 0, $tmpinvoice->thirdparty); // This include regenerating documents
1096 1096
 			if ($paiement_id < 0) {
1097 1097
 				$errormsg = $paiement->error.implode(', ', $paiement->errors);
Please login to merge, or discard this patch.
htdocs/public/payment/paymentok.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 $paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
152 152
 $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
153 153
 if (getDolGlobalString($paramcreditorlong)) {
154
-	$creditor = getDolGlobalString($paramcreditorlong);	// use label long of the seller to show
154
+	$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
155 155
 } elseif (getDolGlobalString($paramcreditor)) {
156
-	$creditor = getDolGlobalString($paramcreditor);		// use label short of the seller to show
156
+	$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
157 157
 }
158 158
 
159 159
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 $head = '';
222 222
 if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
223
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
223
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
224 224
 }
225 225
 
226 226
 $conf->dol_hide_topmenu = 1;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	}
281 281
 	if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) {
282 282
 		print '<div class="backimagepublicpayment">';
283
-		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' . getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
283
+		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="'.getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
284 284
 		print '</div>';
285 285
 	}
286 286
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
 
292 292
 // Add steps to validate payment is complete when we enter this page
293
-$service = $paymentmethod;	// to have a default value. We may change it later for 'StripeLive' or 'StripeTest'...
293
+$service = $paymentmethod; // to have a default value. We may change it later for 'StripeLive' or 'StripeTest'...
294 294
 
295 295
 // For Paypal: validate the payment (Paypal need another step after the callback return to validate the payment).
296 296
 if (isModEnabled('paypal') && $paymentmethod === 'paypal') {	// We call this page only if payment is ok on payment system
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 		// Get on url call
300 300
 		$onlinetoken        = $PAYPALTOKEN;
301 301
 		$fulltag            = $FULLTAG;
302
-		$payerID 			= !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
302
+		$payerID = !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
303 303
 		// Set by newpayment.php
304 304
 		$ipaddress          = $_SESSION['ipaddress'];
305 305
 		$currencyCodeType   = $_SESSION['currencyCodeType'];
306 306
 		$FinalPaymentAmt    = $_SESSION["FinalPaymentAmt"];
307
-		$paymentType        = $_SESSION['PaymentType'];			// Value can be 'Mark', 'Sole', 'Sale' for example
307
+		$paymentType        = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example
308 308
 
309 309
 		dol_syslog("Call paymentok with token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
310 310
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 if (isModEnabled('stripe') && $paymentmethod === 'stripe') {
382 382
 	// TODO: Move this block to the top to ensure all session variables (e.g., TRANSACTIONID, FinalPaymentAmt, currencyCodeType, etc.) are loaded before executing checks for any payment module.
383 383
 	if (empty($TRANSACTIONID)) {
384
-		$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID'];	// pi_... or ch_...
384
+		$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_...
385 385
 		if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) {
386 386
 			// For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2
387 387
 			$TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml');
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 
430 430
 				if ((int) $paymentIntent->amount !== $expectedAmount || strtolower($paymentIntent->currency) !== $expectedCurrency) {
431 431
 					$error++;
432
-					$errmsg = 'Stripe payment information mismatch: expected amount ' . $expectedAmount . ' and currency ' . $expectedCurrency . ', got amount ' . $paymentIntent->amount . ' and currency ' . $paymentIntent->currency;
432
+					$errmsg = 'Stripe payment information mismatch: expected amount '.$expectedAmount.' and currency '.$expectedCurrency.', got amount '.$paymentIntent->amount.' and currency '.$paymentIntent->currency;
433 433
 					dol_syslog($errmsg, LOG_ERR, 0, '_payment');
434 434
 				}
435 435
 				if ($paymentIntent->status !== 'succeeded') {
436 436
 					$error++;
437
-					$errmsg = 'Stripe payment not succeeded. Status: ' . $paymentIntent->status;
437
+					$errmsg = 'Stripe payment not succeeded. Status: '.$paymentIntent->status;
438 438
 					dol_syslog($errmsg, LOG_ERR, 0, '_payment');
439 439
 				}
440 440
 			} catch (\Stripe\Exception\ApiErrorException $e) {
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			}
451 451
 		} catch (Exception $e) {
452 452
 			$error++;
453
-			$errmsg = 'Stripe API error: ' . $e->getMessage();
453
+			$errmsg = 'Stripe API error: '.$e->getMessage();
454 454
 			dol_syslog($errmsg, LOG_ERR, 0, '_payment');
455 455
 		}
456 456
 	} else {
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 }
500 500
 
501 501
 if (empty($TRANSACTIONID)) {
502
-	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID'];	// pi_... or ch_...
502
+	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_...
503 503
 	if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) {
504 504
 		// For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2
505 505
 		$TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml');
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 				if (empty($adht->caneditamount)) {	// If we didn't allow members to choose their membership amount (if the amount is allowed in edit mode, no need to check)
595 595
 					if ($object->status == $object::STATUS_DRAFT) {		// If the member is not yet validated, we check that the amount is the same as expected.
596 596
 						$typeid = $object->typeid;
597
-						$amountbytype = $adht->amountByType(1);		// Load the array of amount per type
597
+						$amountbytype = $adht->amountByType(1); // Load the array of amount per type
598 598
 
599 599
 						// Set amount for the subscription:
600 600
 						// - First check the amount of the member type.
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 				if (getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
625 625
 					if ($FinalPaymentAmt < getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
626 626
 						$error++;
627
-						$errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed (' . getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?';
627
+						$errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?';
628 628
 						$postactionmessages[] = $errmsg;
629 629
 						$ispostactionok = -1;
630 630
 						dol_syslog("Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0, '_payment');
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 					dol_syslog("Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0, '_payment');
641 641
 				}
642 642
 
643
-				if (! $error) {
643
+				if (!$error) {
644 644
 					// We validate the member (no effect if it is already validated)
645 645
 					$result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible
646 646
 					if ($result < 0 || empty($object->datevalid)) {
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 						$thirdparty = new Societe($db);
811 811
 						$thirdparty->fetch($thirdparty_id);
812 812
 
813
-						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';	// This also set $stripearrayofkeysbyenv
813
+						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv
814 814
 						$stripe = new Stripe($db);
815 815
 						//$stripeacc = $stripe->getStripeAccount($service);		Already defined previously
816 816
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 
826 826
 								if (preg_match('/^pi_/', $TRANSACTIONID)) {
827 827
 									// This may throw an error if not found.
828
-									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);	// payment_intent (pi_...)
828
+									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...)
829 829
 								} else {
830 830
 									// This throw an error if not found
831 831
 									$chpi = \Stripe\Charge::retrieve($TRANSACTIONID); // old method, contains the charge id (ch_...)
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 				// Create external user
885 885
 				if (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN')) {
886 886
 					$nuser = new User($db);
887
-					$tmpuser = dol_clone($object, 0);		// $object is type Adherent
887
+					$tmpuser = dol_clone($object, 0); // $object is type Adherent
888 888
 
889 889
 					// Check if a user login already exists for this member or not
890 890
 					$found = 0;
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 			$ispostactionok = -1;
1137 1137
 		}
1138 1138
 	} elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) {
1139
-		include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
1139
+		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1140 1140
 		$object = new Commande($db);
1141 1141
 		$result = $object->fetch((int) $tmptag['ORD']);
1142 1142
 		if ($result) {
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1178 1178
 					$db->begin();
1179 1179
 
1180
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1180
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1181 1181
 					$invoice = new Facture($db);
1182 1182
 					$result = $invoice->createFromOrder($object, $user);
1183 1183
 					if ($result > 0) {
@@ -1189,12 +1189,12 @@  discard block
 block discarded – undo
1189 1189
 							// TODO Send a warning email.
1190 1190
 						}
1191 1191
 
1192
-						$object->classifyBilled($user);		// The invoice has been create from the order so total is the same, so we can classify order to billed (even if payment may be partial).
1192
+						$object->classifyBilled($user); // The invoice has been create from the order so total is the same, so we can classify order to billed (even if payment may be partial).
1193 1193
 
1194
-						$invoice->validate($user);			// This may re-classify all linked orders to billed (done previously) if amount of invoice is ok by triggers, depending on the workflow module setup.
1194
+						$invoice->validate($user); // This may re-classify all linked orders to billed (done previously) if amount of invoice is ok by triggers, depending on the workflow module setup.
1195 1195
 
1196 1196
 						// Creation of payment line (warning: if amount has been modified on page, the payment may be partial)
1197
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1197
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1198 1198
 						$paiement = new Paiement($db);
1199 1199
 						$paiement->datepaye = $now;
1200 1200
 						if ($currencyCodeType == $conf->currency) {
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 						}
1209 1209
 						$paiement->paiementid = $paymentTypeId;
1210 1210
 						$paiement->num_payment = '';
1211
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1211
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1212 1212
 
1213 1213
 						// Get $customerid and $pkey
1214 1214
 						$customerid = '';
@@ -1226,12 +1226,12 @@  discard block
 block discarded – undo
1226 1226
 						} else {
1227 1227
 							$paiement->ext_payment_id = $TRANSACTIONID;
1228 1228
 						}
1229
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1229
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1230 1230
 
1231 1231
 						if (!$error) {
1232 1232
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1233 1233
 							if ($paiement_id < 0) {
1234
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1234
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1235 1235
 								$ispostactionok = -1;
1236 1236
 								$error++;
1237 1237
 							} else {
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 								}
1269 1269
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1270 1270
 								if ($result < 0) {
1271
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1271
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1272 1272
 									$ispostactionok = -1;
1273 1273
 									$error++;
1274 1274
 								} else {
@@ -1276,13 +1276,13 @@  discard block
 block discarded – undo
1276 1276
 									$ispostactionok = 1;
1277 1277
 								}
1278 1278
 							} else {
1279
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1279
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1280 1280
 								$ispostactionok = -1;
1281 1281
 								$error++;
1282 1282
 							}
1283 1283
 						}
1284 1284
 					} else {
1285
-						$postactionmessages[] = 'Failed to create invoice form order ' . $tmptag['ORD'] . '.';
1285
+						$postactionmessages[] = 'Failed to create invoice form order '.$tmptag['ORD'].'.';
1286 1286
 						$ispostactionok = -1;
1287 1287
 						$error++;
1288 1288
 					}
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 						$db->rollback();
1294 1294
 					}
1295 1295
 				} else {
1296
-					$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of order ' . $tmptag['ORD'] . '. May be payment was already recorded.';
1296
+					$postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of order '.$tmptag['ORD'].'. May be payment was already recorded.';
1297 1297
 					$ispostactionok = -1;
1298 1298
 				}
1299 1299
 			} else {
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 				$ispostactionok = -1;
1302 1302
 			}
1303 1303
 		} else {
1304
-			$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
1304
+			$postactionmessages[] = 'Order paid '.$tmptag['ORD'].' was not found';
1305 1305
 			$ispostactionok = -1;
1306 1306
 		}
1307 1307
 	} elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) {
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
 				$paiement->datep = $now;
1359 1359
 				$paiement->paymenttype = $paymentTypeId;
1360 1360
 				$paiement->num_payment = '';
1361
-				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1361
+				$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1362 1362
 
1363 1363
 				// Get $customerid and $pkey
1364 1364
 				$customerid = '';
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 				} else {
1377 1377
 					$paiement->ext_payment_id = $TRANSACTIONID;
1378 1378
 				}
1379
-				$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1379
+				$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1380 1380
 
1381 1381
 				if (!$error) {
1382 1382
 					$paiement_id = $paiement->create($user, 1);
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 		require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
1457 1457
 		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1458 1458
 		$object = new Facture($db);
1459
-		$result = $object->fetch((int) $ref);  // @phan-suppress-curren-line PhanPluginSuspiciousParamPosition
1459
+		$result = $object->fetch((int) $ref); // @phan-suppress-curren-line PhanPluginSuspiciousParamPosition
1460 1460
 		if ($result) {
1461 1461
 			$paymentTypeId = 0;
1462 1462
 			if ($paymentmethod == 'paybox') {
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 					} else {
1528 1528
 						$paiement->ext_payment_id = $TRANSACTIONID;
1529 1529
 					}
1530
-					$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1530
+					$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1531 1531
 
1532 1532
 					if (!$error) {
1533 1533
 						$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 						$db->rollback();
1609 1609
 					}
1610 1610
 
1611
-					if (! $error) {
1611
+					if (!$error) {
1612 1612
 						// Sending mail
1613 1613
 						$thirdparty = new Societe($db);
1614 1614
 						$resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 							// Get email content from template
1627 1627
 							$arraydefaultmessage = null;
1628 1628
 
1629
-							$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');	// Email to send for Event organization registration
1629
+							$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration
1630 1630
 
1631 1631
 							if (!empty($idoftemplatetouse)) {
1632 1632
 								$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
1704 1704
 		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1705 1705
 		$object = new Facture($db);
1706
-		$result = $object->fetch((int) $ref);  // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1706
+		$result = $object->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1707 1707
 		if ($result) {
1708 1708
 			$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
1709 1709
 
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 					} else {
1777 1777
 						$paiement->ext_payment_id = $TRANSACTIONID;
1778 1778
 					}
1779
-					$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1779
+					$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1780 1780
 
1781 1781
 					if (!$error) {
1782 1782
 						$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
 							if ($resultboothupdate < 0) {
1848 1848
 								// Finding the third party by getting the invoice
1849 1849
 								$invoice = new Facture($db);
1850
-								$resultinvoice = $invoice->fetch((int) $ref);  // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1850
+								$resultinvoice = $invoice->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1851 1851
 								if ($resultinvoice < 0) {
1852 1852
 									$postactionmessages[] = 'Could not find the associated invoice.';
1853 1853
 									$ispostactionok = -1;
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
 										// Get email content from template
1874 1874
 										$arraydefaultmessage = null;
1875 1875
 
1876
-										$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');	// Email sent after registration for a Booth
1876
+										$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth
1877 1877
 
1878 1878
 										if (!empty($idoftemplatetouse)) {
1879 1879
 											$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 			$ispostactionok = -1;
1930 1930
 		}
1931 1931
 	} elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) {
1932
-		include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
1932
+		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
1933 1933
 		$object = new Contrat($db);
1934 1934
 		$result = $object->fetch((int) $tmptag['CON']);
1935 1935
 		if ($result) {
@@ -1969,14 +1969,14 @@  discard block
 block discarded – undo
1969 1969
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1970 1970
 					$db->begin();
1971 1971
 
1972
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1972
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1973 1973
 					$invoice = new Facture($db);
1974 1974
 					$result = $invoice->createFromContract($object, $user, array((int) $contract_lines));
1975 1975
 					if ($result > 0) {
1976 1976
 						// $object->classifyBilled($user);
1977 1977
 						$invoice->validate($user);
1978 1978
 						// Creation of payment line
1979
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1979
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1980 1980
 						$paiement = new Paiement($db);
1981 1981
 						$paiement->datepaye = $now;
1982 1982
 						if ($currencyCodeType == $conf->currency) {
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 						}
1991 1991
 						$paiement->paiementid = $paymentTypeId;
1992 1992
 						$paiement->num_payment = '';
1993
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1993
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1994 1994
 
1995 1995
 						// Get $customerid and $pkey
1996 1996
 						$customerid = '';
@@ -2008,12 +2008,12 @@  discard block
 block discarded – undo
2008 2008
 						} else {
2009 2009
 							$paiement->ext_payment_id = $TRANSACTIONID;
2010 2010
 						}
2011
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
2011
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
2012 2012
 
2013 2013
 						if (!$error) {
2014 2014
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
2015 2015
 							if ($paiement_id < 0) {
2016
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
2016
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
2017 2017
 								$ispostactionok = -1;
2018 2018
 								$error++;
2019 2019
 							} else {
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
 								}
2051 2051
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
2052 2052
 								if ($result < 0) {
2053
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
2053
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
2054 2054
 									$ispostactionok = -1;
2055 2055
 									$error++;
2056 2056
 								} else {
@@ -2058,15 +2058,15 @@  discard block
 block discarded – undo
2058 2058
 									$ispostactionok = 1;
2059 2059
 								}
2060 2060
 							} else {
2061
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
2061
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
2062 2062
 								$ispostactionok = -1;
2063 2063
 								$error++;
2064 2064
 							}
2065 2065
 						}
2066 2066
 					} else {
2067
-						$msg = 'Failed to create invoice form contract ' . $tmptag['CON'];
2067
+						$msg = 'Failed to create invoice form contract '.$tmptag['CON'];
2068 2068
 						if (!empty($tmptag['COL'])) {
2069
-							$msg .= ' and col '. $tmptag['COL'] .'.';
2069
+							$msg .= ' and col '.$tmptag['COL'].'.';
2070 2070
 						}
2071 2071
 						$postactionmessages[] = $msg;
2072 2072
 						$ispostactionok = -1;
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 						$db->rollback();
2080 2080
 					}
2081 2081
 				} else {
2082
-					$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of contract ' . $tmptag['CON'] .'. Maybe payment was already recorded.';
2082
+					$postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of contract '.$tmptag['CON'].'. Maybe payment was already recorded.';
2083 2083
 					$ispostactionok = -1;
2084 2084
 				}
2085 2085
 			} else {
@@ -2087,9 +2087,9 @@  discard block
 block discarded – undo
2087 2087
 				$ispostactionok = -1;
2088 2088
 			}
2089 2089
 		} else {
2090
-			$msg = 'Contract paid ' . $tmptag['CON'] . ' was not found';
2090
+			$msg = 'Contract paid '.$tmptag['CON'].' was not found';
2091 2091
 			if (!empty($tmptag['COL'])) {
2092
-				$msg .= ' for col '.$tmptag['COL'] .'.';
2092
+				$msg .= ' for col '.$tmptag['COL'].'.';
2093 2093
 			}
2094 2094
 			$postactionmessages[] = $msg;
2095 2095
 			$ispostactionok = -1;
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 	// Set by newpayment.php
2109 2109
 	$currencyCodeType   = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType'];
2110 2110
 	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"];
2111
-	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType'];	// Seems used by paypal only
2111
+	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only
2112 2112
 
2113 2113
 	if (is_object($object) && method_exists($object, 'call_trigger')) {
2114 2114
 		'@phan-var-force CommonObject $object';
@@ -2358,11 +2358,11 @@  discard block
 block discarded – undo
2358 2358
 	if ($ispaymentok) {
2359 2359
 		// Redirect to a success page
2360 2360
 		$randomseckey = getRandomPassword(true, null, 20);
2361
-		$_SESSION['paymentoksessioncode'] = $randomseckey;		// key between paymentok.php to another page like a paymentok of the website.
2361
+		$_SESSION['paymentoksessioncode'] = $randomseckey; // key between paymentok.php to another page like a paymentok of the website.
2362 2362
 
2363 2363
 		// Paymentok page must be created for the specific website
2364 2364
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2365
-			$ext_urlok = $ws_virtuelhost . '/paymentok.php?paymentoksessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2365
+			$ext_urlok = $ws_virtuelhost.'/paymentok.php?paymentoksessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2366 2366
 		} else {
2367 2367
 			$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?paymentoksessioncode='.urlencode($randomseckey).'&website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
2368 2368
 		}
@@ -2373,11 +2373,11 @@  discard block
 block discarded – undo
2373 2373
 	} else {
2374 2374
 		// Redirect to an error page
2375 2375
 		$randomseckey = getRandomPassword(true, null, 20);
2376
-		$_SESSION['paymentkosessioncode'] = $randomseckey;		// key between paymentok.php to another page like a paymentko of the website.
2376
+		$_SESSION['paymentkosessioncode'] = $randomseckey; // key between paymentok.php to another page like a paymentko of the website.
2377 2377
 
2378 2378
 		// Paymentko page must be created for the specific website
2379 2379
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2380
-			$ext_urlko = $ws_virtuelhost . '/paymentko.php?paymentkosessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2380
+			$ext_urlko = $ws_virtuelhost.'/paymentko.php?paymentkosessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2381 2381
 		} else {
2382 2382
 			$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?paymentkosessioncode='.urlencode($randomseckey).'&website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
2383 2383
 		}
Please login to merge, or discard this patch.
htdocs/admin/system/database-tables.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
  *	\brief      Page with information on database tables. Add also some maintenance action to convert tables.
27 27
  */
28 28
 
29
-if (! defined('CSRFCHECK_WITH_TOKEN')) {
30
-	define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
29
+if (!defined('CSRFCHECK_WITH_TOKEN')) {
30
+	define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
31 31
 }
32 32
 
33 33
 // Load Dolibarr environment
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 	if (preg_match('/general/', $defaultcollation)) {
72 72
 		$collation = 'utf8_general_ci';
73 73
 	}
74
-	$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8 COLLATE ".$db->sanitize($collation);	// Set the default value on table
74
+	$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8 COLLATE ".$db->sanitize($collation); // Set the default value on table
75 75
 	$sqllog .= $sql.'<br>';
76 76
 	$resql1 = $db->query($sql);
77 77
 	if (!$resql1) {
78 78
 		setEventMessages($db->lasterror(), null, 'warnings');
79 79
 		$resultsql = $resql1;
80 80
 	} else {
81
-		$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8 COLLATE ".$db->sanitize($collation);	// Switch fields (may fails due to foreign key)
81
+		$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8 COLLATE ".$db->sanitize($collation); // Switch fields (may fails due to foreign key)
82 82
 		$sqllog .= $sql.'<br>';
83 83
 		$resql2 = $db->query($sql);
84 84
 		if (!$resql2) {
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 	if (preg_match('/general/', $defaultcollation)) {
94 94
 		$collation = 'utf8mb4_general_ci';
95 95
 	}
96
-	$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8mb4 COLLATE ".$db->sanitize($collation);	// Set the default value on table
96
+	$sql = "ALTER TABLE ".$db->sanitize($table)." CHARACTER SET utf8mb4 COLLATE ".$db->sanitize($collation); // Set the default value on table
97 97
 	$sqllog .= $sql.'<br>';
98 98
 	$resql1 = $db->query($sql);
99 99
 	if (!$resql1) {
100 100
 		setEventMessages($db->lasterror(), null, 'warnings');
101 101
 		$resultsql = $resql1;
102 102
 	} else {
103
-		$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8mb4 COLLATE ".$db->sanitize($collation);	// Switch fields (may fails due to foreign key)
103
+		$sql = "ALTER TABLE ".$db->sanitize($table)." CONVERT TO CHARACTER SET utf8mb4 COLLATE ".$db->sanitize($collation); // Switch fields (may fails due to foreign key)
104 104
 		$sqllog .= $sql.'<br>';
105 105
 		$resql2 = $db->query($sql);
106 106
 		if (!$resql2) {
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			//print $shortsqlfilename.' ';
177 177
 			$shortsqlfilename = preg_replace('/\-[a-z]+\./', '.', $value['name']);
178 178
 			$arrayoffiles[$value['name']] = $shortsqlfilename;
179
-			if ($value['name'] == $shortsqlfilename && ! preg_match('/\.key\.sql$/', $value['name'])) {
179
+			if ($value['name'] == $shortsqlfilename && !preg_match('/\.key\.sql$/', $value['name'])) {
180 180
 				// This is a sql file automatically created
181 181
 				$arrayoftablesautocreated[$value['name']] = $shortsqlfilename;
182 182
 			}
Please login to merge, or discard this patch.
htdocs/admin/system/dbtable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		while ($i < $num) {
68 68
 			$row = $db->fetch_row($resql);
69 69
 			if ($row[0] == $field) {
70
-				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8";		// We must not sanitize the $row[1]
70
+				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8"; // We must not sanitize the $row[1]
71 71
 				$sqllog .= $sql.'<br>';
72 72
 
73 73
 				$db->query($sql);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 					$collation = 'utf8_general_ci';
79 79
 				}
80 80
 
81
-				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE ".$db->sanitize($collation);	// We must not sanitize the $row[1]
81
+				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE ".$db->sanitize($collation); // We must not sanitize the $row[1]
82 82
 				$sqllog .= $sql.'<br>';
83 83
 
84 84
 				$resql2 = $db->query($sql);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		while ($i < $num) {
103 103
 			$row = $db->fetch_row($resql);
104 104
 			if ($row[0] == $field) {
105
-				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8mb4";		// We must not sanitize the $row[1]
105
+				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." CHARACTER SET utf8mb4"; // We must not sanitize the $row[1]
106 106
 				$sqllog .= $sql.'<br>';
107 107
 
108 108
 				$db->query($sql);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 					$collation = 'utf8mb4_general_ci';
114 114
 				}
115 115
 
116
-				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE ".$db->sanitize($collation);	// We must not sanitize the $row[1]
116
+				$sql = "ALTER TABLE ".$db->sanitize($table)." MODIFY ".$db->sanitize($row[0])." ".$row[1]." COLLATE ".$db->sanitize($collation); // We must not sanitize the $row[1]
117 117
 				$sqllog .= $sql.'<br>';
118 118
 
119 119
 				$resql2 = $db->query($sql);
Please login to merge, or discard this patch.
htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 $langs->load("tasks");
49 49
 
50 50
 $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
51
-'@phan-var-force CommonObject[] $linkedObjectBlock';  // Repeat because type lost after dol_sort_array)
51
+'@phan-var-force CommonObject[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array)
52 52
 /** @var Task[] $linkedObjectBlock */
53 53
 
54 54
 $total = 0;
Please login to merge, or discard this patch.
htdocs/stripe/class/stripe.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * @var string Stripe ID (Note: Conflict with CommonObject)
50 50
 	 */
51
-	public $id;  // @phpstan-ignore-line
51
+	public $id; // @phpstan-ignore-line
52 52
 
53 53
 	/**
54 54
 	 * @var string
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 				"confirmation_method" => $stripemode,
521 521
 				"amount" => $stripeamount,
522 522
 				"currency" => $currency_code,
523
-				"payment_method_types" => $paymentmethodtypes,	// When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard
523
+				"payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard
524 524
 				/*
525 525
 				'return_url' => $dolibarr_main_url_root.'/public/payment/paymentok.php',
526 526
 				'automatic_payment_methods' => array(
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			);
536 536
 			if ($descriptor) {
537 537
 				$dataforintent["statement_descriptor_suffix"] = $descriptor; // For card payment, 22 chars that appears on bank receipt (prefix into stripe setup + this suffix)
538
-				$dataforintent["statement_descriptor"] = $descriptor; 	// For SEPA, it will take only statement_descriptor, not statement_descriptor_suffix
538
+				$dataforintent["statement_descriptor"] = $descriptor; // For SEPA, it will take only statement_descriptor, not statement_descriptor_suffix
539 539
 			}
540 540
 			if (!is_null($customer)) {
541 541
 				$dataforintent["customer"] = $customer;
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 
616 616
 							$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET";
617 617
 							$sql .= " ext_payment_site = '".$this->db->escape($service)."',";
618
-							$sql .= " ext_payment_id = '".$this->db->escape($paymentintent->id)."'";	// TODO Save the long transaction id
618
+							$sql .= " ext_payment_id = '".$this->db->escape($paymentintent->id)."'"; // TODO Save the long transaction id
619 619
 							$sql .= " WHERE rowid = ".((int) $did);
620 620
 
621 621
 							$resql = $this->db->query($sql);
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 			$dataforintent = array(
768 768
 				"confirm" => $confirmnow, // Do not confirm immediately during creation of intent
769
-				"payment_method_types" => $paymentmethodtypes,	// When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard
769
+				"payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard
770 770
 				/*
771 771
 				 'return_url' => $dolibarr_main_url_root.'/public/payment/paymentok.php',
772 772
 				 'automatic_payment_methods' => array(
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 								$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib";
1164 1164
 								$sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."',";
1165 1165
 								$sql .= " card_type = 'sepa_debit',";
1166
-								$sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "',";
1166
+								$sql .= " stripe_account= '".$this->db->escape($cu->id."@".$stripeacc)."',";
1167 1167
 								$sql .= " ext_payment_site = '".$this->db->escape($service)."'";
1168 1168
 								if (!empty($cs->mandate)) {
1169 1169
 									$mandateservice = new \Stripe\Mandate($stripeacc);
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 					} catch (Exception $e) {
1188 1188
 						$sepa = null;
1189 1189
 						$this->error = 'Stripe error: '.$e->getMessage().'. Check the BAN information.';
1190
-						dol_syslog($this->error, LOG_WARNING);	// Error from Stripe, so a warning on Dolibarr
1190
+						dol_syslog($this->error, LOG_WARNING); // Error from Stripe, so a warning on Dolibarr
1191 1191
 					}
1192 1192
 				}
1193 1193
 			}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -592,7 +592,7 @@
 block discarded – undo
592 592
 
593 593
 				$paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
594 594
 
595
-				if ($paymentintent instanceOf \Stripe\PaymentIntent) {
595
+				if ($paymentintent instanceof \Stripe\PaymentIntent) {
596 596
 					dol_syslog(get_class($this)."::getPaymentIntent paymentintent is a defined object");
597 597
 
598 598
 					// Store the payment intent
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	);
71 71
 
72 72
 
73
-	const STATUS_DRAFT = 0; 	// Draft
74
-	const STATUS_VALIDATED = 1; 	// In progress
75
-	const STATUS_DISPOSED = 9;	// Disposed
73
+	const STATUS_DRAFT = 0; // Draft
74
+	const STATUS_VALIDATED = 1; // In progress
75
+	const STATUS_DISPOSED = 9; // Disposed
76 76
 
77 77
 	/**
78 78
 	 *  'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@@ -629,11 +629,11 @@  discard block
 block discarded – undo
629 629
 		// Check parameters
630 630
 		$error = 0;
631 631
 		if (empty($this->id)) {
632
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
632
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
633 633
 			$error++;
634 634
 		}
635 635
 		if (empty($this->fk_asset_model)) {
636
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
636
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
637 637
 			$error++;
638 638
 		}
639 639
 		if ($error) {
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 
645 645
 		// Get depreciation options
646 646
 		//---------------------------
647
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
647
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
648 648
 		$options_model = new AssetDepreciationOptions($this->db);
649 649
 		$result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model);
650 650
 		if ($result < 0) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		// Get accountancy codes
680 680
 		//---------------------------
681 681
 		if (!$error) {
682
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
682
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
683 683
 			$accountancy_codes_model = new AssetAccountancyCodes($this->db);
684 684
 			$result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model);
685 685
 			if ($result < 0) {
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 		// Check parameters
739 739
 		$error = 0;
740 740
 		if (empty($this->id)) {
741
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
741
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
742 742
 			$error++;
743 743
 		}
744 744
 		if ($error) {
@@ -761,15 +761,15 @@  discard block
 block discarded – undo
761 761
 		*/
762 762
 
763 763
 		$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
764
-		$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0') . " AS bookkeeping";
765
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
766
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
767
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
764
+		$sql .= ", ".$this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0')." AS bookkeeping";
765
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
766
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
767
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
768 768
 		$sql .= " ORDER BY ad.depreciation_date ASC";
769 769
 
770 770
 		$resql = $this->db->query($sql);
771 771
 		if (!$resql) {
772
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
772
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
773 773
 			return -1;
774 774
 		}
775 775
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		// Check parameters
807 807
 		$error = 0;
808 808
 		if (empty($this->id)) {
809
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
809
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
810 810
 			$error++;
811 811
 		}
812 812
 		if ($error) {
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
 		*/
829 829
 
830 830
 		$sql = "SELECT COUNT(*) AS has_bookkeeping";
831
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
832
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
833
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
831
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
832
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
833
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
834 834
 		$sql .= " AND iab.fk_docdet IS NOT NULL";
835 835
 
836 836
 		$resql = $this->db->query($sql);
837 837
 		if (!$resql) {
838
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
838
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
839 839
 			return -1;
840 840
 		}
841 841
 
@@ -873,28 +873,28 @@  discard block
 block discarded – undo
873 873
 		// Check parameters
874 874
 		$error = 0;
875 875
 		if (empty($this->id)) {
876
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
876
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
877 877
 			$error++;
878 878
 		}
879 879
 		if ($error) {
880 880
 			return -1;
881 881
 		}
882 882
 
883
-		$sql = "INSERT INTO " . MAIN_DB_PREFIX . "asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
883
+		$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
884 884
 		$sql .= " VALUES ( ";
885
-		$sql .= " " . (int) $this->id;
886
-		$sql .= ", '" . $this->db->escape($mode) . "'";
887
-		$sql .= ", '" . $this->db->escape($ref) . "'";
888
-		$sql .= ", '" . $this->db->idate($depreciation_date) . "'";
889
-		$sql .= ", " . (float) $depreciation_ht;
890
-		$sql .= ", " . (float) $cumulative_depreciation_ht;
891
-		$sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'";
892
-		$sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'";
885
+		$sql .= " ".(int) $this->id;
886
+		$sql .= ", '".$this->db->escape($mode)."'";
887
+		$sql .= ", '".$this->db->escape($ref)."'";
888
+		$sql .= ", '".$this->db->idate($depreciation_date)."'";
889
+		$sql .= ", ".(float) $depreciation_ht;
890
+		$sql .= ", ".(float) $cumulative_depreciation_ht;
891
+		$sql .= ", '".$this->db->escape($accountancy_code_debit)."'";
892
+		$sql .= ", '".$this->db->escape($accountancy_code_credit)."'";
893 893
 		$sql .= ")";
894 894
 
895 895
 		$resql = $this->db->query($sql);
896 896
 		if (!$resql) {
897
-			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror();
897
+			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror();
898 898
 			return -1;
899 899
 		}
900 900
 
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 		// Check parameters
918 918
 		$error = 0;
919 919
 		if (empty($this->id)) {
920
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
920
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
921 921
 			$error++;
922 922
 		}
923 923
 		if ($error) {
924 924
 			return -1;
925 925
 		}
926 926
 
927
-		if (! empty($this->not_depreciated)) {
927
+		if (!empty($this->not_depreciated)) {
928 928
 			return 1;
929 929
 		}
930 930
 
931 931
 		// Get depreciation options
932 932
 		//---------------------------
933
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
933
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
934 934
 		$options = new AssetDepreciationOptions($this->db);
935 935
 		$result = $options->fetchDeprecationOptions($this->id);
936 936
 		if ($result < 0) {
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 
942 942
 		// Get accountancy codes
943 943
 		//---------------------------
944
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
944
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
945 945
 		$accountancy_codes = new AssetAccountancyCodes($this->db);
946 946
 		$result = $accountancy_codes->fetchAccountancyCodes($this->id);
947 947
 		if ($result < 0) {
@@ -957,20 +957,20 @@  discard block
 block discarded – undo
957 957
 		foreach ($options->deprecation_options as $mode_key => $fields) {
958 958
 			$modes[$mode_key] = $this->db->escape($mode_key);
959 959
 		}
960
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
961
-		$sql .= " WHERE fk_asset = " . (int) $this->id;
962
-		$sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')";
960
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
961
+		$sql .= " WHERE fk_asset = ".(int) $this->id;
962
+		$sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')";
963 963
 
964 964
 		$resql = $this->db->query($sql);
965 965
 		if (!$resql) {
966
-			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
966
+			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
967 967
 			$error++;
968 968
 		}
969 969
 
970 970
 		if (!$error) {
971 971
 			// Get fiscal period
972
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
973
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
972
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
973
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
974 974
 
975 975
 			// @FIXME getCurrentPeriodOfFiscalYear return the first period found. What if there is several ? And what if not closed ? And what if end date not yet defined.
976 976
 			$dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition);
@@ -1007,17 +1007,17 @@  discard block
 block discarded – undo
1007 1007
 				*/
1008 1008
 
1009 1009
 				$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
1010
-				$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
1011
-				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
1012
-				$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
1013
-				$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1010
+				$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
1011
+				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
1012
+				$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
1013
+				$sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'";
1014 1014
 				$sql .= " AND iab.fk_docdet IS NOT NULL";
1015 1015
 				$sql .= " ORDER BY ad.depreciation_date DESC";
1016 1016
 				$sql .= " LIMIT 1";
1017 1017
 
1018 1018
 				$resql = $this->db->query($sql);
1019 1019
 				if (!$resql) {
1020
-					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
1020
+					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror();
1021 1021
 					$error++;
1022 1022
 					break;
1023 1023
 				}
@@ -1029,28 +1029,28 @@  discard block
 block discarded – undo
1029 1029
 				}
1030 1030
 
1031 1031
 				// Set last cumulative depreciation
1032
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1033
-				$sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1034
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
1032
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1033
+				$sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1034
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
1035 1035
 				$resql = $this->db->query($sql);
1036 1036
 				if (!$resql) {
1037
-					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1037
+					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1038 1038
 					$error++;
1039 1039
 					break;
1040 1040
 				}
1041 1041
 
1042 1042
 				// Delete old lines
1043
-				$sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1044
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid";
1045
-				$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
1046
-				$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1043
+				$sql = "DELETE ".MAIN_DB_PREFIX."asset_depreciation FROM ".MAIN_DB_PREFIX."asset_depreciation";
1044
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = ".MAIN_DB_PREFIX."asset_depreciation.rowid";
1045
+				$sql .= " WHERE ".MAIN_DB_PREFIX."asset_depreciation.fk_asset = ".(int) $this->id;
1046
+				$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.depreciation_mode = '".$this->db->escape($mode_key)."'";
1047 1047
 				$sql .= " AND ab.fk_docdet IS NULL";
1048 1048
 				if ($last_depreciation_date !== "") {
1049
-					$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
1049
+					$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.ref != ''";
1050 1050
 				}
1051 1051
 				$resql = $this->db->query($sql);
1052 1052
 				if (!$resql) {
1053
-					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
1053
+					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
1054 1054
 					$error++;
1055 1055
 					break;
1056 1056
 				}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 				//$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
1120 1120
 				$first_period_date = $fiscal_period_start;
1121 1121
 
1122
-				$ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : '');
1122
+				$ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : '');
1123 1123
 
1124 1124
 				// Loop security
1125 1125
 				$idx_loop = 0;
@@ -1141,9 +1141,9 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
 						$period_begin = dol_print_date($fiscal_period_start, $ref_date_format);
1143 1143
 						$period_end = dol_print_date($fiscal_period_end, $ref_date_format);
1144
-						$ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : '');
1144
+						$ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : '');
1145 1145
 						if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) {
1146
-							$ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal');
1146
+							$ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal');
1147 1147
 						}
1148 1148
 
1149 1149
 						$begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start;
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 		// Check parameters
1234 1234
 		$error = 0;
1235 1235
 		if (empty($asset_depreciation_id)) {
1236
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
1236
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
1237 1237
 			$error++;
1238 1238
 		}
1239 1239
 		if ($error) {
@@ -1242,28 +1242,28 @@  discard block
 block discarded – undo
1242 1242
 
1243 1243
 		$this->db->begin();
1244 1244
 
1245
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
1245
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
1246 1246
 		$options = new AssetDepreciationOptions($this->db);
1247 1247
 
1248 1248
 		// Get last depreciation lines save in bookkeeping
1249 1249
 		//-----------------------------------------------------
1250 1250
 		$sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht";
1251
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1252
-		$sql .= " WHERE rowid = " . (int) $asset_depreciation_id;
1251
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation";
1252
+		$sql .= " WHERE rowid = ".(int) $asset_depreciation_id;
1253 1253
 		$resql = $this->db->query($sql);
1254 1254
 		if (!$resql) {
1255
-			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror();
1255
+			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror();
1256 1256
 			$error++;
1257 1257
 		} else {
1258 1258
 			if ($obj = $this->db->fetch_object($resql)) {
1259 1259
 				$mode_key = $obj->depreciation_mode;
1260 1260
 				if (!empty($options->deprecation_options_fields[$mode_key])) {
1261
-					$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1262
-					$sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht;
1263
-					$sql .= " WHERE fk_asset = " . (int) $obj->fk_asset;
1261
+					$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1262
+					$sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht;
1263
+					$sql .= " WHERE fk_asset = ".(int) $obj->fk_asset;
1264 1264
 					$resql = $this->db->query($sql);
1265 1265
 					if (!$resql) {
1266
-						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1266
+						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1267 1267
 						$error++;
1268 1268
 					}
1269 1269
 				}
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 			if ($option == 'label') {
1517 1517
 				$name = $this->label;
1518 1518
 			} elseif ($option == 'with_label') {
1519
-				$name .= ' - ' . $this->label;
1519
+				$name .= ' - '.$this->label;
1520 1520
 			}
1521 1521
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1522 1522
 		}
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1526 1526
 
1527 1527
 		global $action;
1528
-		$hookmanager->initHooks(array($this->element . 'dao'));
1528
+		$hookmanager->initHooks(array($this->element.'dao'));
1529 1529
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1530 1530
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1531 1531
 		if ($reshook > 0) {
@@ -1610,12 +1610,12 @@  discard block
 block discarded – undo
1610 1610
 				$obj = $this->db->fetch_object($result);
1611 1611
 				$this->id = $obj->rowid;
1612 1612
 
1613
-				$this->user_creation_id		= $obj->fk_user_creat;
1614
-				$this->user_modification_id	= $obj->fk_user_modif;
1615
-				$this->user_validation_id	= $obj->fk_user_valid;
1616
-				$this->date_creation		= $this->db->jdate($obj->datec);
1617
-				$this->date_modification	= $this->db->jdate($obj->datem);
1618
-				$this->date_validation		= $this->db->jdate($obj->datev);
1613
+				$this->user_creation_id = $obj->fk_user_creat;
1614
+				$this->user_modification_id = $obj->fk_user_modif;
1615
+				$this->user_validation_id = $obj->fk_user_valid;
1616
+				$this->date_creation = $this->db->jdate($obj->datec);
1617
+				$this->date_modification = $this->db->jdate($obj->datem);
1618
+				$this->date_validation = $this->db->jdate($obj->datev);
1619 1619
 			}
1620 1620
 
1621 1621
 			$this->db->free($result);
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 		if (getDolGlobalString('ASSET_ASSET_ADDON')) {
1657 1657
 			$mybool = false;
1658 1658
 
1659
-			$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
1659
+			$file = getDolGlobalString('ASSET_ASSET_ADDON').".php";
1660 1660
 			$classname = getDolGlobalString('ASSET_ASSET_ADDON');
1661 1661
 
1662 1662
 			// Include file with class
Please login to merge, or discard this patch.
htdocs/asset/tpl/linkedobjectblock.tpl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 $langs->load("assets");
52 52
 
53 53
 $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
54
-'@phan-var-force Asset[] $linkedObjectBlock';  // Repeat because type lost after dol_sort_array)
54
+'@phan-var-force Asset[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array)
55 55
 /** @var Asset[] $linkedObjectBlock */
56 56
 
57 57
 $total = 0;
Please login to merge, or discard this patch.
htdocs/don/admin/donation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 
130 130
 	if (!$error) {
131 131
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
132
-		$action = '';	// To avoid to execute next actions
132
+		$action = ''; // To avoid to execute next actions
133 133
 	} else {
134 134
 		setEventMessages($langs->trans("Error"), null, 'errors');
135
-		$action = '';	// To avoid to execute next actions
135
+		$action = ''; // To avoid to execute next actions
136 136
 	}
137 137
 }
138 138
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 
148 148
 	if (!$error) {
149 149
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
150
-		$action = '';	// To avoid to execute next actions
150
+		$action = ''; // To avoid to execute next actions
151 151
 	} else {
152 152
 		setEventMessages($langs->trans("Error"), null, 'errors');
153
-		$action = '';	// To avoid to execute next actions
153
+		$action = ''; // To avoid to execute next actions
154 154
 	}
155 155
 }
156 156
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	/** @var FormAccounting $formaccounting */
359 359
 	print $formaccounting->select_account(getDolGlobalString('DONATION_ACCOUNTINGACCOUNT'), 'DONATION_ACCOUNTINGACCOUNT', 1, array(), 1, 1);
360 360
 } else {
361
-	print '<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="' . getDolGlobalString('DONATION_ACCOUNTINGACCOUNT').'">';
361
+	print '<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="'.getDolGlobalString('DONATION_ACCOUNTINGACCOUNT').'">';
362 362
 }
363 363
 print '</td><td class="center">';
364 364
 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
 print '<tr class="oddeven"><td colspan="2">';
373 373
 print $langs->trans("FreeTextOnDonations").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
374
-print '<textarea name="DONATION_MESSAGE" class="flat" cols="80">' . getDolGlobalString('DONATION_MESSAGE').'</textarea>';
374
+print '<textarea name="DONATION_MESSAGE" class="flat" cols="80">'.getDolGlobalString('DONATION_MESSAGE').'</textarea>';
375 375
 print '</td><td class="center">';
376 376
 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
377 377
 print "</td></tr>\n";
Please login to merge, or discard this patch.