Completed
Branch develop (edd5dd)
by
unknown
25:09 queued 13s
created
htdocs/public/payment/paymentok.php 1 patch
Spacing   +63 added lines, -63 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;
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 				$paiement->paiementid   = $paymentTypeId;
1050 1050
 				$paiement->num_payment = '';
1051 1051
 				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1052
-				$paiement->ext_payment_id = $TRANSACTIONID;		// TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
1052
+				$paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
1053 1053
 				//$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer->id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];	// TODO LDR It would be better if we could store this. Do we have customer->id and publishable_key ?
1054 1054
 				$paiement->ext_payment_site = $service;
1055 1055
 
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 			$ispostactionok = -1;
1122 1122
 		}
1123 1123
 	} elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) {
1124
-		include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
1124
+		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1125 1125
 		$object = new Commande($db);
1126 1126
 		$result = $object->fetch((int) $tmptag['ORD']);
1127 1127
 		if ($result) {
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1163 1163
 					$db->begin();
1164 1164
 
1165
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1165
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1166 1166
 					$invoice = new Facture($db);
1167 1167
 					$result = $invoice->createFromOrder($object, $user);
1168 1168
 					if ($result > 0) {
@@ -1174,12 +1174,12 @@  discard block
 block discarded – undo
1174 1174
 							// TODO Send a warning email.
1175 1175
 						}
1176 1176
 
1177
-						$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).
1177
+						$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).
1178 1178
 
1179
-						$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.
1179
+						$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.
1180 1180
 
1181 1181
 						// Creation of payment line (warning: if amount has been modified on page, the payment may be partial)
1182
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1182
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1183 1183
 						$paiement = new Paiement($db);
1184 1184
 						$paiement->datepaye = $now;
1185 1185
 						if ($currencyCodeType == $conf->currency) {
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 						}
1194 1194
 						$paiement->paiementid = $paymentTypeId;
1195 1195
 						$paiement->num_payment = '';
1196
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1197
-						$paiement->ext_payment_id = $TRANSACTIONID;		// 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1198
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1196
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1197
+						$paiement->ext_payment_id = $TRANSACTIONID; // 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1198
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1199 1199
 
1200 1200
 						if (!$error) {
1201 1201
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1202 1202
 							if ($paiement_id < 0) {
1203
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1203
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1204 1204
 								$ispostactionok = -1;
1205 1205
 								$error++;
1206 1206
 							} else {
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 								}
1238 1238
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1239 1239
 								if ($result < 0) {
1240
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1240
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1241 1241
 									$ispostactionok = -1;
1242 1242
 									$error++;
1243 1243
 								} else {
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 									$ispostactionok = 1;
1246 1246
 								}
1247 1247
 							} else {
1248
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1248
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1249 1249
 								$ispostactionok = -1;
1250 1250
 								$error++;
1251 1251
 							}
1252 1252
 						}
1253 1253
 					} else {
1254
-						$postactionmessages[] = 'Failed to create invoice form order ' . $tmptag['ORD'] . '.';
1254
+						$postactionmessages[] = 'Failed to create invoice form order '.$tmptag['ORD'].'.';
1255 1255
 						$ispostactionok = -1;
1256 1256
 						$error++;
1257 1257
 					}
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 						$db->rollback();
1263 1263
 					}
1264 1264
 				} else {
1265
-					$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.';
1265
+					$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.';
1266 1266
 					$ispostactionok = -1;
1267 1267
 				}
1268 1268
 			} else {
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 				$ispostactionok = -1;
1271 1271
 			}
1272 1272
 		} else {
1273
-			$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
1273
+			$postactionmessages[] = 'Order paid '.$tmptag['ORD'].' was not found';
1274 1274
 			$ispostactionok = -1;
1275 1275
 		}
1276 1276
 	} elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) {
@@ -1327,9 +1327,9 @@  discard block
 block discarded – undo
1327 1327
 				$paiement->datep = $now;
1328 1328
 				$paiement->paymenttype = $paymentTypeId;
1329 1329
 				$paiement->num_payment = '';
1330
-				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1331
-				$paiement->ext_payment_id = $TRANSACTIONID;		// 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1332
-				$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1330
+				$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1331
+				$paiement->ext_payment_id = $TRANSACTIONID; // 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1332
+				$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1333 1333
 
1334 1334
 				if (!$error) {
1335 1335
 					$paiement_id = $paiement->create($user, 1);
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
1410 1410
 		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1411 1411
 		$object = new Facture($db);
1412
-		$result = $object->fetch((int) $ref);  // @phan-suppress-curren-line PhanPluginSuspiciousParamPosition
1412
+		$result = $object->fetch((int) $ref); // @phan-suppress-curren-line PhanPluginSuspiciousParamPosition
1413 1413
 		if ($result) {
1414 1414
 			$paymentTypeId = 0;
1415 1415
 			if ($paymentmethod == 'paybox') {
@@ -1463,8 +1463,8 @@  discard block
 block discarded – undo
1463 1463
 					$paiement->paiementid   = $paymentTypeId;
1464 1464
 					$paiement->num_payment = '';
1465 1465
 					$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress.' for event registration';
1466
-					$paiement->ext_payment_id = $TRANSACTIONID;		// 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1467
-					$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1466
+					$paiement->ext_payment_id = $TRANSACTIONID; // 'pi_...' for Stripe, ... TODO Use 'pi_...:cus_...@pk_...'
1467
+					$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1468 1468
 
1469 1469
 					if (!$error) {
1470 1470
 						$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 						$db->rollback();
1546 1546
 					}
1547 1547
 
1548
-					if (! $error) {
1548
+					if (!$error) {
1549 1549
 						// Sending mail
1550 1550
 						$thirdparty = new Societe($db);
1551 1551
 						$resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
 							// Get email content from template
1564 1564
 							$arraydefaultmessage = null;
1565 1565
 
1566
-							$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');	// Email to send for Event organization registration
1566
+							$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration
1567 1567
 
1568 1568
 							if (!empty($idoftemplatetouse)) {
1569 1569
 								$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 		require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
1641 1641
 		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1642 1642
 		$object = new Facture($db);
1643
-		$result = $object->fetch((int) $ref);  // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1643
+		$result = $object->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1644 1644
 		if ($result) {
1645 1645
 			$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
1646 1646
 
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 							if ($resultboothupdate < 0) {
1769 1769
 								// Finding the third party by getting the invoice
1770 1770
 								$invoice = new Facture($db);
1771
-								$resultinvoice = $invoice->fetch((int) $ref);  // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1771
+								$resultinvoice = $invoice->fetch((int) $ref); // @phan-suppress-current-line PhanPluginSuspiciousParamPosition
1772 1772
 								if ($resultinvoice < 0) {
1773 1773
 									$postactionmessages[] = 'Could not find the associated invoice.';
1774 1774
 									$ispostactionok = -1;
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 										// Get email content from template
1795 1795
 										$arraydefaultmessage = null;
1796 1796
 
1797
-										$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');	// Email sent after registration for a Booth
1797
+										$idoftemplatetouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth
1798 1798
 
1799 1799
 										if (!empty($idoftemplatetouse)) {
1800 1800
 											$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
 			$ispostactionok = -1;
1851 1851
 		}
1852 1852
 	} elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) {
1853
-		include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
1853
+		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
1854 1854
 		$object = new Contrat($db);
1855 1855
 		$result = $object->fetch((int) $tmptag['CON']);
1856 1856
 		if ($result) {
@@ -1890,14 +1890,14 @@  discard block
 block discarded – undo
1890 1890
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1891 1891
 					$db->begin();
1892 1892
 
1893
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1893
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1894 1894
 					$invoice = new Facture($db);
1895 1895
 					$result = $invoice->createFromContract($object, $user, array((int) $contract_lines));
1896 1896
 					if ($result > 0) {
1897 1897
 						// $object->classifyBilled($user);
1898 1898
 						$invoice->validate($user);
1899 1899
 						// Creation of payment line
1900
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1900
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1901 1901
 						$paiement = new Paiement($db);
1902 1902
 						$paiement->datepaye = $now;
1903 1903
 						if ($currencyCodeType == $conf->currency) {
@@ -1911,14 +1911,14 @@  discard block
 block discarded – undo
1911 1911
 						}
1912 1912
 						$paiement->paiementid = $paymentTypeId;
1913 1913
 						$paiement->num_payment = '';
1914
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1915
-						$paiement->ext_payment_id = $TRANSACTIONID;		// pi_... for Stripe, ...
1916
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1914
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1915
+						$paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ...
1916
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1917 1917
 
1918 1918
 						if (!$error) {
1919 1919
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1920 1920
 							if ($paiement_id < 0) {
1921
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1921
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1922 1922
 								$ispostactionok = -1;
1923 1923
 								$error++;
1924 1924
 							} else {
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 								}
1956 1956
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1957 1957
 								if ($result < 0) {
1958
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1958
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1959 1959
 									$ispostactionok = -1;
1960 1960
 									$error++;
1961 1961
 								} else {
@@ -1963,15 +1963,15 @@  discard block
 block discarded – undo
1963 1963
 									$ispostactionok = 1;
1964 1964
 								}
1965 1965
 							} else {
1966
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1966
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1967 1967
 								$ispostactionok = -1;
1968 1968
 								$error++;
1969 1969
 							}
1970 1970
 						}
1971 1971
 					} else {
1972
-						$msg = 'Failed to create invoice form contract ' . $tmptag['CON'];
1972
+						$msg = 'Failed to create invoice form contract '.$tmptag['CON'];
1973 1973
 						if (!empty($tmptag['COL'])) {
1974
-							$msg .= ' and col '. $tmptag['COL'] .'.';
1974
+							$msg .= ' and col '.$tmptag['COL'].'.';
1975 1975
 						}
1976 1976
 						$postactionmessages[] = $msg;
1977 1977
 						$ispostactionok = -1;
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 						$db->rollback();
1985 1985
 					}
1986 1986
 				} else {
1987
-					$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.';
1987
+					$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.';
1988 1988
 					$ispostactionok = -1;
1989 1989
 				}
1990 1990
 			} else {
@@ -1992,9 +1992,9 @@  discard block
 block discarded – undo
1992 1992
 				$ispostactionok = -1;
1993 1993
 			}
1994 1994
 		} else {
1995
-			$msg = 'Contract paid ' . $tmptag['CON'] . ' was not found';
1995
+			$msg = 'Contract paid '.$tmptag['CON'].' was not found';
1996 1996
 			if (!empty($tmptag['COL'])) {
1997
-				$msg .= ' for col '.$tmptag['COL'] .'.';
1997
+				$msg .= ' for col '.$tmptag['COL'].'.';
1998 1998
 			}
1999 1999
 			$postactionmessages[] = $msg;
2000 2000
 			$ispostactionok = -1;
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 	// Set by newpayment.php
2014 2014
 	$currencyCodeType   = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType'];
2015 2015
 	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"];
2016
-	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType'];	// Seems used by paypal only
2016
+	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only
2017 2017
 
2018 2018
 	if (is_object($object) && method_exists($object, 'call_trigger')) {
2019 2019
 		'@phan-var-force CommonObject $object';
@@ -2263,11 +2263,11 @@  discard block
 block discarded – undo
2263 2263
 	if ($ispaymentok) {
2264 2264
 		// Redirect to a success page
2265 2265
 		$randomseckey = getRandomPassword(true, null, 20);
2266
-		$_SESSION['paymentoksessioncode'] = $randomseckey;		// key between paymentok.php to another page like a paymentok of the website.
2266
+		$_SESSION['paymentoksessioncode'] = $randomseckey; // key between paymentok.php to another page like a paymentok of the website.
2267 2267
 
2268 2268
 		// Paymentok page must be created for the specific website
2269 2269
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2270
-			$ext_urlok = $ws_virtuelhost . '/paymentok.php?paymentoksessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2270
+			$ext_urlok = $ws_virtuelhost.'/paymentok.php?paymentoksessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2271 2271
 		} else {
2272 2272
 			$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?paymentoksessioncode='.urlencode($randomseckey).'&website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
2273 2273
 		}
@@ -2278,11 +2278,11 @@  discard block
 block discarded – undo
2278 2278
 	} else {
2279 2279
 		// Redirect to an error page
2280 2280
 		$randomseckey = getRandomPassword(true, null, 20);
2281
-		$_SESSION['paymentkosessioncode'] = $randomseckey;		// key between paymentok.php to another page like a paymentko of the website.
2281
+		$_SESSION['paymentkosessioncode'] = $randomseckey; // key between paymentok.php to another page like a paymentko of the website.
2282 2282
 
2283 2283
 		// Paymentko page must be created for the specific website
2284 2284
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2285
-			$ext_urlko = $ws_virtuelhost . '/paymentko.php?paymentkosessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2285
+			$ext_urlko = $ws_virtuelhost.'/paymentko.php?paymentkosessioncode='.urlencode($randomseckey).'&fulltag='.$FULLTAG;
2286 2286
 		} else {
2287 2287
 			$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?paymentkosessioncode='.urlencode($randomseckey).'&website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
2288 2288
 		}
Please login to merge, or discard this patch.
htdocs/public/stripe/ipn.php 1 patch
Spacing   +31 added lines, -31 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');
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			$typefrom = 'PRE';
268 268
 			$typeto = 'VIR';
269 269
 
270
-			$numChqOrOpe = '';	// TODO Store the po ref from $event->data
270
+			$numChqOrOpe = ''; // TODO Store the po ref from $event->data
271 271
 
272 272
 			$db->begin();
273 273
 
@@ -362,19 +362,19 @@  discard block
 block discarded – undo
362 362
 	dol_syslog("object = ".var_export($event->data, true));
363 363
 	dol_syslog("object = ".var_export($event->data, true), LOG_DEBUG, 0, '_payment');
364 364
 
365
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
365
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
366 366
 	global $stripearrayofkeysbyenv;
367 367
 	$error = 0;
368 368
 	$object = $event->data->object;
369
-	$TRANSACTIONID = $object->id;	// Example 'pi_123456789...'
369
+	$TRANSACTIONID = $object->id; // Example 'pi_123456789...'
370 370
 	$ipaddress = $object->metadata->ipaddress;
371 371
 	$now = dol_now();
372 372
 	$currencyCodeType = strtoupper($object->currency);
373 373
 	$paymentmethodstripeid = $object->payment_method;
374 374
 	$customer_id = $object->customer;
375 375
 	$invoice_id = "";
376
-	$paymentTypeCode = "";				// payment type according to Stripe
377
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
376
+	$paymentTypeCode = ""; // payment type according to Stripe
377
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
378 378
 	$payment_amount = 0;
379 379
 	$payment_amountInDolibarr = 0;
380 380
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		$s = new \Stripe\StripeClient($stripeacc);
448 448
 
449 449
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
450
-		$paymentTypeCode =  $paymentmethodstripe->type;
450
+		$paymentTypeCode = $paymentmethodstripe->type;
451 451
 		if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") {
452 452
 			$paymentTypeCode = "PRE";
453 453
 		} elseif ($paymentTypeCode == "card") {
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 			$paiement->datepaye = $now;
477 477
 			$paiement->date = $now;
478 478
 			if ($currencyCodeType == $conf->currency) {
479
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
479
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
480 480
 			} else {
481
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
481
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
482 482
 
483 483
 				$postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')';
484 484
 				$ispostactionok = -1;
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 
502 502
 			$paiement->num_payment = '';
503 503
 			$paiement->note_public = '';
504
-			$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;
505
-			$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.
504
+			$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;
505
+			$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.
506 506
 			$paiement->ext_payment_site = $service;
507 507
 
508 508
 			$ispaymentdone = 0;
@@ -521,23 +521,23 @@  discard block
 block discarded – undo
521 521
 			$db->begin();
522 522
 
523 523
 			if (!$error && !$ispaymentdone) {
524
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.');
525
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
524
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.');
525
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
526 526
 
527 527
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
528 528
 				$paiement_id = $paiement->create($user, 1);
529 529
 				if ($paiement_id < 0) {
530
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
530
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
531 531
 					$ispostactionok = -1;
532 532
 					$error++;
533 533
 
534
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
535
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
534
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
535
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
536 536
 				} else {
537 537
 					$postactionmessages[] = 'Payment created';
538 538
 
539
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
540
-					dol_syslog("The payment has been created for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
539
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
540
+					dol_syslog("The payment has been created for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
541 541
 				}
542 542
 			}
543 543
 
@@ -569,14 +569,14 @@  discard block
 block discarded – undo
569 569
 						$label = '(CustomerInvoicePayment)';
570 570
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
571 571
 						if ($result < 0) {
572
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
572
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
573 573
 							$ispostactionok = -1;
574 574
 							$error++;
575 575
 						} else {
576 576
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
577 577
 						}
578 578
 					} else {
579
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
579
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
580 580
 						$ispostactionok = -1;
581 581
 						$error++;
582 582
 					}
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 			$error++;
749 749
 		}
750 750
 
751
-		if (! $error) {
751
+		if (!$error) {
752 752
 			$db->commit();
753 753
 		} else {
754 754
 			$db->rollback();
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 		$companypaymentmode->card_type       = $event->data->object->card->branding;
783 783
 
784 784
 		$companypaymentmode->owner_name      = $event->data->object->billing_details->name;
785
-		$companypaymentmode->proprio         = $companypaymentmode->owner_name;			// We may still need this formodulebuilder because name of field is "proprio"
785
+		$companypaymentmode->proprio         = $companypaymentmode->owner_name; // We may still need this formodulebuilder because name of field is "proprio"
786 786
 
787 787
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
788 788
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		$companypaymentmode->label           = '';
825 825
 		$companypaymentmode->number          = $db->escape($event->data->object->id);
826 826
 		$companypaymentmode->last_four       = $db->escape($event->data->object->card->last4);
827
-		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name);	// deprecated
827
+		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name); // deprecated
828 828
 		$companypaymentmode->owner_name      = $db->escape($event->data->object->billing_details->name);
829 829
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
830 830
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	$paymentmethodstripeid = $object->payment_method;
881 881
 	$customer_id = $object->customer;
882 882
 	$reason = $object->reason;
883
-	$amountdisputestripe = $object->amoutndispute;	// In stripe format
884
-	$amountdispute = $amountdisputestripe;			// In real currency format
883
+	$amountdisputestripe = $object->amoutndispute; // In stripe format
884
+	$amountdispute = $amountdisputestripe; // In real currency format
885 885
 
886 886
 	$invoice_id = 0;
887
-	$paymentTypeCode = "";			// payment type according to Stripe
888
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
887
+	$paymentTypeCode = ""; // payment type according to Stripe
888
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
889 889
 	$payment_amount = 0;
890 890
 	$payment_amountInDolibarr = 0;
891 891
 
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 	$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
968 968
 	*/
969 969
 	$paiement->paiementid   = dol_getIdFromCode($db, 'PRE', 'c_paiement', 'code', 'id', 1);
970
-	$paiement->num_payment  = $object->id;	// A string like 'du_...'
970
+	$paiement->num_payment  = $object->id; // A string like 'du_...'
971 971
 	$paiement->note_public = 'Fund withdrawn by bank. Reason: '.$reason;
972 972
 	$paiement->note_private = '';
973 973
 	$paiement->fk_account   = $accountfrom->id;
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 		$error++;
984 984
 	}
985 985
 
986
-	if (! $error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
986
+	if (!$error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
987 987
 		// Switch back the invoice to status validated
988 988
 		$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED);
989 989
 		if ($result < 0) {
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 		}
993 993
 	}
994 994
 
995
-	if (! $error) {
995
+	if (!$error) {
996 996
 		$paiement_id = $paiement->create($user, 0, $tmpinvoice->thirdparty); // This include regenerating documents
997 997
 		if ($paiement_id < 0) {
998 998
 			$errormsg = $paiement->error.implode(', ', $paiement->errors);
Please login to merge, or discard this patch.