Completed
Branch develop (e09c2c)
by
unknown
23:42
created
htdocs/public/payment/paymentok.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 $paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
156 156
 $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
157 157
 if (getDolGlobalString($paramcreditorlong)) {
158
-	$creditor = getDolGlobalString($paramcreditorlong);	// use label long of the seller to show
158
+	$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
159 159
 } elseif (getDolGlobalString($paramcreditor)) {
160
-	$creditor = getDolGlobalString($paramcreditor);		// use label short of the seller to show
160
+	$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
161 161
 }
162 162
 
163 163
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 $head = '';
215 215
 if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
216
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
216
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
217 217
 }
218 218
 
219 219
 $conf->dol_hide_topmenu = 1;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	}
274 274
 	if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) {
275 275
 		print '<div class="backimagepublicpayment">';
276
-		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' . getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
276
+		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="'.getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
277 277
 		print '</div>';
278 278
 	}
279 279
 
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
 		// Get on url call
289 289
 		$onlinetoken        = $PAYPALTOKEN;
290 290
 		$fulltag            = $FULLTAG;
291
-		$payerID 			= !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
291
+		$payerID = !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
292 292
 		// Set by newpayment.php
293 293
 		$currencyCodeType   = $_SESSION['currencyCodeType'];
294 294
 		$FinalPaymentAmt    = $_SESSION["FinalPaymentAmt"];
295
-		$paymentType        = $_SESSION['PaymentType'];			// Value can be 'Mark', 'Sole', 'Sale' for example
295
+		$paymentType        = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example
296 296
 		// From env
297 297
 		$ipaddress          = $_SESSION['ipaddress'];
298 298
 
@@ -394,10 +394,10 @@  discard block
 block discarded – undo
394 394
 	$ipaddress = $_SESSION['ipaddress'];
395 395
 }
396 396
 if (empty($TRANSACTIONID)) {
397
-	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' :$_SESSION['TRANSACTIONID'];	// pi_... or ch_...
397
+	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_...
398 398
 	if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) {
399 399
 		// For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2
400
-		$TRANSACTIONID   = GETPOST('payment_intent', 'alphanohtml');
400
+		$TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml');
401 401
 	}
402 402
 }
403 403
 if (empty($FinalPaymentAmt)) {
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 				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)
500 500
 					if ($object->status == $object::STATUS_DRAFT) {		// If the member is not yet validated, we check that the amount is the same as expected.
501 501
 						$typeid = $object->typeid;
502
-						$amountbytype = $adht->amountByType(1);		// Load the array of amount per type
502
+						$amountbytype = $adht->amountByType(1); // Load the array of amount per type
503 503
 
504 504
 						// Set amount for the subscription:
505 505
 						// - First check the amount of the member type.
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 				if (getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
530 530
 					if ($FinalPaymentAmt < getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
531 531
 						$error++;
532
-						$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 ?';
532
+						$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 ?';
533 533
 						$postactionmessages[] = $errmsg;
534 534
 						$ispostactionok = -1;
535 535
 						dol_syslog("Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0, '_payment');
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 					dol_syslog("Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0, '_payment');
546 546
 				}
547 547
 
548
-				if (! $error) {
548
+				if (!$error) {
549 549
 					// We validate the member (no effect if it is already validated)
550 550
 					$result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible
551 551
 					if ($result < 0 || empty($object->datevalid)) {
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 						$thirdparty = new Societe($db);
713 713
 						$thirdparty->fetch($thirdparty_id);
714 714
 
715
-						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';	// This also set $stripearrayofkeysbyenv
715
+						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv
716 716
 						$stripe = new Stripe($db);
717 717
 						//$stripeacc = $stripe->getStripeAccount($service);		Already defined previously
718 718
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 								if (preg_match('/^pi_/', $TRANSACTIONID)) {
729 729
 									// This may throw an error if not found.
730
-									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);	// payment_intent (pi_...)
730
+									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...)
731 731
 								} else {
732 732
 									// This throw an error if not found
733 733
 									$chpi = \Stripe\Charge::retrieve($TRANSACTIONID); // old method, contains the charge id (ch_...)
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 				// Create external user
787 787
 				if (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN')) {
788 788
 					$nuser = new User($db);
789
-					$tmpuser = dol_clone($object, 0);		// $object is type Adherent
789
+					$tmpuser = dol_clone($object, 0); // $object is type Adherent
790 790
 
791 791
 					// Check if a user login already exists for this member or not
792 792
 					$found = 0;
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 				$paiement->paiementid   = $paymentTypeId;
952 952
 				$paiement->num_payment = '';
953 953
 				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
954
-				$paiement->ext_payment_id = $TRANSACTIONID;		// TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
954
+				$paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
955 955
 				//$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 ?
956 956
 				$paiement->ext_payment_site = $service;
957 957
 
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 			$ispostactionok = -1;
1024 1024
 		}
1025 1025
 	} elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) {
1026
-		include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
1026
+		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1027 1027
 		$object = new Commande($db);
1028 1028
 		$result = $object->fetch((int) $tmptag['ORD']);
1029 1029
 		if ($result) {
@@ -1062,14 +1062,14 @@  discard block
 block discarded – undo
1062 1062
 			// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
1063 1063
 			if (isModEnabled('invoice')) {
1064 1064
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1065
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1065
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1066 1066
 					$invoice = new Facture($db);
1067 1067
 					$result = $invoice->createFromOrder($object, $user);
1068 1068
 					if ($result > 0) {
1069 1069
 						$object->classifyBilled($user);
1070 1070
 						$invoice->validate($user);
1071 1071
 						// Creation of payment line
1072
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1072
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1073 1073
 						$paiement = new Paiement($db);
1074 1074
 						$paiement->datepaye = $now;
1075 1075
 						if ($currencyCodeType == $conf->currency) {
@@ -1083,14 +1083,14 @@  discard block
 block discarded – undo
1083 1083
 						}
1084 1084
 						$paiement->paiementid = $paymentTypeId;
1085 1085
 						$paiement->num_payment = '';
1086
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1087
-						$paiement->ext_payment_id = $TRANSACTIONID;		// pi_... for Stripe, ...
1088
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1086
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1087
+						$paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ...
1088
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1089 1089
 
1090 1090
 						if (!$error) {
1091 1091
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1092 1092
 							if ($paiement_id < 0) {
1093
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1093
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1094 1094
 								$ispostactionok = -1;
1095 1095
 								$error++;
1096 1096
 							} else {
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 								}
1128 1128
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1129 1129
 								if ($result < 0) {
1130
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1130
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1131 1131
 									$ispostactionok = -1;
1132 1132
 									$error++;
1133 1133
 								} else {
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 									$ispostactionok = 1;
1136 1136
 								}
1137 1137
 							} else {
1138
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1138
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1139 1139
 								$ispostactionok = -1;
1140 1140
 								$error++;
1141 1141
 							}
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
 							$db->rollback();
1148 1148
 						}
1149 1149
 					} else {
1150
-						$postactionmessages[] = 'Failed to create invoice form order ' . $tmptag['ORD'] . '.';
1150
+						$postactionmessages[] = 'Failed to create invoice form order '.$tmptag['ORD'].'.';
1151 1151
 						$ispostactionok = -1;
1152 1152
 					}
1153 1153
 				} else {
1154
-					$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.';
1154
+					$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.';
1155 1155
 					$ispostactionok = -1;
1156 1156
 				}
1157 1157
 			} else {
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 				$ispostactionok = -1;
1160 1160
 			}
1161 1161
 		} else {
1162
-			$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
1162
+			$postactionmessages[] = 'Order paid '.$tmptag['ORD'].' was not found';
1163 1163
 			$ispostactionok = -1;
1164 1164
 		}
1165 1165
 	} elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) {
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 				$paiement->datep = $now;
1217 1217
 				$paiement->paymenttype = $paymentTypeId;
1218 1218
 				$paiement->num_payment = '';
1219
-				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1219
+				$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1220 1220
 				$paiement->ext_payment_id = $TRANSACTIONID;
1221 1221
 				$paiement->ext_payment_site = $service;
1222 1222
 
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 						$db->rollback();
1434 1434
 					}
1435 1435
 
1436
-					if (! $error) {
1436
+					if (!$error) {
1437 1437
 						// Sending mail
1438 1438
 						$thirdparty = new Societe($db);
1439 1439
 						$resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 							// Get email content from template
1452 1452
 							$arraydefaultmessage = null;
1453 1453
 
1454
-							$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');	// Email to send for Event organization registration
1454
+							$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration
1455 1455
 
1456 1456
 							if (!empty($idoftemplatetouse)) {
1457 1457
 								$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1653,18 +1653,18 @@  discard block
 block discarded – undo
1653 1653
 						} else {
1654 1654
 							$booth->status = ConferenceOrBooth::STATUS_SUGGESTED;
1655 1655
 							$resultboothupdate = $booth->update($user);
1656
-							if ($resultboothupdate<0) {
1656
+							if ($resultboothupdate < 0) {
1657 1657
 								// Finding the thirdparty by getting the invoice
1658 1658
 								$invoice = new Facture($db);
1659 1659
 								$resultinvoice = $invoice->fetch($ref);
1660
-								if ($resultinvoice<0) {
1660
+								if ($resultinvoice < 0) {
1661 1661
 									$postactionmessages[] = 'Could not find the associated invoice.';
1662 1662
 									$ispostactionok = -1;
1663 1663
 									$error++;
1664 1664
 								} else {
1665 1665
 									$thirdparty = new Societe($db);
1666 1666
 									$resultthirdparty = $thirdparty->fetch($invoice->socid);
1667
-									if ($resultthirdparty<0) {
1667
+									if ($resultthirdparty < 0) {
1668 1668
 										$error++;
1669 1669
 										setEventMessages(null, $thirdparty->errors, "errors");
1670 1670
 									} else {
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
 										// Get email content from template
1681 1681
 										$arraydefaultmessage = null;
1682 1682
 
1683
-										$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');	// Email sent after registration for a Booth
1683
+										$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth
1684 1684
 
1685 1685
 										if (!empty($idoftemplatetouse)) {
1686 1686
 											$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 			$ispostactionok = -1;
1737 1737
 		}
1738 1738
 	} elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) {
1739
-		include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
1739
+		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
1740 1740
 		$object = new Contrat($db);
1741 1741
 		$result = $object->fetch((int) $tmptag['CON']);
1742 1742
 		if ($result) {
@@ -1774,14 +1774,14 @@  discard block
 block discarded – undo
1774 1774
 			// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
1775 1775
 			if (isModEnabled('invoice')) {
1776 1776
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1777
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1777
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1778 1778
 					$invoice = new Facture($db);
1779 1779
 					$result = $invoice->createFromContract($object, $user, array((int) $contract_lines));
1780 1780
 					if ($result > 0) {
1781 1781
 						// $object->classifyBilled($user);
1782 1782
 						$invoice->validate($user);
1783 1783
 						// Creation of payment line
1784
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1784
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1785 1785
 						$paiement = new Paiement($db);
1786 1786
 						$paiement->datepaye = $now;
1787 1787
 						if ($currencyCodeType == $conf->currency) {
@@ -1795,14 +1795,14 @@  discard block
 block discarded – undo
1795 1795
 						}
1796 1796
 						$paiement->paiementid = $paymentTypeId;
1797 1797
 						$paiement->num_payment = '';
1798
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1799
-						$paiement->ext_payment_id = $TRANSACTIONID;		// pi_... for Stripe, ...
1800
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1798
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1799
+						$paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ...
1800
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1801 1801
 
1802 1802
 						if (!$error) {
1803 1803
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1804 1804
 							if ($paiement_id < 0) {
1805
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1805
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1806 1806
 								$ispostactionok = -1;
1807 1807
 								$error++;
1808 1808
 							} else {
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
 								}
1840 1840
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1841 1841
 								if ($result < 0) {
1842
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1842
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1843 1843
 									$ispostactionok = -1;
1844 1844
 									$error++;
1845 1845
 								} else {
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
 									$ispostactionok = 1;
1848 1848
 								}
1849 1849
 							} else {
1850
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1850
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1851 1851
 								$ispostactionok = -1;
1852 1852
 								$error++;
1853 1853
 							}
@@ -1859,15 +1859,15 @@  discard block
 block discarded – undo
1859 1859
 							$db->rollback();
1860 1860
 						}
1861 1861
 					} else {
1862
-						$msg = 'Failed to create invoice form contract ' . $tmptag['CON'];
1862
+						$msg = 'Failed to create invoice form contract '.$tmptag['CON'];
1863 1863
 						if (!empty($tmptag['COL'])) {
1864
-							$msg .= ' and col '. $tmptag['COL'] .'.';
1864
+							$msg .= ' and col '.$tmptag['COL'].'.';
1865 1865
 						}
1866 1866
 						$postactionmessages[] = $msg;
1867 1867
 						$ispostactionok = -1;
1868 1868
 					}
1869 1869
 				} else {
1870
-					$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.';
1870
+					$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.';
1871 1871
 					$ispostactionok = -1;
1872 1872
 				}
1873 1873
 			} else {
@@ -1875,9 +1875,9 @@  discard block
 block discarded – undo
1875 1875
 				$ispostactionok = -1;
1876 1876
 			}
1877 1877
 		} else {
1878
-			$msg = 'Contract paid ' . $tmptag['CON'] . ' was not found';
1878
+			$msg = 'Contract paid '.$tmptag['CON'].' was not found';
1879 1879
 			if (!empty($tmptag['COL'])) {
1880
-				$msg .= ' for col '.$tmptag['COL'] .'.';
1880
+				$msg .= ' for col '.$tmptag['COL'].'.';
1881 1881
 			}
1882 1882
 			$postactionmessages[] = $msg;
1883 1883
 			$ispostactionok = -1;
@@ -1893,8 +1893,8 @@  discard block
 block discarded – undo
1893 1893
 	$payerID            = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID;
1894 1894
 	// Set by newpayment.php
1895 1895
 	$currencyCodeType   = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType'];
1896
-	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '': $_SESSION["FinalPaymentAmt"];
1897
-	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType'];	// Seems used by paypal only
1896
+	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"];
1897
+	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only
1898 1898
 
1899 1899
 	if (is_object($object) && method_exists($object, 'call_trigger')) {
1900 1900
 		// Call trigger
@@ -2136,16 +2136,16 @@  discard block
 block discarded – undo
2136 2136
 		// Redirect to a success page
2137 2137
 		// Paymentok page must be created for the specific website
2138 2138
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2139
-			$ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG;
2139
+			$ext_urlok = $ws_virtuelhost.'/paymentok.php?fulltag='.$FULLTAG;
2140 2140
 		} else {
2141 2141
 			$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
2142 2142
 		}
2143
-		print "<!DOCTYPE html><html><head></head><script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script></html>";
2143
+		print "<!DOCTYPE html><html><head></head><script>window.top.location.href = '".dol_escape_js($ext_urlok)."';</script></html>";
2144 2144
 	} else {
2145 2145
 		// Redirect to an error page
2146 2146
 		// Paymentko page must be created for the specific website
2147 2147
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2148
-			$ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG;
2148
+			$ext_urlko = $ws_virtuelhost.'/paymentko.php?fulltag='.$FULLTAG;
2149 2149
 		} else {
2150 2150
 			$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
2151 2151
 		}
Please login to merge, or discard this patch.
htdocs/admin/ticket.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 // Parameters
55 55
 $value = GETPOST('value', 'alpha');
56 56
 $action = GETPOST('action', 'aZ09');
57
-$modulepart = GETPOST('modulepart', 'aZ09');	// Used by actions_setmoduleoptions.inc.php
57
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
58 58
 
59 59
 $label = GETPOST('label', 'alpha');
60 60
 $scandir = GETPOST('scan_dir', 'alpha');
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 								print(empty($module->name) ? $name : $module->name);
457 457
 								print "</td><td>\n";
458 458
 								if (method_exists($module, 'info')) {
459
-									print $module->info($langs);  // @phan-suppress-current-line PhanUndeclaredMethod
459
+									print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
460 460
 								} else {
461 461
 									print $module->description;
462 462
 								}
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 // Email to send notifications
658 658
 print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
659 659
 print '<td class="left">';
660
-print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_FROM" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
660
+print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_FROM" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'"></td>';
661 661
 print '<td class="center">';
662 662
 print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
663 663
 print '</td>';
Please login to merge, or discard this patch.
htdocs/accountancy/journal/purchasesjournal.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
116 116
 $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
117 117
 
118
-$pastmonth = null;  // Initialise, could be unset
119
-$pastmonthyear = null;  // Initialise, could be unset
118
+$pastmonth = null; // Initialise, could be unset
119
+$pastmonthyear = null; // Initialise, could be unset
120 120
 
121 121
 if (empty($date_startmonth)) {
122 122
 	// Period by default on transfer
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
167 167
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
168 168
 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
169
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
169
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
170 170
 }
171 171
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
172 172
 $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
173 173
 $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
174 174
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
175 175
 if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
176
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
176
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity);
177 177
 }
178 178
 $parameters = array();
179 179
 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 $rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
227 227
 $rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
228 228
 $noTaxDispatchingKeepWithLines = getDolGlobalInt('ACCOUNTING_PURCHASES_DO_NOT_DISPATCH_TAXES'); //If enabled, Tax will NOT get split off from the base entry and credited to a separate tax account (good for non-VAT countries like USA)
229
-$country_code_in_EEC = getCountriesInEEC();		// This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
229
+$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
230 230
 
231 231
 $result = $db->query($sql);
232 232
 if ($result) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			}
250 250
 		}
251 251
 
252
-		$tax_id = $obj->tva_tx . ($obj->vat_src_code ? ' (' . $obj->vat_src_code . ')' : '');
252
+		$tax_id = $obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '');
253 253
 		if (array_key_exists($tax_id, $vatdata_cache)) {
254 254
 			$vatdata = $vatdata_cache[$tax_id];
255 255
 		} else {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
 		// VAT Reverse charge
300 300
 		if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
301
-			$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
301
+			$rcvatdata = getTaxesFromId($obj->product_buy_vat.($obj->product_buy_default_vat_code ? ' ('.$obj->product_buy_default_vat_code.')' : ''), $mysoc, $mysoc, 0);
302 302
 			$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
303 303
 			$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
304 304
 			$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
307 307
 			$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
308 308
 			if (price2num($obj->product_buy_vat) || !empty($obj->product_buy_default_vat_code)) {
309
-				$vat_key = vatrate($obj->product_buy_vat) . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : '');
309
+				$vat_key = vatrate($obj->product_buy_vat).($obj->product_buy_default_vat_code ? ' ('.$obj->product_buy_default_vat_code.')' : '');
310 310
 				$val_value = $vat_key;
311 311
 				$def_tva[$obj->rowid][$rcc_compta_tva][$vat_key] = $val_value;
312 312
 				$def_tva[$obj->rowid][$rcd_compta_tva][$vat_key] = $val_value;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     	fk_facture_fourn,
408 408
     	COUNT(fd.rowid) as nb
409 409
 	FROM
410
-    	" . MAIN_DB_PREFIX . "facture_fourn_det as fd
410
+    	" . MAIN_DB_PREFIX."facture_fourn_det as fd
411 411
 	WHERE
412 412
     	fd.product_type <= 2
413 413
     	AND fd.fk_code_ventilation <= 0
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		$totalcredit = 0;
447 447
 		$totaldebit = 0;
448 448
 
449
-		$db->begin();		// We accept transaction into loop, so if we hang, we can continue transfer from the last error
449
+		$db->begin(); // We accept transaction into loop, so if we hang, we can continue transfer from the last error
450 450
 
451 451
 		$companystatic->id = $tabcompany[$key]['id'];
452 452
 		$companystatic->name = $tabcompany[$key]['name'];
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 					}
535 535
 				} else {
536 536
 					if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
537
-						require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
537
+						require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
538 538
 						$lettering_static = new Lettering($db);
539 539
 
540 540
 						$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 
654 654
 				foreach ($arrayofvat[$key] as $k => $mt) {
655 655
 					if ($mt) {
656
-						$accountingaccount->fetch(0, $k, true);		// TODO Use a cache for label
656
+						$accountingaccount->fetch(0, $k, true); // TODO Use a cache for label
657 657
 						$label_account = $accountingaccount->label;
658 658
 
659 659
 						$bookkeeping = new BookKeeping($db);
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	}
1018 1018
 
1019 1019
 	// Button to write into Ledger
1020
-	$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']);
1020
+	$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['', '-1']);
1021 1021
 	if ($acctSupplierNotConfigured) {
1022 1022
 		print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
1023 1023
 		$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 				print $accountoshow;
1174 1174
 			}
1175 1175
 			print '</td>';
1176
-			print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("SubledgerAccount")) . "</td>";
1176
+			print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("SubledgerAccount"))."</td>";
1177 1177
 			print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1178 1178
 			print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1179 1179
 			print "</tr>";
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 					print length_accounta($tabcompany[$key]['code_compta_fournisseur']);
1212 1212
 				}
1213 1213
 			} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
1214
-				print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
1214
+				print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
1215 1215
 			}
1216 1216
 			print '</td>';
1217 1217
 			$companystatic->id = $tabcompany[$key]['id'];
1218 1218
 			$companystatic->name = $tabcompany[$key]['name'];
1219
-			print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $accountingaccount->label) . "</td>";
1219
+			print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $accountingaccount->label)."</td>";
1220 1220
 			print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1221 1221
 			print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1222 1222
 			print "</tr>";
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 					$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : implode(', ', $def_tva[$key][$k]));
1280 1280
 					$labelvatrate = $langs->trans("Taxes").' '.$tmpvatrate.' %';
1281 1281
 					$labelvatrate .= ($numtax ? ' - Localtax '.$numtax : '');
1282
-					print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate) . "</td>";
1282
+					print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate)."</td>";
1283 1283
 					print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1284 1284
 					print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1285 1285
 					print "</tr>";
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 					// Subledger account
1310 1310
 					print "<td>";
1311 1311
 					print '</td>';
1312
-					print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("VAT")." NPR (counterpart)") . "</td>";
1312
+					print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("VAT")." NPR (counterpart)")."</td>";
1313 1313
 					print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1314 1314
 					print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1315 1315
 					print "</tr>";
Please login to merge, or discard this patch.
htdocs/societe/class/societe.class.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 			$sql .= ", '".$this->db->escape($this->ip)."'";
1081 1081
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1082 1082
 				$sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1');
1083
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1084
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1083
+				$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1084
+				$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1085 1085
 			}
1086 1086
 			$sql .= ")";
1087 1087
 
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 				}
1135 1135
 
1136 1136
 				if ($ret >= 0) {
1137
-					if (! $notrigger) {
1137
+					if (!$notrigger) {
1138 1138
 						// Call trigger
1139 1139
 						$result = $this->call_trigger('COMPANY_CREATE', $user);
1140 1140
 						if ($result < 0) {
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1383 1383
 							$langs->loadLangs(array("errors", 'compta'));
1384 1384
 							$error++;
1385
-							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1385
+							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1386 1386
 						}
1387 1387
 					}
1388 1388
 
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1391 1391
 						$langs->loadLangs(array("errors", 'compta'));
1392 1392
 						$error++;
1393
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1393
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1394 1394
 					}
1395 1395
 				} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
1396 1396
 					// Check for unicity
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1399 1399
 							$langs->loadLangs(array("errors", 'compta'));
1400 1400
 							$error++;
1401
-							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1401
+							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1402 1402
 						}
1403 1403
 					}
1404 1404
 
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1407 1407
 						$langs->loadLangs(array("errors", 'compta'));
1408 1408
 						$error++;
1409
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1409
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1410 1410
 					}
1411 1411
 				}
1412 1412
 			}
@@ -1451,17 +1451,17 @@  discard block
 block discarded – undo
1451 1451
 		$now = dol_now();
1452 1452
 
1453 1453
 		// Clean parameters
1454
-		$this->id 			= $id;
1455
-		$this->entity 		= ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1454
+		$this->id = $id;
1455
+		$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1456 1456
 		$this->name 		= $this->name ? trim($this->name) : trim((string) $this->nom);
1457 1457
 		$this->nom 			= $this->name; // For backward compatibility
1458
-		$this->name_alias 	= trim((string) $this->name_alias);
1458
+		$this->name_alias = trim((string) $this->name_alias);
1459 1459
 		$this->ref_ext		= (empty($this->ref_ext) ? '' : trim($this->ref_ext));
1460 1460
 		$this->address		= trim((string) $this->address);
1461 1461
 		$this->zip 			= trim((string) $this->zip);
1462 1462
 		$this->town 		= trim((string) $this->town);
1463
-		$this->state_id 	= (is_numeric($this->state_id)) ? (int) $this->state_id : 0;
1464
-		$this->country_id 	= ($this->country_id > 0) ? $this->country_id : 0;
1463
+		$this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0;
1464
+		$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
1465 1465
 		$this->phone		= trim((string) $this->phone);
1466 1466
 		$this->phone		= preg_replace("/\s/", "", $this->phone);
1467 1467
 		$this->phone		= preg_replace("/\./", "", $this->phone);
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 		$this->fax			= trim((string) $this->fax);
1472 1472
 		$this->fax			= preg_replace("/\s/", "", $this->fax);
1473 1473
 		$this->fax			= preg_replace("/\./", "", $this->fax);
1474
-		$this->email		= trim((string) $this->email);
1474
+		$this->email = trim((string) $this->email);
1475 1475
 		$this->url			= $this->url ? clean_url($this->url, 0) : '';
1476 1476
 		$this->note_private = (empty($this->note_private) ? '' : trim($this->note_private));
1477 1477
 		$this->note_public  = (empty($this->note_public) ? '' : trim($this->note_public));
@@ -1481,14 +1481,14 @@  discard block
 block discarded – undo
1481 1481
 		$this->idprof4		= trim((string) $this->idprof4);
1482 1482
 		$this->idprof5		= (!empty($this->idprof5) ? trim($this->idprof5) : '');
1483 1483
 		$this->idprof6		= (!empty($this->idprof6) ? trim($this->idprof6) : '');
1484
-		$this->prefix_comm 	= trim((string) $this->prefix_comm);
1484
+		$this->prefix_comm = trim((string) $this->prefix_comm);
1485 1485
 		$this->outstanding_limit = price2num($this->outstanding_limit);
1486 1486
 		$this->order_min_amount = price2num($this->order_min_amount);
1487 1487
 		$this->supplier_order_min_amount = price2num($this->supplier_order_min_amount);
1488 1488
 
1489 1489
 		$this->tva_assuj			= (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0;
1490 1490
 		$this->tva_intra			= dol_sanitizeFileName($this->tva_intra, '');
1491
-		$this->vat_reverse_charge	= empty($this->vat_reverse_charge) ? 0 : 1;
1491
+		$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
1492 1492
 		if (empty($this->status)) {
1493 1493
 			$this->status = 0;
1494 1494
 		}
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 			$sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null");
1641 1641
 			$sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'";
1642 1642
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1643
-				$sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0);
1643
+				$sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0);
1644 1644
 			}
1645 1645
 			$sql .= ",status = ".((int) $this->status);
1646 1646
 
@@ -1701,8 +1701,8 @@  discard block
 block discarded – undo
1701 1701
 			$sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null');
1702 1702
 			$sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'";
1703 1703
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1704
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1705
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1704
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1705
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1706 1706
 				if ($customer) {
1707 1707
 					$sql .= ", accountancy_code_customer_general = ".(!empty($this->accountancy_code_customer_general) ? "'".$this->db->escape($this->accountancy_code_customer_general)."'" : "null");
1708 1708
 					$sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null");
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 					$this->vat_reverse_charge = 0;
2101 2101
 				}
2102 2102
 
2103
-				$this->status				= $obj->status;
2103
+				$this->status = $obj->status;
2104 2104
 
2105 2105
 				// Local Taxes
2106 2106
 				$this->localtax1_assuj      = $obj->localtax1_assuj;
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 
2128 2128
 				$this->mode_reglement_id 	= $obj->mode_reglement;
2129 2129
 				$this->cond_reglement_id 	= $obj->cond_reglement;
2130
-				$this->deposit_percent		= $obj->deposit_percent;
2130
+				$this->deposit_percent = $obj->deposit_percent;
2131 2131
 				$this->transport_mode_id 	= $obj->transport_mode;
2132 2132
 				$this->mode_reglement_supplier_id 	= $obj->mode_reglement_supplier;
2133 2133
 				$this->cond_reglement_supplier_id 	= $obj->cond_reglement_supplier;
@@ -2697,10 +2697,10 @@  discard block
 block discarded – undo
2697 2697
 					$reparray[$i]['firstname'] = $obj->firstname;
2698 2698
 					$reparray[$i]['email'] = $obj->email;
2699 2699
 					$reparray[$i]['phone'] = $obj->office_phone;
2700
-					$reparray[$i]['office_phone'] = $obj->office_phone;			// Pro phone
2700
+					$reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone
2701 2701
 					$reparray[$i]['office_fax'] = $obj->office_fax;
2702
-					$reparray[$i]['user_mobile'] = $obj->user_mobile;			// Pro mobile
2703
-					$reparray[$i]['personal_mobile'] = $obj->personal_mobile;	// Personal mobile
2702
+					$reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile
2703
+					$reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile
2704 2704
 					$reparray[$i]['job'] = $obj->job;
2705 2705
 					$reparray[$i]['statut'] = $obj->status; // deprecated
2706 2706
 					$reparray[$i]['status'] = $obj->status;
@@ -2913,7 +2913,7 @@  discard block
 block discarded – undo
2913 2913
 			$datas['status'] = ' '.$this->getLibStatut(5);
2914 2914
 		}
2915 2915
 		if (isset($this->client) && isset($this->fournisseur)) {
2916
-			$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1, '', 0, 'span');
2916
+			$datas['type'] = ' &nbsp; '.$this->getTypeUrl(1, '', 0, 'span');
2917 2917
 		}
2918 2918
 		$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
2919 2919
 		if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -2981,9 +2981,9 @@  discard block
 block discarded – undo
2981 2981
 		}
2982 2982
 		// show categories for this record only in ajax to not overload lists
2983 2983
 		if (!$nofetch && isModEnabled('category') && $this->client) {
2984
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2984
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2985 2985
 			$form = new Form($this->db);
2986
-			$datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2986
+			$datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2987 2987
 		}
2988 2988
 		if (!empty($this->code_fournisseur) && $this->fournisseur) {
2989 2989
 			$datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
@@ -2994,9 +2994,9 @@  discard block
 block discarded – undo
2994 2994
 		}
2995 2995
 		// show categories for this record only in ajax to not overload lists
2996 2996
 		if (!$nofetch && isModEnabled('category') && $this->fournisseur) {
2997
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2997
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2998 2998
 			$form = new Form($this->db);
2999
-			$datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
2999
+			$datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
3000 3000
 		}
3001 3001
 
3002 3002
 		$datas['divclose'] = '</div>';
@@ -3192,7 +3192,7 @@  discard block
 block discarded – undo
3192 3192
 		if (empty($option) || preg_match('/customer/', $option)) {
3193 3193
 			if (($this->client == 1 || $this->client == 3) && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
3194 3194
 				$s .= '<'.$tag.' class="customer-back" title="'.dolPrintHTMLForAttribute($langs->trans("Customer")).'"';
3195
-				$s.= $tag == 'a' ? ' href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'"' : '';
3195
+				$s .= $tag == 'a' ? ' href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id.'"' : '';
3196 3196
 				$s .= '>'.dol_substr($langs->trans("Customer"), 0, 1).'</'.$tag.'>';
3197 3197
 			}
3198 3198
 		}
@@ -3544,7 +3544,7 @@  discard block
 block discarded – undo
3544 3544
 	{
3545 3545
 		// phpcs:enable
3546 3546
 		require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
3547
-		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ". (int) $this->id;
3547
+		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ".(int) $this->id;
3548 3548
 		$resql = $this->db->query($sql);
3549 3549
 		if (!$resql) {
3550 3550
 			$this->error = $this->db->lasterror();
@@ -3934,7 +3934,7 @@  discard block
 block discarded – undo
3934 3934
 		global $langs;
3935 3935
 
3936 3936
 		if ($company_id > 0) {
3937
-			$sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id);
3937
+			$sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id);
3938 3938
 			$resql = $this->db->query($sql);
3939 3939
 			if ($resql) {
3940 3940
 				if ($obj = $this->db->fetch_object($resql)) {
@@ -4550,7 +4550,7 @@  discard block
 block discarded – undo
4550 4550
 		$country_code = $country_label = '';
4551 4551
 		if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) {
4552 4552
 			$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
4553
-			$country_id =  (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4553
+			$country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4554 4554
 			if (!empty($tmp[1])) {   // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label"
4555 4555
 				$country_code = $tmp[1];
4556 4556
 				$country_label = $tmp[2];
@@ -5427,7 +5427,7 @@  discard block
 block discarded – undo
5427 5427
 		if (method_exists($this, 'getLibStatut')) {
5428 5428
 			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
5429 5429
 		}
5430
-		$return .= '</div>';	// end info-box-content
5430
+		$return .= '</div>'; // end info-box-content
5431 5431
 		$return .= '</div>';
5432 5432
 		$return .= '</div>';
5433 5433
 
@@ -5531,7 +5531,7 @@  discard block
 block discarded – undo
5531 5531
 		global $conf, $langs, $hookmanager, $user, $action;
5532 5532
 
5533 5533
 		$error = 0;
5534
-		$soc_origin = new Societe($this->db);		// The thirdparty that we will delete
5534
+		$soc_origin = new Societe($this->db); // The thirdparty that we will delete
5535 5535
 
5536 5536
 		dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id);
5537 5537
 
Please login to merge, or discard this patch.