Completed
Branch develop (805764)
by
unknown
16:32
created
dev/tools/rector/src/Renaming/GlobalToFunction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -296,14 +296,14 @@
 block discarded – undo
296 296
 		return $this->binaryOpManipulator->matchFirstAndSecondConditionNode(
297 297
 			$booleanAnd,
298 298
 			// Function to check if we are in the case $conf->global->... == $value
299
-			function (Node $node): bool {
299
+			function(Node $node): bool {
300 300
 				if (!$node instanceof Equal) {
301 301
 					return \false;
302 302
 				}
303 303
 				return $this->isGlobalVar($node->left);
304 304
 			},
305 305
 			// !empty(...) || isset(...)
306
-			function (Node $node): bool {
306
+			function(Node $node): bool {
307 307
 				if ($node instanceof BooleanNot && $node->expr instanceof Empty_) {
308 308
 					return $this->isGlobalVar($node->expr->expr);
309 309
 				}
Please login to merge, or discard this patch.
htdocs/compta/prelevement/card.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 	if ($salaryBonPl) {
461 461
 		$sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,";
462 462
 		$sql .= " u.rowid as socid, u.login as name";
463
-		$sql .=" FROM llx_prelevement_lignes as pl";
463
+		$sql .= " FROM llx_prelevement_lignes as pl";
464 464
 		$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
465 465
 		$sql .= ", ".MAIN_DB_PREFIX."user as u";
466 466
 		$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id);
467 467
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
468
-		$sql .= " AND pb.entity = ".((int) $conf->entity);	// No sharing of entity here
468
+		$sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here
469 469
 		$sql .= " AND pl.fk_user = u.rowid";
470 470
 		if ($socid) {
471 471
 			$sql .= " AND u.rowid = ".((int) $socid);
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		$sql .= ", ".MAIN_DB_PREFIX."societe as s";
480 480
 		$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id);
481 481
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
482
-		$sql .= " AND pb.entity = ".((int) $conf->entity);	// No sharing of entity here
482
+		$sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here
483 483
 		$sql .= " AND pl.fk_soc = s.rowid";
484 484
 		if ($socid) {
485 485
 			$sql .= " AND s.rowid = ".((int) $socid);
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
 	const STATUS_DRAFT = 0;
101 101
 	const STATUS_TRANSFERED = 1;
102
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
103
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
102
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
103
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
104 104
 
105 105
 
106 106
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	/**
147 147
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
148 148
 	 */
149
-	public $fields=array(
149
+	public $fields = array(
150 150
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>0,),
151 151
 		'ref' => array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax150', 'showoncombobox'=>'1',),
152 152
 		'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>25, 'notnull'=>0, 'visible'=>-1,),
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
294 294
 	{
295 295
 		$result = -1;
296
-		$concat = 0;	// ??? what is this for. Seems not used.
296
+		$concat = 0; // ??? what is this for. Seems not used.
297 297
 
298 298
 		if ($concat == 1) {
299 299
 			/*
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
334 334
 			$sql .= ") VALUES (";
335 335
 			$sql .= $this->id;
336
-			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
336
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
337 337
 			$sql .= ", '".$this->db->escape($client_nom)."'";
338 338
 			$sql .= ", ".((float) price2num($amount));
339 339
 			$sql .= ", '".$this->db->escape($code_banque)."'";
340 340
 			$sql .= ", '".$this->db->escape($code_guichet)."'";
341 341
 			$sql .= ", '".$this->db->escape($number)."'";
342 342
 			$sql .= ", '".$this->db->escape($number_key)."'";
343
-			$sql .= (($sourcetype == 'salary') ? ", ". ((int) $client_id) : '');
343
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
344 344
 			$sql .= ")";
345 345
 			if ($this->db->query($sql)) {
346 346
 				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 						} else {
591 591
 							$modeforaddpayment = 'payment';
592 592
 							$labelforaddpayment = '(CustomerInvoicePayment)';
593
-							$addbankurl = 'direct-debit';	// = 'directdebit'
593
+							$addbankurl = 'direct-debit'; // = 'directdebit'
594 594
 						}
595 595
 
596 596
 						$result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
 			// End of procedure
625 625
 			if ($error == 0) {
626
-				$this->date_credit = $date;		// date credit or debit
626
+				$this->date_credit = $date; // date credit or debit
627 627
 				$this->statut = self::STATUS_CREDITED;
628 628
 				$this->status = self::STATUS_CREDITED;
629 629
 
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 				$sql .= " FROM ".MAIN_DB_PREFIX."salary as f";
1004 1004
 				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary";
1005 1005
 				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user";
1006
-				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user";	// TODO Add AND sr.default_rib = 1 here
1006
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here
1007 1007
 			}
1008 1008
 			if ($sourcetype != 'salary') {
1009 1009
 				if ($type != 'bank-transfer') {
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 			$sql .= " AND pd.traite = 0";
1027 1027
 			$sql .= " AND pd.ext_payment_id IS NULL";
1028 1028
 			if ($sourcetype != 'salary') {
1029
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1029
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1030 1030
 			}
1031 1031
 			if ($did > 0) {
1032 1032
 				$sql .= " AND pd.rowid = ".((int) $did);
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 				$i = 0;
1039 1039
 
1040 1040
 				while ($i < $num) {
1041
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1041
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1042 1042
 					$factures[$i] = $row; // All fields
1043 1043
 
1044 1044
 					if ($row[7] == 0) {
@@ -1116,30 +1116,30 @@  discard block
 block discarded – undo
1116 1116
 								$tmpsoc->id = $fac[2];
1117 1117
 								$tmpsoc->name = $fac[8];
1118 1118
 								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1119
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1120
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1119
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1120
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1121 1121
 								$error++;
1122 1122
 							}
1123 1123
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1124 1124
 								$tmpsoc->id = $fac[2];
1125 1125
 								$tmpsoc->name = $fac[8];
1126 1126
 								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1127
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1128
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1127
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1128
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1129 1129
 								$error++;
1130 1130
 							}
1131 1131
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1132 1132
 								$tmpuser->id = $fac[2];
1133 1133
 								$tmpuser->firstname = $fac[8];
1134 1134
 								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1135
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1136
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1135
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1136
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1137 1137
 								$error++;
1138 1138
 							}
1139
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . join(', ', $fac), LOG_WARNING);
1139
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".join(', ', $fac), LOG_WARNING);
1140 1140
 						}
1141 1141
 					} else {
1142
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1142
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1143 1143
 					}
1144 1144
 					/*
1145 1145
 					} else {
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 				$ref = substr($year, -2).$month;
1193 1193
 
1194 1194
 				// Get next free nunber for the ref of bon prelevement
1195
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1195
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1196 1196
 				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1197 1197
 				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1198 1198
 				$sql .= " AND entity = ".((int) $conf->entity);
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 
1377 1377
 			if (!$error) {
1378 1378
 				$this->db->commit();
1379
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1379
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1380 1380
 			} else {
1381 1381
 				$this->db->rollback();
1382 1382
 				return -1;
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2191 2191
 			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2192 2192
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2193
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2193
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2194 2194
 
2195 2195
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2196 2196
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2198,14 +2198,14 @@  discard block
 block discarded – undo
2198 2198
 				} else {
2199 2199
 					$instrprty = 'NORM';
2200 2200
 				}
2201
-				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>' . $CrLf;
2202
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2203
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2204
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2205
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2206
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2207
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2208
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2201
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2202
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2203
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2204
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2205
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2206
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2207
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2208
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2209 2209
 			}
2210 2210
 			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2211 2211
 			$XML_CREDITOR .= '					<InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 			$this->emetteur_iban = $account->iban;
2368 2368
 			$this->emetteur_bic = $account->bic;
2369 2369
 
2370
-			$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2370
+			$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2371 2371
 
2372 2372
 			$this->raison_sociale = $account->proprio;
2373 2373
 		}
@@ -2458,15 +2458,15 @@  discard block
 block discarded – undo
2458 2458
 				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2459 2459
 				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2460 2460
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2461
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2462
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2463
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2464
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2465
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2466
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2467
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2468
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2469
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2461
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2462
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2463
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2464
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2465
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2466
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2467
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2468
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2469
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2470 2470
 				}
2471 2471
 				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2472 2472
 				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
 		if ($id) {
2760 2760
 			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2761 2761
 			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2762
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2762
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2763 2763
 			$sql .= " AND fk_user IS NOT NULL";
2764 2764
 
2765 2765
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/accountancy/journal/sellsjournal.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	$pastmonth = $dates['pastmonth'];
110 110
 }
111 111
 if (getDolGlobalString('ACCOUNTANCY_JOURNAL_USE_CURRENT_MONTH')) {
112
-	$pastmonth+=1;
112
+	$pastmonth += 1;
113 113
 }
114 114
 
115 115
 if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
140 140
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
141 141
 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
142
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
142
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
143 143
 }
144 144
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
145 145
 $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
146 146
 $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
147 147
 if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
148
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
148
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity);
149 149
 }
150 150
 $parameters = array();
151 151
 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 		//$compta_revenuestamp = getDolGlobalString('ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT', 'NotDefined');
222 222
 
223
-		$tax_id = $obj->tva_tx . ($obj->vat_src_code ? ' (' . $obj->vat_src_code . ')' : '');
223
+		$tax_id = $obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '');
224 224
 		if (array_key_exists($tax_id, $vatdata_cache)) {
225 225
 			$vatdata = $vatdata_cache[$tax_id];
226 226
 		} else {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
 		// Move a part of the retained warrenty into the account of warranty
299 299
 		if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
300
-			$retained_warranty = (float) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');	// Calculate the amount of warrenty for this line (using the percent value)
300
+			$retained_warranty = (float) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
301 301
 			$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
302 302
 			$total_ttc -= $retained_warranty;
303 303
 		}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 					$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY');
489 489
 					$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
490 490
 
491
-					$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Retainedwarranty");
491
+					$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
492 492
 					$bookkeeping->montant = $mt;
493 493
 					$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
494 494
 					$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 					}
567 567
 				} else {
568 568
 					if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
569
-						require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
569
+						require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
570 570
 						$lettering_static = new Lettering($db);
571 571
 
572 572
 						$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 		// Product / Service
579 579
 		if (!$errorforline) {
580 580
 			foreach ($tabht[$key] as $k => $mt) {
581
-				$resultfetch = $accountingaccount->fetch(null, $k, true);	// TODO Use a cache
581
+				$resultfetch = $accountingaccount->fetch(null, $k, true); // TODO Use a cache
582 582
 				$label_account = $accountingaccount->label;
583 583
 
584 584
 				// get compte id and label
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
 				foreach ($arrayofvat[$key] as $k => $mt) {
656 656
 					if ($mt) {
657
-						$accountingaccount->fetch(null, $k, true);	// TODO Use a cache for label
657
+						$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
658 658
 						$label_account = $accountingaccount->label;
659 659
 
660 660
 						$bookkeeping = new BookKeeping($db);
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 			if (is_array($tabrevenuestamp[$key])) {
716 716
 				foreach ($tabrevenuestamp[$key] as $k => $mt) {
717 717
 					if ($mt) {
718
-						$accountingaccount->fetch(null, $k, true);    // TODO Use a cache for label
718
+						$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
719 719
 						$label_account = $accountingaccount->label;
720 720
 
721 721
 						$bookkeeping = new BookKeeping($db);
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 						$bookkeeping->numero_compte = $k;
735 735
 						$bookkeeping->label_compte = $label_account;
736 736
 
737
-						$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("RevenueStamp");
737
+						$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp");
738 738
 						$bookkeeping->montant = $mt;
739 739
 						$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
740 740
 						$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 	foreach ($tabfac as $key => $val) {
837 837
 		$companystatic->id = $tabcompany[$key]['id'];
838 838
 		$companystatic->name = $tabcompany[$key]['name'];
839
-		$companystatic->code_compta = $tabcompany[$key]['code_compta'];				// deprecated
839
+		$companystatic->code_compta = $tabcompany[$key]['code_compta']; // deprecated
840 840
 		$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
841 841
 		$companystatic->code_client = $tabcompany[$key]['code_client'];
842 842
 		$companystatic->client = 3;
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	}
1021 1021
 
1022 1022
 	// Button to write into Ledger
1023
-	$acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']);
1023
+	$acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['', '-1']);
1024 1024
 	if ($acctCustomerNotConfigured) {
1025 1025
 		print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
1026 1026
 		$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
@@ -1154,13 +1154,13 @@  discard block
 block discarded – undo
1154 1154
 			foreach ($tabwarranty[$key] as $k => $mt) {
1155 1155
 				print '<tr class="oddeven">';
1156 1156
 				print "<!-- Thirdparty warranty -->";
1157
-				print "<td>" . $date . "</td>";
1158
-				print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
1157
+				print "<td>".$date."</td>";
1158
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
1159 1159
 				// Account
1160 1160
 				print "<td>";
1161 1161
 				$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
1162 1162
 				if (($accountoshow == "") || $accountoshow == 'NotDefined') {
1163
-					print '<span class="error">' . $langs->trans("MainAccountForRetainedWarrantyNotDefined") . '</span>';
1163
+					print '<span class="error">'.$langs->trans("MainAccountForRetainedWarrantyNotDefined").'</span>';
1164 1164
 				} else {
1165 1165
 					print $accountoshow;
1166 1166
 				}
@@ -1169,14 +1169,14 @@  discard block
 block discarded – undo
1169 1169
 				print "<td>";
1170 1170
 				$accountoshow = length_accounta($k);
1171 1171
 				if (($accountoshow == "") || $accountoshow == 'NotDefined') {
1172
-					print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
1172
+					print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
1173 1173
 				} else {
1174 1174
 					print $accountoshow;
1175 1175
 				}
1176 1176
 				print '</td>';
1177
-				print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Retainedwarranty") . "</td>";
1178
-				print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>";
1179
-				print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
1177
+				print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty")."</td>";
1178
+				print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1179
+				print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1180 1180
 				print "</tr>";
1181 1181
 			}
1182 1182
 		}
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 					print length_accounta($tabcompany[$key]['code_compta']);
1239 1239
 				}
1240 1240
 			} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
1241
-				print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
1241
+				print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
1242 1242
 			}
1243 1243
 			print '</td>';
1244 1244
 			$companystatic->id = $tabcompany[$key]['id'];
@@ -1302,13 +1302,13 @@  discard block
 block discarded – undo
1302 1302
 			foreach ($tabrevenuestamp[$key] as $k => $mt) {
1303 1303
 				print '<tr class="oddeven">';
1304 1304
 				print "<!-- Thirdparty revenuestamp -->";
1305
-				print "<td>" . $date . "</td>";
1306
-				print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
1305
+				print "<td>".$date."</td>";
1306
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
1307 1307
 				// Account
1308 1308
 				print "<td>";
1309 1309
 				$accountoshow = length_accountg($k);
1310 1310
 				if (($accountoshow == "") || $accountoshow == 'NotDefined') {
1311
-					print '<span class="error">' . $langs->trans("MainAccountForRevenueStampSaleNotDefined") . '</span>';
1311
+					print '<span class="error">'.$langs->trans("MainAccountForRevenueStampSaleNotDefined").'</span>';
1312 1312
 				} else {
1313 1313
 					print $accountoshow;
1314 1314
 				}
@@ -1316,9 +1316,9 @@  discard block
 block discarded – undo
1316 1316
 				// Subledger account
1317 1317
 				print "<td>";
1318 1318
 				print '</td>';
1319
-				print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("RevenueStamp") . "</td>";
1320
-				print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
1321
-				print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>";
1319
+				print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp")."</td>";
1320
+				print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1321
+				print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1322 1322
 				print "</tr>";
1323 1323
 			}
1324 1324
 		}
Please login to merge, or discard this patch.
htdocs/salaries/class/salary.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@
 block discarded – undo
268 268
 				$this->dateep			= $this->db->jdate($obj->dateep);
269 269
 				$this->note				= $obj->note;
270 270
 				$this->paye 			= $obj->paye;
271
-				$this->status 			= $obj->paye;
271
+				$this->status = $obj->paye;
272 272
 				$this->fk_bank          = $obj->fk_bank;
273 273
 				$this->fk_user_author   = $obj->fk_user_author;
274 274
 				$this->fk_user_modif    = $obj->fk_user_modif;
Please login to merge, or discard this patch.
htdocs/core/class/commoninvoice.class.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public $revenuestamp;
91 91
 
92
-	public $totalpaid;			// duplicate with sumpayed
93
-	public $totaldeposits;		// duplicate with sumdeposit
94
-	public $totalcreditnotes;	// duplicate with sumcreditnote
92
+	public $totalpaid; // duplicate with sumpayed
93
+	public $totaldeposits; // duplicate with sumdeposit
94
+	public $totalcreditnotes; // duplicate with sumcreditnote
95 95
 
96 96
 	public $sumpayed;
97 97
 	public $sumpayed_multicurrency;
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$sharedentity = 'facture_fourn';
457 457
 		}
458 458
 
459
-		$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4;
459
+		$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3.$field4;
460 460
 		$sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t";
461 461
 		$sql .= " WHERE pf.".$field." = ".((int) $this->id);
462 462
 		$sql .= " AND pf.".$field2." = p.rowid";
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
 	{
698 698
 		$subtypeLabel = '';
699 699
 		if ($table === 'facture' || $table === 'facture_fourn') {
700
-			$sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f";
701
-			$sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid";
700
+			$sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f";
701
+			$sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid";
702 702
 			$sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'";
703 703
 		} elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') {
704
-			$sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f";
705
-			$sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid";
704
+			$sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f";
705
+			$sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid";
706 706
 			$sql .= " WHERE f.titre = '".$this->db->escape($this->title)."'";
707 707
 		} else {
708 708
 			return -1;
@@ -734,10 +734,10 @@  discard block
 block discarded – undo
734 734
 		$effs = array();
735 735
 
736 736
 		$sql = "SELECT rowid, code, label as label";
737
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
737
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
738 738
 		$sql .= " WHERE active = 1 AND fk_country = ".((int) $mysoc->country_id)." AND entity IN(".getEntity('c_invoice_subtype').")";
739 739
 		$sql .= " ORDER by rowid, code";
740
-		dol_syslog(get_class($this) . '::getArrayOfInvoiceSubtypes', LOG_DEBUG);
740
+		dol_syslog(get_class($this).'::getArrayOfInvoiceSubtypes', LOG_DEBUG);
741 741
 		$resql = $this->db->query($sql);
742 742
 		if ($resql) {
743 743
 			$num = $this->db->num_rows($resql);
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 		if ($this->status > self::STATUS_DRAFT && $this->paye == 0) {
1130 1130
 			// Get the default payment mode for BAN payment of the third party
1131 1131
 			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1132
-			$bac = new CompanyBankAccount($this->db);	// table societe_rib
1132
+			$bac = new CompanyBankAccount($this->db); // table societe_rib
1133 1133
 			$result = $bac->fetch(0, $this->socid, 1, 'ban');
1134 1134
 			if ($result <= 0 || empty($bac->id)) {
1135 1135
 				$this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount");
@@ -1143,16 +1143,16 @@  discard block
 block discarded – undo
1143 1143
 			$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
1144 1144
 			$sql .= " WHERE rowid = ".((int) $did);
1145 1145
 			if ($type != 'bank-transfer' && $type != 'credit-transfer') {
1146
-				$sql .= " AND fk_facture = ".((int) $this->id);				// Add a protection to not pay another invoice than current one
1146
+				$sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one
1147 1147
 			}
1148 1148
 			if ($type != 'direct-debit') {
1149 1149
 				if ($$sourcetype == 'salary') {
1150
-					$sql .= " AND fk_salary = ".((int) $this->id);			// Add a protection to not pay another salary than current one
1150
+					$sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one
1151 1151
 				} else {
1152
-					$sql .= " AND fk_facture_fourn = ".((int) $this->id);	// Add a protection to not pay another invoice than current one
1152
+					$sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one
1153 1153
 				}
1154 1154
 			}
1155
-			$sql .= " AND traite = 0";	// To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)
1155
+			$sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)
1156 1156
 
1157 1157
 			dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1158 1158
 			$resql = $this->db->query($sql);
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 				if (is_numeric($amount) && $amount != 0) {
1170 1170
 					require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php';
1171
-					$companypaymentmode = new CompanyPaymentMode($this->db);	// table societe_rib
1171
+					$companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib
1172 1172
 					$companypaymentmode->fetch($bac->id);
1173 1173
 
1174 1174
 					$this->stripechargedone = 0;
@@ -1178,11 +1178,11 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
 					$currency = $conf->currency;
1180 1180
 
1181
-					$errorforinvoice = 0;     // We reset the $errorforinvoice at each invoice loop
1181
+					$errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop
1182 1182
 
1183 1183
 					$this->fetch_thirdparty();
1184 1184
 
1185
-					dol_syslog("--- Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG);
1185
+					dol_syslog("--- Process payment request amount=".$amount." thirdparty_id=".$this->thirdparty->id.", thirdparty_name=".$this->thirdparty->name." ban id=".$bac->id, LOG_DEBUG);
1186 1186
 
1187 1187
 					//$alreadypayed = $this->getSommePaiement();
1188 1188
 					//$amount_credit_notes_included = $this->getSumCreditNotesUsed();
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 						$amountstripe = $amountstripe * 100;
1198 1198
 					}
1199 1199
 
1200
-					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');		// Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr.
1200
+					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr.
1201 1201
 					if (!($fk_bank_account > 0)) {
1202 1202
 						$error++;
1203 1203
 						$errorforinvoice++;
@@ -1253,44 +1253,44 @@  discard block
 block discarded – undo
1253 1253
 								}
1254 1254
 
1255 1255
 								//var_dump($companypaymentmode);
1256
-								dol_syslog("We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG);
1256
+								dol_syslog("We will try to pay with companypaymentmodeid=".$companypaymentmode->id." stripe_card_ref=".$companypaymentmode->stripe_card_ref." mode=".$companypaymentmode->status, LOG_DEBUG);
1257 1257
 
1258 1258
 								$thirdparty = new Societe($this->db);
1259 1259
 								$resultthirdparty = $thirdparty->fetch($this->socid);
1260 1260
 
1261
-								include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php';        // This include the include of htdocs/stripe/config.php
1261
+								include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php
1262 1262
 								// So it inits or erases the $stripearrayofkeysbyenv
1263 1263
 								$stripe = new Stripe($this->db);
1264 1264
 
1265 1265
 								if (empty($savstripearrayofkeysbyenv)) {
1266 1266
 									$savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1267 1267
 								}
1268
-								dol_syslog("makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1268
+								dol_syslog("makeStripeSepaRequest Current Stripe environment is ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1269 1269
 								dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1270 1270
 
1271 1271
 								$foundalternativestripeaccount = '';
1272 1272
 
1273 1273
 								// Force stripe to another value (by default this value is empty)
1274
-								if (! empty($forcestripe)) {
1274
+								if (!empty($forcestripe)) {
1275 1275
 									dol_syslog("makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1276 1276
 
1277 1277
 									$tmparray = explode('@', $forcestripe);
1278
-									if (! empty($tmparray[1])) {
1278
+									if (!empty($tmparray[1])) {
1279 1279
 										$tmparray2 = explode(':', $tmparray[1]);
1280
-										if (! empty($tmparray2[1])) {
1280
+										if (!empty($tmparray2[1])) {
1281 1281
 											$stripearrayofkeysbyenv[$servicestatus]["publishable_key"] = $tmparray2[0];
1282 1282
 											$stripearrayofkeysbyenv[$servicestatus]["secret_key"] = $tmparray2[1];
1283 1283
 
1284 1284
 											$stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1285 1285
 											\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
1286 1286
 
1287
-											$foundalternativestripeaccount = $tmparray[0];    // Store the customer id
1287
+											$foundalternativestripeaccount = $tmparray[0]; // Store the customer id
1288 1288
 
1289 1289
 											dol_syslog("makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount." publishable_key=".$stripearrayofkeys['publishable_key'], LOG_DEBUG);
1290 1290
 										}
1291 1291
 									}
1292 1292
 
1293
-									if (! $foundalternativestripeaccount) {
1293
+									if (!$foundalternativestripeaccount) {
1294 1294
 										$stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1295 1295
 
1296 1296
 										$stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
 									dol_syslog("makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys['publishable_key'], LOG_DEBUG);
1306 1306
 								}
1307 1307
 
1308
-								$stripeacc = $stripe->getStripeAccount($service, $this->socid);								// Get Stripe OAuth connect account if it exists (no network access here)
1308
+								$stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)
1309 1309
 
1310 1310
 								if ($foundalternativestripeaccount) {
1311 1311
 									if (empty($stripeacc)) {				// If the Stripe connect account not set, we use common API usage
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 									}
1316 1316
 								} else {
1317 1317
 									$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1318
-									if (empty($customer) && ! empty($stripe->error)) {
1318
+									if (empty($customer) && !empty($stripe->error)) {
1319 1319
 										$this->errors[] = $stripe->error;
1320 1320
 									}
1321 1321
 									/*if (!empty($customer) && empty($customer->sources)) {
@@ -1342,15 +1342,15 @@  discard block
 block discarded – undo
1342 1342
 										}
1343 1343
 
1344 1344
 										if ($stripecard) {  // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
1345
-											$FULLTAG = 'DID='.$did.'-INV=' . $this->id . '-CUS=' . $thirdparty->id;
1346
-											$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' did='.$did.' ref=' . $this->ref;
1345
+											$FULLTAG = 'DID='.$did.'-INV='.$this->id.'-CUS='.$thirdparty->id;
1346
+											$description = 'Stripe payment from makeStripeSepaRequest: '.$FULLTAG.' did='.$did.' ref='.$this->ref;
1347 1347
 
1348 1348
 											$stripefailurecode = '';
1349 1349
 											$stripefailuremessage = '';
1350 1350
 											$stripefailuredeclinecode = '';
1351 1351
 
1352 1352
 											// Using new SCA method
1353
-											dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1353
+											dol_syslog("* Create payment on SEPA ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
1354 1354
 
1355 1355
 											// Create payment intent and charge payment (confirmnow = true)
1356 1356
 											$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1, 1, $did);
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 												$charge->failure_message = $stripe->error;
1372 1372
 												$charge->failure_declinecode = $stripe->declinecode;
1373 1373
 												$stripefailurecode = $stripe->code;
1374
-												$stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
1374
+												$stripefailuremessage = 'Action required. Contact the support at '; // . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
1375 1375
 												$stripefailuredeclinecode = $stripe->declinecode;
1376 1376
 											} else {
1377 1377
 												dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 
1393 1393
 											// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
1394 1394
 											if (empty($charge) || $charge->status == 'failed') {
1395
-												dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1395
+												dol_syslog('Failed to charge payment mode '.$stripecard->id.' stripefailurecode='.$stripefailurecode.' stripefailuremessage='.$stripefailuremessage.' stripefailuredeclinecode='.$stripefailuredeclinecode, LOG_WARNING);
1396 1396
 
1397 1397
 												// Save a stripe payment was in error
1398 1398
 												$this->stripechargeerror++;
@@ -1405,8 +1405,8 @@  discard block
 block discarded – undo
1405 1405
 														$errauthenticationmessage = $langs->trans("ErrSCAAuthentication");
1406 1406
 														$errmsg = $errauthenticationmessage;
1407 1407
 													} elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) {
1408
-														$errmsg .= ': ' . $charge->failure_code;
1409
-														$errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message;
1408
+														$errmsg .= ': '.$charge->failure_code;
1409
+														$errmsg .= ($charge->failure_message ? ' - ' : '').' '.$charge->failure_message;
1410 1410
 														if (empty($stripefailurecode)) {
1411 1411
 															$stripefailurecode = $charge->failure_code;
1412 1412
 														}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 															$stripefailuremessage = $charge->failure_message;
1415 1415
 														}
1416 1416
 													} else {
1417
-														$errmsg .= ': failure_code=' . $charge->failure_code;
1418
-														$errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message;
1417
+														$errmsg .= ': failure_code='.$charge->failure_code;
1418
+														$errmsg .= ($charge->failure_message ? ' - ' : '').' failure_message='.$charge->failure_message;
1419 1419
 														if (empty($stripefailurecode)) {
1420 1420
 															$stripefailurecode = $charge->failure_code;
1421 1421
 														}
@@ -1424,24 +1424,24 @@  discard block
 block discarded – undo
1424 1424
 														}
1425 1425
 													}
1426 1426
 												} else {
1427
-													$errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage;
1428
-													$errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : '');
1427
+													$errmsg .= ': '.$stripefailurecode.' - '.$stripefailuremessage;
1428
+													$errmsg .= ($stripefailuredeclinecode ? ' - '.$stripefailuredeclinecode : '');
1429 1429
 												}
1430 1430
 
1431
-												$description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1432
-												$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
1431
+												$description = 'Stripe payment ERROR from makeStripeSepaRequest: '.$FULLTAG;
1432
+												$postactionmessages[] = $errmsg.' ('.$stripearrayofkeys['publishable_key'].')';
1433 1433
 												$this->errors[] = $errmsg;
1434 1434
 											} else {
1435 1435
 												dol_syslog('Successfuly request '.$type.' '.$stripecard->id);
1436 1436
 
1437
-												$postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
1437
+												$postactionmessages[] = 'Success to request '.$type.' ('.$charge->id.' with '.$stripearrayofkeys['publishable_key'].')';
1438 1438
 
1439 1439
 												// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
1440 1440
 												// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
1441 1441
 												$this->stripechargedone++;
1442 1442
 
1443 1443
 												// Default description used for label of event. Will be overwrite by another value later.
1444
-												$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
1444
+												$description = 'Stripe payment request OK ('.$charge->id.') from makeStripeSepaRequest: '.$FULLTAG;
1445 1445
 											}
1446 1446
 
1447 1447
 											$object = $this;
@@ -1450,8 +1450,8 @@  discard block
 block discarded – undo
1450 1450
 											if (empty($charge) || $charge->status == 'failed') {
1451 1451
 												$actioncode = 'PAYMENT_STRIPE_KO';
1452 1452
 												$extraparams = $stripefailurecode;
1453
-												$extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage;
1454
-												$extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode;
1453
+												$extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '').$stripefailuremessage;
1454
+												$extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '').$stripefailuredeclinecode;
1455 1455
 											} else {
1456 1456
 												$actioncode = 'PAYMENT_STRIPE_OK';
1457 1457
 												$extraparams = '';
@@ -1459,13 +1459,13 @@  discard block
 block discarded – undo
1459 1459
 										} else {
1460 1460
 											$error++;
1461 1461
 											$errorforinvoice++;
1462
-											dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1463
-											$this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1462
+											dol_syslog("No ban payment method found for this stripe customer ".$customer->id, LOG_WARNING);
1463
+											$this->errors[] = 'Failed to get direct debit payment method for stripe customer = '.$customer->id;
1464 1464
 
1465 1465
 											$description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1466 1466
 											$stripefailurecode = 'BADPAYMENTMODE';
1467 1467
 											$stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1468
-											$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')';
1468
+											$postactionmessages[] = $description.' ('.$stripearrayofkeys['publishable_key'].')';
1469 1469
 
1470 1470
 											$object = $this;
1471 1471
 
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
 									}
1486 1486
 								} else {	// Else of the   if ($resultthirdparty > 0 && ! empty($customer)) {
1487 1487
 									if ($resultthirdparty <= 0) {
1488
-										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1489
-										$this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1488
+										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = '.$thirdparty->id, LOG_WARNING);
1489
+										$this->errors[] = 'Failed to load Stripe account for thirdparty_id = '.$thirdparty->id;
1490 1490
 									} else { // $customer stripe not found
1491
-										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
1492
-										$this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
1491
+										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
1492
+										$this->errors[] = 'Failed to get Stripe account id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
1493 1493
 									}
1494 1494
 									$error++;
1495 1495
 									$errorforinvoice++;
@@ -1506,24 +1506,24 @@  discard block
 block discarded – undo
1506 1506
 								}
1507 1507
 
1508 1508
 								if ($description) {
1509
-									dol_syslog("* Record event for credit transfer or direct debit request result - " . $description);
1509
+									dol_syslog("* Record event for credit transfer or direct debit request result - ".$description);
1510 1510
 									require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1511 1511
 
1512 1512
 									// Insert record of payment (success or error)
1513 1513
 									$actioncomm = new ActionComm($this->db);
1514 1514
 
1515
-									$actioncomm->type_code = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
1516
-									$actioncomm->code = 'AC_' . $actioncode;
1515
+									$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
1516
+									$actioncomm->code = 'AC_'.$actioncode;
1517 1517
 									$actioncomm->label = $description;
1518 1518
 									$actioncomm->note_private = join(",\n", $postactionmessages);
1519 1519
 									$actioncomm->fk_project = $this->fk_project;
1520 1520
 									$actioncomm->datep = $now;
1521 1521
 									$actioncomm->datef = $now;
1522
-									$actioncomm->percentage = -1;   // Not applicable
1522
+									$actioncomm->percentage = -1; // Not applicable
1523 1523
 									$actioncomm->socid = $thirdparty->id;
1524 1524
 									$actioncomm->contactid = 0;
1525
-									$actioncomm->authorid = $user->id;   // User saving action
1526
-									$actioncomm->userownerid = $user->id;	// Owner of action
1525
+									$actioncomm->authorid = $user->id; // User saving action
1526
+									$actioncomm->userownerid = $user->id; // Owner of action
1527 1527
 									// Fields when action is a real email (content is already into note)
1528 1528
 									/*$actioncomm->email_msgid = $object->email_msgid;
1529 1529
 									 $actioncomm->email_from  = $object->email_from;
@@ -1545,14 +1545,14 @@  discard block
 block discarded – undo
1545 1545
 							} catch (Exception $e) {
1546 1546
 								$error++;
1547 1547
 								$errorforinvoice++;
1548
-								dol_syslog('Error ' . $e->getMessage(), LOG_ERR);
1549
-								$this->errors[] = 'Error ' . $e->getMessage();
1548
+								dol_syslog('Error '.$e->getMessage(), LOG_ERR);
1549
+								$this->errors[] = 'Error '.$e->getMessage();
1550 1550
 							}
1551 1551
 						} else {	// If remain to pay is null
1552 1552
 							$error++;
1553 1553
 							$errorforinvoice++;
1554
-							dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1555
-							$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
1554
+							dol_syslog("Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1555
+							$this->errors[] = "Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?";
1556 1556
 						}
1557 1557
 					}
1558 1558
 
@@ -1692,10 +1692,10 @@  discard block
 block discarded – undo
1692 1692
 		$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring;
1693 1693
 		$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
1694 1694
 		$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;
1695
-		$s .= '';					// Hash of xml invoice
1696
-		$s .= '';					// ecda signature
1697
-		$s .= '';					// ecda public key
1698
-		$s .= '';					// ecda signature of public key stamp
1695
+		$s .= ''; // Hash of xml invoice
1696
+		$s .= ''; // ecda signature
1697
+		$s .= ''; // ecda public key
1698
+		$s .= ''; // ecda signature of public key stamp
1699 1699
 
1700 1700
 		$s = base64_encode($s);
1701 1701
 
@@ -1763,8 +1763,8 @@  discard block
 block discarded – undo
1763 1763
 			$s .= "S\n";
1764 1764
 			$s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n";
1765 1765
 			$addresslinearray = explode("\n", $bankaccount->owner_address);
1766
-			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1767
-			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1766
+			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1767
+			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1768 1768
 			/*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
1769 1769
 			$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
1770 1770
 			$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/
@@ -1772,8 +1772,8 @@  discard block
 block discarded – undo
1772 1772
 			$s .= "S\n";
1773 1773
 			$s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";
1774 1774
 			$addresslinearray = explode("\n", $mysoc->address);
1775
-			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1776
-			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1775
+			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1776
+			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1777 1777
 			$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
1778 1778
 			$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
1779 1779
 			$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";
@@ -1793,14 +1793,14 @@  discard block
 block discarded – undo
1793 1793
 		$s .= "S\n";
1794 1794
 		$s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n";
1795 1795
 		$addresslinearray = explode("\n", $this->thirdparty->address);
1796
-		$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1797
-		$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1796
+		$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1797
+		$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1798 1798
 		$s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n";
1799 1799
 		$s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n";
1800 1800
 		$s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n";
1801 1801
 		// ID of payment
1802
-		$s .= "NON\n";			// NON or QRR
1803
-		$s .= "\n";				// QR Code reference if previous field is QRR
1802
+		$s .= "NON\n"; // NON or QRR
1803
+		$s .= "\n"; // QR Code reference if previous field is QRR
1804 1804
 		// Free text
1805 1805
 		if ($complementaryinfo) {
1806 1806
 			$s .= $complementaryinfo."\n";
Please login to merge, or discard this patch.