Completed
Branch develop (dca268)
by
unknown
25:21
created
htdocs/core/lib/company.lib.php 1 patch
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	$h = 0;
49 49
 	$head = array();
50 50
 
51
-	$head[$h][0] = DOL_URL_ROOT . '/societe/card.php?socid=' . $object->id;
51
+	$head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id;
52 52
 	$head[$h][1] = $langs->trans("ThirdParty");
53 53
 	$head[$h][2] = 'card';
54 54
 	$h++;
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
59 59
 		$nbContact = 0;
60 60
 		// Enable caching of thirdrparty count Contacts
61
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
62
-		$cachekey = 'count_contacts_thirdparty_' . $object->id;
61
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
62
+		$cachekey = 'count_contacts_thirdparty_'.$object->id;
63 63
 		$dataretrieved = dol_getcache($cachekey);
64 64
 
65 65
 		if (!is_null($dataretrieved)) {
66 66
 			$nbContact = $dataretrieved;
67 67
 		} else {
68 68
 			$sql = "SELECT COUNT(p.rowid) as nb";
69
-			$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as p";
69
+			$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
70 70
 			// Add table from hooks
71 71
 			$parameters = array('contacttab' => true);
72 72
 			$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
73 73
 			$sql .= $hookmanager->resPrint;
74
-			$sql .= " WHERE p.fk_soc = " . ((int) $object->id);
75
-			$sql .= " AND p.entity IN (" . getEntity($object->element) . ")";
74
+			$sql .= " WHERE p.fk_soc = ".((int) $object->id);
75
+			$sql .= " AND p.entity IN (".getEntity($object->element).")";
76 76
 			// Add where from hooks
77 77
 			$parameters = array('contacttab' => true);
78 78
 			$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
 				$nbContact = $obj->nb;
84 84
 			}
85 85
 
86
-			dol_setcache($cachekey, $nbContact, 120);	// If setting cache fails, this is not a problem, so we do not test result.
86
+			dol_setcache($cachekey, $nbContact, 120); // If setting cache fails, this is not a problem, so we do not test result.
87 87
 		}
88 88
 
89
-		$head[$h][0] = DOL_URL_ROOT . '/societe/contact.php?socid=' . $object->id;
89
+		$head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id;
90 90
 		$head[$h][1] = $langs->trans('ContactsAddresses');
91 91
 		if ($nbContact > 0) {
92
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
92
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
93 93
 		}
94 94
 		$head[$h][2] = 'contact';
95 95
 		$h++;
96 96
 	}
97 97
 	if (getDolGlobalString('MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES')) {
98 98
 		// Some features may be unstable with this option, like permissions rules, import contact, ...
99
-		$head[$h][0] = DOL_URL_ROOT . '/societe/societecontact.php?socid=' . $object->id;
99
+		$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
100 100
 		$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
101 101
 		$head[$h][1] = $langs->trans("ContactsAddressesExt");
102 102
 		if ($nbContact > 0) {
103
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
103
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
104 104
 		}
105 105
 		$head[$h][2] = 'contactext';
106 106
 		$h++;
107 107
 	}
108 108
 
109 109
 	if ($object->client == 1 || $object->client == 2 || $object->client == 3) {
110
-		$head[$h][0] = DOL_URL_ROOT . '/comm/card.php?socid=' . $object->id;
110
+		$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
111 111
 		$head[$h][1] = '';
112 112
 		if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && ($object->client == 2 || $object->client == 3)) {
113 113
 			$head[$h][1] .= $langs->trans("Prospect");
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
125 125
 			$langs->load("products");
126 126
 			// price
127
-			$head[$h][0] = DOL_URL_ROOT . '/societe/price.php?socid=' . $object->id;
127
+			$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
128 128
 			$head[$h][1] = $langs->trans("CustomerPrices");
129 129
 			$head[$h][2] = 'price';
130 130
 			$h++;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		$supplier_module_enabled = 1;
136 136
 	}
137 137
 	if ($supplier_module_enabled == 1 && $object->fournisseur && $user->hasRight('fournisseur', 'lire')) {
138
-		$head[$h][0] = DOL_URL_ROOT . '/fourn/card.php?socid=' . $object->id;
138
+		$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
139 139
 		$head[$h][1] = $langs->trans("Supplier");
140 140
 		$head[$h][2] = 'supplier';
141 141
 		$h++;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			$mode = 'customer';
155 155
 		}
156 156
 
157
-		$head[$h][0] = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?socid=' . $object->id . '&mode=' . $mode . '&type=sub&search_accountancy_code_start=' . $subledger_start_account . '&search_accountancy_code_end=' . $subledger_end_account;
157
+		$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?socid='.$object->id.'&mode='.$mode.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account;
158 158
 		$head[$h][1] = $langs->trans("Accounting");
159 159
 		$head[$h][2] = 'accounting';
160 160
 		$h++;
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 	if (isModEnabled('project') && ($user->hasRight('projet', 'lire'))) {
164 164
 		$nbProject = 0;
165 165
 		// Enable caching of thirdrparty count projects
166
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
167
-		$cachekey = 'count_projects_thirdparty_' . $object->id;
166
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
167
+		$cachekey = 'count_projects_thirdparty_'.$object->id;
168 168
 		$dataretrieved = dol_getcache($cachekey);
169 169
 
170 170
 		if (!is_null($dataretrieved)) {
171 171
 			$nbProject = $dataretrieved;
172 172
 		} else {
173 173
 			$sql = "SELECT COUNT(n.rowid) as nb";
174
-			$sql .= " FROM " . MAIN_DB_PREFIX . "projet as n";
175
-			$sql .= " WHERE fk_soc = " . ((int) $object->id);
176
-			$sql .= " AND entity IN (" . getEntity('project') . ")";
174
+			$sql .= " FROM ".MAIN_DB_PREFIX."projet as n";
175
+			$sql .= " WHERE fk_soc = ".((int) $object->id);
176
+			$sql .= " AND entity IN (".getEntity('project').")";
177 177
 			$resql = $db->query($sql);
178 178
 			if ($resql) {
179 179
 				$obj = $db->fetch_object($resql);
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 			} else {
182 182
 				dol_print_error($db);
183 183
 			}
184
-			dol_setcache($cachekey, $nbProject, 120);	// If setting cache fails, this is not a problem, so we do not test result.
184
+			dol_setcache($cachekey, $nbProject, 120); // If setting cache fails, this is not a problem, so we do not test result.
185 185
 		}
186
-		$head[$h][0] = DOL_URL_ROOT . '/societe/project.php?socid=' . $object->id;
186
+		$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
187 187
 		$head[$h][1] = $langs->trans("Projects");
188 188
 		if ($nbProject > 0) {
189
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbProject . '</span>';
189
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbProject.'</span>';
190 190
 		}
191 191
 		$head[$h][2] = 'project';
192 192
 		$h++;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 	// Tab to link resources
196 196
 	if (isModEnabled('resource') && getDolGlobalString('RESOURCE_ON_THIRDPARTIES')) {
197
-		$head[$h][0] = DOL_URL_ROOT . '/resource/element_resource.php?element=societe&element_id=' . $object->id;
197
+		$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
198 198
 		$head[$h][1] = $langs->trans("Resources");
199 199
 		$head[$h][2] = 'resources';
200 200
 		$h++;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	if ((isModEnabled('order') || isModEnabled('propal') || isModEnabled('invoice') || isModEnabled('intervention') || isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))
205 205
 		&& !getDolGlobalString('THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB')
206 206
 	) {
207
-		$head[$h][0] = DOL_URL_ROOT . '/societe/consumption.php?socid=' . $object->id;
207
+		$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
208 208
 		$head[$h][1] = $langs->trans("Referers");
209 209
 		$head[$h][2] = 'consumption';
210 210
 		$h++;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				$servicestatus = 1;
225 225
 			}
226 226
 
227
-			include_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php';
227
+			include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
228 228
 			$societeaccount = new SocieteAccount($db);
229 229
 			$stripecu = $societeaccount->getCustomerAccount($object->id, 'stripe', $servicestatus); // Get thirdparty cu_...
230 230
 			if ($stripecu) {
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 		}
234 234
 
235 235
 		$sql = "SELECT COUNT(n.rowid) as nb";
236
-		$sql .= " FROM " . MAIN_DB_PREFIX . "societe_rib as n";
237
-		$sql .= " WHERE n.fk_soc = " . ((int) $object->id);
236
+		$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
237
+		$sql .= " WHERE n.fk_soc = ".((int) $object->id);
238 238
 		if (!isModEnabled('stripe')) {
239 239
 			$sql .= " AND (n.stripe_card_ref IS NULL OR n.stripe_card_ref ='')";
240 240
 		} else {
241
-			$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = " . ((int) $servicestatus) . "))";
241
+			$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))";
242 242
 		}
243 243
 
244 244
 		$resql = $db->query($sql);
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 
252 252
 		//if (isModEnabled('stripe') && $nbBankAccount > 0) $nbBankAccount = '...';	// No way to know exact number
253 253
 
254
-		$head[$h][0] = DOL_URL_ROOT . '/societe/paymentmodes.php?socid=' . urlencode((string) ($object->id));
254
+		$head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.urlencode((string) ($object->id));
255 255
 		$head[$h][1] = $title;
256 256
 		if ($foundonexternalonlinesystem) {
257 257
 			$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
258 258
 		} elseif ($nbBankAccount > 0) {
259
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbBankAccount . '</span>';
259
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbBankAccount.'</span>';
260 260
 		}
261 261
 		$head[$h][2] = 'rib';
262 262
 		$h++;
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 			$site_filter_list[] = 'dolibarr_portal';
272 272
 		}
273 273
 
274
-		$head[$h][0] = DOL_URL_ROOT . '/societe/website.php?id=' . urlencode((string) ($object->id));
274
+		$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.urlencode((string) ($object->id));
275 275
 		$head[$h][1] = $langs->trans("WebSiteAccounts");
276 276
 		$nbNote = 0;
277 277
 		$sql = "SELECT COUNT(n.rowid) as nb";
278
-		$sql .= " FROM " . MAIN_DB_PREFIX . "societe_account as n";
279
-		$sql .= " WHERE fk_soc = " . ((int) $object->id);
280
-		$sql .= " AND entity IN (" . getEntity('thirdpartyaccount') . ")";
278
+		$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as n";
279
+		$sql .= " WHERE fk_soc = ".((int) $object->id);
280
+		$sql .= " AND entity IN (".getEntity('thirdpartyaccount').")";
281 281
 		if (!empty($site_filter_list)) {
282
-			$sql .= " AND n.site IN (" . $db->sanitize("'" . implode("','", $site_filter_list) . "'", 1) . ")";
282
+			$sql .= " AND n.site IN (".$db->sanitize("'".implode("','", $site_filter_list)."'", 1).")";
283 283
 		}
284 284
 		$resql = $db->query($sql);
285 285
 		if ($resql) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 			dol_print_error($db);
290 290
 		}
291 291
 		if ($nbNote > 0) {
292
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
292
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
293 293
 		}
294 294
 		$head[$h][2] = 'website';
295 295
 		$h++;
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 		if ($user->hasRight('partnership', 'read')) {
300 300
 			$langs->load("partnership");
301 301
 			$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;
302
-			$head[$h][0] = DOL_URL_ROOT . '/partnership/partnership_list.php?socid=' . $object->id;
302
+			$head[$h][0] = DOL_URL_ROOT.'/partnership/partnership_list.php?socid='.$object->id;
303 303
 			$head[$h][1] = $langs->trans("Partnerships");
304 304
 			$nbNote = 0;
305 305
 			$sql = "SELECT COUNT(n.rowid) as nb";
306
-			$sql .= " FROM " . MAIN_DB_PREFIX . "partnership as n";
307
-			$sql .= " WHERE fk_soc = " . ((int) $object->id);
308
-			$sql .= " AND entity IN (" . getEntity('partnership') . ")";
306
+			$sql .= " FROM ".MAIN_DB_PREFIX."partnership as n";
307
+			$sql .= " WHERE fk_soc = ".((int) $object->id);
308
+			$sql .= " AND entity IN (".getEntity('partnership').")";
309 309
 			$resql = $db->query($sql);
310 310
 			if ($resql) {
311 311
 				$obj = $db->fetch_object($resql);
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 				dol_print_error($db);
315 315
 			}
316 316
 			if ($nbNote > 0) {
317
-				$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
317
+				$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
318 318
 			}
319 319
 			$head[$h][2] = 'partnerships';
320 320
 			if ($nbPartnership > 0) {
321
-				$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbPartnership . '</span>';
321
+				$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbPartnership.'</span>';
322 322
 			}
323 323
 			$h++;
324 324
 		}
@@ -329,16 +329,16 @@  discard block
 block discarded – undo
329 329
 		//$langs->load('ticket');
330 330
 		$nbTicket = 0;
331 331
 		// Enable caching of thirdparty count notifications
332
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
333
-		$cachekey = 'count_ticket_thirdparty_' . $object->id;
332
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
333
+		$cachekey = 'count_ticket_thirdparty_'.$object->id;
334 334
 		$nbticketretreived = dol_getcache($cachekey);
335 335
 		if (!is_null($nbticketretreived)) {
336 336
 			$nbTicket = $nbticketretreived;
337 337
 		} else {
338 338
 			// List of notifications enabled for contacts of the third party
339 339
 			$sql = "SELECT COUNT(t.rowid) as nb";
340
-			$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
341
-			$sql .= " WHERE t.fk_soc = " . ((int) $object->id);
340
+			$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
341
+			$sql .= " WHERE t.fk_soc = ".((int) $object->id);
342 342
 			$resql = $db->query($sql);
343 343
 			if ($resql) {
344 344
 				$obj = $db->fetch_object($resql);
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
 			} else {
347 347
 				dol_print_error($db);
348 348
 			}
349
-			dol_setcache($cachekey, $nbTicket, 120);		// If setting cache fails, this is not a problem, so we do not test result.
349
+			dol_setcache($cachekey, $nbTicket, 120); // If setting cache fails, this is not a problem, so we do not test result.
350 350
 		}
351 351
 
352
-		$head[$h][0] = DOL_URL_ROOT . '/ticket/list.php?socid=' . urlencode((string) ($object->id));
352
+		$head[$h][0] = DOL_URL_ROOT.'/ticket/list.php?socid='.urlencode((string) ($object->id));
353 353
 		$head[$h][1] = $langs->trans("Tickets");
354 354
 		if ($nbTicket > 0) {
355
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbTicket . '</span>';
355
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbTicket.'</span>';
356 356
 		}
357 357
 		$head[$h][2] = 'ticket';
358 358
 		$h++;
@@ -371,20 +371,20 @@  discard block
 block discarded – undo
371 371
 			$langs->load('mails');
372 372
 			$nbNotif = 0;
373 373
 			// Enable caching of thirdparty count notifications
374
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
375
-			$cachekey = 'count_notifications_thirdparty_' . $object->id;
374
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
375
+			$cachekey = 'count_notifications_thirdparty_'.$object->id;
376 376
 			$dataretrieved = dol_getcache($cachekey);
377 377
 			if (!is_null($dataretrieved)) {
378 378
 				$nbNotif = $dataretrieved;
379 379
 			} else {
380 380
 				// List of notifications enabled for contacts of the third party
381 381
 				$sql = "SELECT COUNT(n.rowid) as nb";
382
-				$sql .= " FROM " . MAIN_DB_PREFIX . "c_action_trigger as a,";
383
-				$sql .= " " . MAIN_DB_PREFIX . "notify_def as n,";
384
-				$sql .= " " . MAIN_DB_PREFIX . "socpeople as c";
382
+				$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
383
+				$sql .= " ".MAIN_DB_PREFIX."notify_def as n,";
384
+				$sql .= " ".MAIN_DB_PREFIX."socpeople as c";
385 385
 				$sql .= " WHERE a.rowid = n.fk_action";
386 386
 				$sql .= " AND c.rowid = n.fk_contact";
387
-				$sql .= " AND c.fk_soc = " . ((int) $object->id);
387
+				$sql .= " AND c.fk_soc = ".((int) $object->id);
388 388
 				$resql = $db->query($sql);
389 389
 				if ($resql) {
390 390
 					$obj = $db->fetch_object($resql);
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 				} else {
393 393
 					dol_print_error($db);
394 394
 				}
395
-				dol_setcache($cachekey, $nbNotif, 120);		// If setting cache fails, this is not a problem, so we do not test result.
395
+				dol_setcache($cachekey, $nbNotif, 120); // If setting cache fails, this is not a problem, so we do not test result.
396 396
 			}
397 397
 
398
-			$head[$h][0] = DOL_URL_ROOT . '/societe/notify/card.php?socid=' . urlencode((string) ($object->id));
398
+			$head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.urlencode((string) ($object->id));
399 399
 			$head[$h][1] = $langs->trans("Notifications");
400 400
 			if ($nbNotif > 0) {
401
-				$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNotif . '</span>';
401
+				$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNotif.'</span>';
402 402
 			}
403 403
 			$head[$h][2] = 'notify';
404 404
 			$h++;
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 		if (!empty($object->note_public)) {
413 413
 			$nbNote++;
414 414
 		}
415
-		$head[$h][0] = DOL_URL_ROOT . '/societe/note.php?id=' . urlencode((string) ($object->id));
415
+		$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.urlencode((string) ($object->id));
416 416
 		$head[$h][1] = $langs->trans("Notes");
417 417
 		if ($nbNote > 0) {
418
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
418
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
419 419
 		}
420 420
 		$head[$h][2] = 'note';
421 421
 		$h++;
@@ -423,59 +423,59 @@  discard block
 block discarded – undo
423 423
 		// Attached files and Links
424 424
 		$totalAttached = 0;
425 425
 		// Enable caching of thirdrparty count attached files and links
426
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
427
-		$cachekey = 'count_attached_thirdparty_' . $object->id;
426
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
427
+		$cachekey = 'count_attached_thirdparty_'.$object->id;
428 428
 		$dataretrieved = dol_getcache($cachekey);
429 429
 		if (!is_null($dataretrieved)) {
430 430
 			$totalAttached = $dataretrieved;
431 431
 		} else {
432
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
433
-			require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
434
-			$upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/" . $object->id;
432
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
433
+			require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
434
+			$upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/".$object->id;
435 435
 			$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
436 436
 			$nbLinks = Link::count($db, $object->element, $object->id);
437 437
 			$totalAttached = $nbFiles + $nbLinks;
438
-			dol_setcache($cachekey, $totalAttached, 120);		// If setting cache fails, this is not a problem, so we do not test result.
438
+			dol_setcache($cachekey, $totalAttached, 120); // If setting cache fails, this is not a problem, so we do not test result.
439 439
 		}
440 440
 
441
-		$head[$h][0] = DOL_URL_ROOT . '/societe/document.php?socid=' . $object->id;
441
+		$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
442 442
 		$head[$h][1] = $langs->trans("Documents");
443 443
 		if (($totalAttached) > 0) {
444
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($totalAttached) . '</span>';
444
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($totalAttached).'</span>';
445 445
 		}
446 446
 		$head[$h][2] = 'document';
447 447
 		$h++;
448 448
 	}
449 449
 
450
-	$head[$h][0] = DOL_URL_ROOT . '/societe/messaging.php?socid=' . $object->id;
450
+	$head[$h][0] = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
451 451
 	$head[$h][1] = $langs->trans("Events");
452 452
 	if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
453 453
 		$nbEvent = 0;
454 454
 		// Enable caching of thirdparty count actioncomm
455
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
456
-		$cachekey = 'count_events_thirdparty_' . $object->id;
455
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
456
+		$cachekey = 'count_events_thirdparty_'.$object->id;
457 457
 		$dataretrieved = dol_getcache($cachekey);
458 458
 		if (!is_null($dataretrieved)) {
459 459
 			$nbEvent = $dataretrieved;
460 460
 		} else {
461 461
 			$sql = "SELECT COUNT(id) as nb";
462
-			$sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
463
-			$sql .= " WHERE fk_soc = " . ((int) $object->id);
464
-			$sql .= " AND entity IN (" . getEntity('agenda') . ")";
462
+			$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
463
+			$sql .= " WHERE fk_soc = ".((int) $object->id);
464
+			$sql .= " AND entity IN (".getEntity('agenda').")";
465 465
 			$resql = $db->query($sql);
466 466
 			if ($resql) {
467 467
 				$obj = $db->fetch_object($resql);
468 468
 				$nbEvent = $obj->nb;
469 469
 			} else {
470
-				dol_syslog('Failed to count actioncomm ' . $db->lasterror(), LOG_ERR);
470
+				dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
471 471
 			}
472
-			dol_setcache($cachekey, $nbEvent, 120);		// If setting cache fails, this is not a problem, so we do not test result.
472
+			dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
473 473
 		}
474 474
 
475 475
 		$head[$h][1] .= '/';
476 476
 		$head[$h][1] .= $langs->trans("Agenda");
477 477
 		if ($nbEvent > 0) {
478
-			$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>';
478
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
479 479
 		}
480 480
 	}
481 481
 	$head[$h][2] = 'agenda';
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 	$h = 0;
506 506
 	$head = array();
507 507
 
508
-	$head[$h][0] = DOL_URL_ROOT . '/societe/card.php?socid=' . $object->id;
508
+	$head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id;
509 509
 	$head[$h][1] = $langs->trans("ThirdParty");
510 510
 	$head[$h][2] = 'company';
511 511
 	$h++;
512 512
 
513
-	$head[$h][0] = 'commerciaux.php?socid=' . $object->id;
513
+	$head[$h][0] = 'commerciaux.php?socid='.$object->id;
514 514
 	$head[$h][1] = $langs->trans("SalesRepresentative");
515 515
 	$head[$h][2] = 'salesrepresentative';
516 516
 	$h++;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	$h = 0;
537 537
 	$head = array();
538 538
 
539
-	$head[$h][0] = DOL_URL_ROOT . '/societe/admin/societe.php';
539
+	$head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe.php';
540 540
 	$head[$h][1] = $langs->trans("Miscellaneous");
541 541
 	$head[$h][2] = 'general';
542 542
 	$h++;
@@ -547,26 +547,26 @@  discard block
 block discarded – undo
547 547
 	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
548 548
 	complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin');
549 549
 
550
-	$head[$h][0] = DOL_URL_ROOT . '/societe/admin/societe_extrafields.php';
550
+	$head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php';
551 551
 	$head[$h][1] = $langs->trans("ExtraFieldsThirdParties");
552 552
 	$nbExtrafields = $extrafields->attributes['societe']['count'];
553 553
 	if ($nbExtrafields > 0) {
554
-		$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
554
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
555 555
 	}
556 556
 	$head[$h][2] = 'attributes';
557 557
 	$h++;
558 558
 
559
-	$head[$h][0] = DOL_URL_ROOT . '/societe/admin/contact_extrafields.php';
559
+	$head[$h][0] = DOL_URL_ROOT.'/societe/admin/contact_extrafields.php';
560 560
 	$head[$h][1] = $langs->trans("ExtraFieldsContacts");
561 561
 	$nbExtrafields = $extrafields->attributes['socpeople']['count'];
562 562
 	if ($nbExtrafields > 0) {
563
-		$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
563
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
564 564
 	}
565 565
 	$head[$h][2] = 'attributes_contacts';
566 566
 	$h++;
567 567
 
568 568
 	if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) {
569
-		$head[$h][0] = DOL_URL_ROOT . '/societe/admin/public_interface.php';
569
+		$head[$h][0] = DOL_URL_ROOT.'/societe/admin/public_interface.php';
570 570
 		$head[$h][1] = $langs->trans("PublicUrl");
571 571
 		$head[$h][2] = 'publicurl';
572 572
 		$h++;
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 		$outputlangs = $langs;
616 616
 	}
617 617
 
618
-	$sql = "SELECT rowid, code, label FROM " . MAIN_DB_PREFIX . "c_country";
618
+	$sql = "SELECT rowid, code, label FROM ".MAIN_DB_PREFIX."c_country";
619 619
 	if (is_numeric($searchkey)) {
620
-		$sql .= " WHERE rowid = " . ((int) $searchkey);
620
+		$sql .= " WHERE rowid = ".((int) $searchkey);
621 621
 	} elseif (!empty($searchkey)) {
622
-		$sql .= " WHERE code = '" . $db->escape($searchkey) . "'";
622
+		$sql .= " WHERE code = '".$db->escape($searchkey)."'";
623 623
 	} else {
624
-		$sql .= " WHERE label = '" . $db->escape($searchlabel) . "'";
624
+		$sql .= " WHERE label = '".$db->escape($searchlabel)."'";
625 625
 	}
626 626
 
627 627
 	$resql = $dbtouse->query($sql);
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 			if (is_object($outputlangs)) {
633 633
 				$outputlangs->load("dict");
634 634
 				if ($entconv) {
635
-					$label = ($obj->code && ($outputlangs->trans("Country" . $obj->code) != "Country" . $obj->code)) ? $outputlangs->trans("Country" . $obj->code) : $label;
635
+					$label = ($obj->code && ($outputlangs->trans("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->trans("Country".$obj->code) : $label;
636 636
 				} else {
637
-					$label = ($obj->code && ($outputlangs->transnoentitiesnoconv("Country" . $obj->code) != "Country" . $obj->code)) ? $outputlangs->transnoentitiesnoconv("Country" . $obj->code) : $label;
637
+					$label = ($obj->code && ($outputlangs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->transnoentitiesnoconv("Country".$obj->code) : $label;
638 638
 				}
639 639
 			}
640 640
 			if ($withcode == '1') {
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	}
684 684
 
685 685
 	$sql = "SELECT d.rowid as id, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.code_region as region_code, r.nom as region_name FROM";
686
-	$sql .= " " . MAIN_DB_PREFIX . "c_departements as d, " . MAIN_DB_PREFIX . "c_regions as r," . MAIN_DB_PREFIX . "c_country as c";
687
-	$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and d.rowid=" . ((int) $id);
686
+	$sql .= " ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
687
+	$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and d.rowid=".((int) $id);
688 688
 	$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
689 689
 	$sql .= " ORDER BY c.code, d.code_departement";
690 690
 
@@ -697,21 +697,21 @@  discard block
 block discarded – undo
697 697
 			if (is_object($outputlangs)) {
698 698
 				$outputlangs->load("dict");
699 699
 				if ($entconv) {
700
-					$label = ($obj->code && ($outputlangs->trans("State" . $obj->code) != "State" . $obj->code)) ? $outputlangs->trans("State" . $obj->code) : $label;
700
+					$label = ($obj->code && ($outputlangs->trans("State".$obj->code) != "State".$obj->code)) ? $outputlangs->trans("State".$obj->code) : $label;
701 701
 				} else {
702
-					$label = ($obj->code && ($outputlangs->transnoentitiesnoconv("State" . $obj->code) != "State" . $obj->code)) ? $outputlangs->transnoentitiesnoconv("State" . $obj->code) : $label;
702
+					$label = ($obj->code && ($outputlangs->transnoentitiesnoconv("State".$obj->code) != "State".$obj->code)) ? $outputlangs->transnoentitiesnoconv("State".$obj->code) : $label;
703 703
 				}
704 704
 			}
705 705
 
706 706
 			if ($withcode == 1) {
707 707
 				if ($withregion == 1) {
708
-					return $label = $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
708
+					return $label = $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
709 709
 				} else {
710
-					return $label = $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
710
+					return $label = $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
711 711
 				}
712 712
 			} elseif ($withcode == 2) {
713 713
 				if ($withregion == 1) {
714
-					return $label = $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
714
+					return $label = $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
715 715
 				} else {
716 716
 					return $label = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
717 717
 				}
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 				}
724 724
 			} else {
725 725
 				if ($withregion == 1) {
726
-					return $label = $obj->region_name . ' - ' . $label;
726
+					return $label = $obj->region_name.' - '.$label;
727 727
 				} else {
728 728
 					return $label;
729 729
 				}
@@ -757,13 +757,13 @@  discard block
 block discarded – undo
757 757
 	$outputlangs->load("dict");
758 758
 
759 759
 	// If there is a translation, we can send immediately the label
760
-	if ($outputlangs->trans("Currency" . $code_iso) != "Currency" . $code_iso) {
761
-		return ($withcode ? $code_iso . ' - ' : '') . $outputlangs->trans("Currency" . $code_iso);
760
+	if ($outputlangs->trans("Currency".$code_iso) != "Currency".$code_iso) {
761
+		return ($withcode ? $code_iso.' - ' : '').$outputlangs->trans("Currency".$code_iso);
762 762
 	}
763 763
 
764 764
 	// If no translation, we read table to get label by default
765
-	$sql = "SELECT label FROM " . MAIN_DB_PREFIX . "c_currencies";
766
-	$sql .= " WHERE code_iso='" . $db->escape($code_iso) . "'";
765
+	$sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
766
+	$sql .= " WHERE code_iso='".$db->escape($code_iso)."'";
767 767
 
768 768
 	$resql = $db->query($sql);
769 769
 	if ($resql) {
@@ -799,12 +799,12 @@  discard block
 block discarded – undo
799 799
 		return '';
800 800
 	}
801 801
 
802
-	if (!empty($conf->cache["legalform_" . $langs->defaultlang . '_' . $code])) {
803
-		return $conf->cache["legalform_" . $langs->defaultlang . '_' . $code];
802
+	if (!empty($conf->cache["legalform_".$langs->defaultlang.'_'.$code])) {
803
+		return $conf->cache["legalform_".$langs->defaultlang.'_'.$code];
804 804
 	}
805 805
 
806
-	$sql = "SELECT libelle as label FROM " . MAIN_DB_PREFIX . "c_forme_juridique";
807
-	$sql .= " WHERE code = '" . $db->escape($code) . "'";
806
+	$sql = "SELECT libelle as label FROM ".MAIN_DB_PREFIX."c_forme_juridique";
807
+	$sql .= " WHERE code = '".$db->escape($code)."'";
808 808
 
809 809
 	dol_syslog("Company.lib::getFormeJuridiqueLabel", LOG_DEBUG);
810 810
 
@@ -816,14 +816,14 @@  discard block
 block discarded – undo
816 816
 
817 817
 			$label = ($obj->label != '-' ? $obj->label : '');
818 818
 
819
-			$conf->cache["legalform_" . $langs->defaultlang . '_' . $code] = $label;
819
+			$conf->cache["legalform_".$langs->defaultlang.'_'.$code] = $label;
820 820
 
821 821
 			return $langs->trans($label);
822 822
 		} else {
823 823
 			return $langs->trans("NotDefined");
824 824
 		}
825 825
 	} else {
826
-		return 'Error ' . $db->lasterror();
826
+		return 'Error '.$db->lasterror();
827 827
 	}
828 828
 }
829 829
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		// Use of cache to reduce number of database requests
846 846
 		$country_code_in_EEC = $conf->cache['country_code_in_EEC'];
847 847
 	} else {
848
-		$sql = "SELECT cc.code FROM " . MAIN_DB_PREFIX . "c_country as cc";
848
+		$sql = "SELECT cc.code FROM ".MAIN_DB_PREFIX."c_country as cc";
849 849
 		$sql .= " WHERE cc.eec = 1";
850 850
 
851 851
 		$resql = $db->query($sql);
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 		return false;
878 878
 	}
879 879
 
880
-	$country_code_in_EEC = getCountriesInEEC();		// This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
880
+	$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
881 881
 
882 882
 	//print "dd".$object->country_code;
883 883
 	return in_array($object->country_code, $country_code_in_EEC);
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 		// Use of cache to reduce number of database requests
901 901
 		$country_code_in_SEPA = $conf->cache['country_code_in_SEPA'];
902 902
 	} else {
903
-		$sql = "SELECT cc.code FROM " . MAIN_DB_PREFIX . "c_country as cc";
903
+		$sql = "SELECT cc.code FROM ".MAIN_DB_PREFIX."c_country as cc";
904 904
 		$sql .= " WHERE cc.sepa = 1";
905 905
 
906 906
 		$resql = $db->query($sql);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		return false;
933 933
 	}
934 934
 
935
-	$country_code_in_SEPA = getCountriesInSEPA();		// This make a database call but there is a cache done into $conf->cache['country_code_in_SEPA']
935
+	$country_code_in_SEPA = getCountriesInSEPA(); // This make a database call but there is a cache done into $conf->cache['country_code_in_SEPA']
936 936
 
937 937
 	//print "dd".$object->country_code;
938 938
 	return in_array($object->country_code, $country_code_in_SEPA);
@@ -962,21 +962,21 @@  discard block
 block discarded – undo
962 962
 
963 963
 		$newcardbutton = '';
964 964
 		if ($user->hasRight('projet', 'creer') && empty($nocreatelink)) {
965
-			$newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/projet/card.php?socid=' . $object->id . '&action=create&backtopage=' . urlencode($backtopage));
965
+			$newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
966 966
 		}
967 967
 
968 968
 		print "\n";
969
-		print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $newcardbutton . $morehtmlright, '');
969
+		print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $newcardbutton.$morehtmlright, '');
970 970
 
971
-		print '<div class="div-table-responsive">' . "\n";
971
+		print '<div class="div-table-responsive">'."\n";
972 972
 		print '<table class="noborder centpercent">';
973 973
 
974 974
 		$sql  = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_modification, p.budget_amount";
975 975
 		$sql .= ", cls.code as opp_status_code";
976
-		$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
977
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_lead_status as cls on p.fk_opp_status = cls.rowid";
978
-		$sql .= " WHERE p.fk_soc = " . ((int) $object->id);
979
-		$sql .= " AND p.entity IN (" . getEntity('project') . ")";
976
+		$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
977
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
978
+		$sql .= " WHERE p.fk_soc = ".((int) $object->id);
979
+		$sql .= " AND p.entity IN (".getEntity('project').")";
980 980
 		$sql .= " ORDER BY p.dateo DESC";
981 981
 
982 982
 		$result = $db->query($sql);
@@ -990,14 +990,14 @@  discard block
 block discarded – undo
990 990
 				print $selectedfields;
991 991
 				print '</td>';
992 992
 			}
993
-			print '<td>' . $langs->trans("Ref") . '</td>';
994
-			print '<td>' . $langs->trans("Name") . '</td>';
995
-			print '<td class="center">' . $langs->trans("DateStart") . '</td>';
996
-			print '<td class="center">' . $langs->trans("DateEnd") . '</td>';
997
-			print '<td class="right">' . $langs->trans("OpportunityAmountShort") . '</td>';
998
-			print '<td class="center">' . $langs->trans("OpportunityStatusShort") . '</td>';
999
-			print '<td class="right">' . $langs->trans("OpportunityProbabilityShort") . '</td>';
1000
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
993
+			print '<td>'.$langs->trans("Ref").'</td>';
994
+			print '<td>'.$langs->trans("Name").'</td>';
995
+			print '<td class="center">'.$langs->trans("DateStart").'</td>';
996
+			print '<td class="center">'.$langs->trans("DateEnd").'</td>';
997
+			print '<td class="right">'.$langs->trans("OpportunityAmountShort").'</td>';
998
+			print '<td class="center">'.$langs->trans("OpportunityStatusShort").'</td>';
999
+			print '<td class="right">'.$langs->trans("OpportunityProbabilityShort").'</td>';
1000
+			print '<td class="right">'.$langs->trans("Status").'</td>';
1001 1001
 			if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1002 1002
 				print '<td class="center">';
1003 1003
 				$selectedfields = (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			print '</tr>';
1008 1008
 
1009 1009
 			if ($num > 0) {
1010
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
1010
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
1011 1011
 
1012 1012
 				$projecttmp = new Project($db);
1013 1013
 
@@ -1030,41 +1030,41 @@  discard block
 block discarded – undo
1030 1030
 								if (in_array($obj->id, $arrayofselected)) {
1031 1031
 									$selected = 1;
1032 1032
 								}
1033
-								print '<input id="cb' . $obj->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
1033
+								print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1034 1034
 							}
1035 1035
 							print '</td>';
1036 1036
 						}
1037 1037
 						// Ref
1038 1038
 						print '<td class="nowraponall">';
1039
-						print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:' . $_SERVER["PHP_SELF"] . '?socid=__SOCID__');
1039
+						print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:'.$_SERVER["PHP_SELF"].'?socid=__SOCID__');
1040 1040
 						print '</td>';
1041 1041
 
1042 1042
 						// Label
1043
-						print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($obj->title) . '">' . dol_escape_htmltag($obj->title) . '</td>';
1043
+						print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
1044 1044
 						// Date start
1045
-						print '<td class="center">' . dol_print_date($db->jdate($obj->do), "day") . '</td>';
1045
+						print '<td class="center">'.dol_print_date($db->jdate($obj->do), "day").'</td>';
1046 1046
 						// Date end
1047
-						print '<td class="center">' . dol_print_date($db->jdate($obj->de), "day") . '</td>';
1047
+						print '<td class="center">'.dol_print_date($db->jdate($obj->de), "day").'</td>';
1048 1048
 						// Opp amount
1049 1049
 						print '<td class="right">';
1050 1050
 						if ($obj->opp_status_code) {
1051
-							print '<span class="amount">' . price($obj->opp_amount, 1, '', 1, -1, -1, '') . '</span>';
1051
+							print '<span class="amount">'.price($obj->opp_amount, 1, '', 1, -1, -1, '').'</span>';
1052 1052
 						}
1053 1053
 						print '</td>';
1054 1054
 						// Opp status
1055 1055
 						print '<td class="center">';
1056 1056
 						if ($obj->opp_status_code) {
1057
-							print $langs->trans("OppStatus" . $obj->opp_status_code);
1057
+							print $langs->trans("OppStatus".$obj->opp_status_code);
1058 1058
 						}
1059 1059
 						print '</td>';
1060 1060
 						// Opp percent
1061 1061
 						print '<td class="right">';
1062 1062
 						if ($obj->opp_percent) {
1063
-							print price($obj->opp_percent, 1, '', 1, 0) . '%';
1063
+							print price($obj->opp_percent, 1, '', 1, 0).'%';
1064 1064
 						}
1065 1065
 						print '</td>';
1066 1066
 						// Status
1067
-						print '<td class="right">' . $projecttmp->getLibStatut(5) . '</td>';
1067
+						print '<td class="right">'.$projecttmp->getLibStatut(5).'</td>';
1068 1068
 
1069 1069
 						// Action column
1070 1070
 						if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 								if (in_array($obj->id, $arrayofselected)) {
1075 1075
 									$selected = 1;
1076 1076
 								}
1077
-								print '<input id="cb' . $obj->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
1077
+								print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
1078 1078
 							}
1079 1079
 							print '</td>';
1080 1080
 						}
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 					$i++;
1084 1084
 				}
1085 1085
 			} else {
1086
-				print '<tr class="oddeven"><td colspan="9"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
1086
+				print '<tr class="oddeven"><td colspan="9"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
1087 1087
 			}
1088 1088
 			$db->free($result);
1089 1089
 		} else {
@@ -1096,18 +1096,18 @@  discard block
 block discarded – undo
1096 1096
 			print load_fiche_titre($langs->trans("ProjectsLinkedToThisThirdParty"), '', '');
1097 1097
 
1098 1098
 
1099
-			print '<div class="div-table-responsive">' . "\n";
1099
+			print '<div class="div-table-responsive">'."\n";
1100 1100
 			print '<table class="noborder centpercent">';
1101 1101
 
1102 1102
 			$sql  = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
1103 1103
 			$sql .= ", cls.code as opp_status_code";
1104
-			$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
1105
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_lead_status as cls on p.fk_opp_status = cls.rowid";
1106
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec on p.rowid = ec.element_id";
1107
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sc on ec.fk_socpeople = sc.rowid";
1108
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc on ec.fk_c_type_contact = tc.rowid";
1109
-			$sql .= " WHERE sc.fk_soc = " . ((int) $object->id);
1110
-			$sql .= " AND p.entity IN (" . getEntity('project') . ")";
1104
+			$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
1105
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid";
1106
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec on p.rowid = ec.element_id";
1107
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sc on ec.fk_socpeople = sc.rowid";
1108
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid";
1109
+			$sql .= " WHERE sc.fk_soc = ".((int) $object->id);
1110
+			$sql .= " AND p.entity IN (".getEntity('project').")";
1111 1111
 			$sql .= " AND tc.element = 'project' AND tc.source = 'external'";
1112 1112
 			$sql .= " ORDER BY p.dateo DESC";
1113 1113
 
@@ -1116,18 +1116,18 @@  discard block
 block discarded – undo
1116 1116
 				$num = $db->num_rows($result);
1117 1117
 
1118 1118
 				print '<tr class="liste_titre">';
1119
-				print '<td>' . $langs->trans("Ref") . '</td>';
1120
-				print '<td>' . $langs->trans("Name") . '</td>';
1121
-				print '<td class="center">' . $langs->trans("DateStart") . '</td>';
1122
-				print '<td class="center">' . $langs->trans("DateEnd") . '</td>';
1123
-				print '<td class="right">' . $langs->trans("OpportunityAmountShort") . '</td>';
1124
-				print '<td class="center">' . $langs->trans("OpportunityStatusShort") . '</td>';
1125
-				print '<td class="right">' . $langs->trans("OpportunityProbabilityShort") . '</td>';
1126
-				print '<td class="right">' . $langs->trans("Status") . '</td>';
1119
+				print '<td>'.$langs->trans("Ref").'</td>';
1120
+				print '<td>'.$langs->trans("Name").'</td>';
1121
+				print '<td class="center">'.$langs->trans("DateStart").'</td>';
1122
+				print '<td class="center">'.$langs->trans("DateEnd").'</td>';
1123
+				print '<td class="right">'.$langs->trans("OpportunityAmountShort").'</td>';
1124
+				print '<td class="center">'.$langs->trans("OpportunityStatusShort").'</td>';
1125
+				print '<td class="right">'.$langs->trans("OpportunityProbabilityShort").'</td>';
1126
+				print '<td class="right">'.$langs->trans("Status").'</td>';
1127 1127
 				print '</tr>';
1128 1128
 
1129 1129
 				if ($num > 0) {
1130
-					require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
1130
+					require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
1131 1131
 
1132 1132
 					$projecttmp = new Project($db);
1133 1133
 
@@ -1145,42 +1145,42 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 							// Ref
1147 1147
 							print '<td class="nowraponall">';
1148
-							print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:' . $_SERVER["PHP_SELF"] . '?socid=__SOCID__');
1148
+							print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:'.$_SERVER["PHP_SELF"].'?socid=__SOCID__');
1149 1149
 							print '</td>';
1150 1150
 
1151 1151
 							// Label
1152
-							print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($obj->title) . '">' . dol_escape_htmltag($obj->title) . '</td>';
1152
+							print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
1153 1153
 							// Date start
1154
-							print '<td class="center">' . dol_print_date($db->jdate($obj->do), "day") . '</td>';
1154
+							print '<td class="center">'.dol_print_date($db->jdate($obj->do), "day").'</td>';
1155 1155
 							// Date end
1156
-							print '<td class="center">' . dol_print_date($db->jdate($obj->de), "day") . '</td>';
1156
+							print '<td class="center">'.dol_print_date($db->jdate($obj->de), "day").'</td>';
1157 1157
 							// Opp amount
1158 1158
 							print '<td class="right">';
1159 1159
 							if ($obj->opp_status_code) {
1160
-								print '<span class="amount">' . price($obj->opp_amount, 1, '', 1, -1, -1, '') . '</span>';
1160
+								print '<span class="amount">'.price($obj->opp_amount, 1, '', 1, -1, -1, '').'</span>';
1161 1161
 							}
1162 1162
 							print '</td>';
1163 1163
 							// Opp status
1164 1164
 							print '<td class="center">';
1165 1165
 							if ($obj->opp_status_code) {
1166
-								print $langs->trans("OppStatus" . $obj->opp_status_code);
1166
+								print $langs->trans("OppStatus".$obj->opp_status_code);
1167 1167
 							}
1168 1168
 							print '</td>';
1169 1169
 							// Opp percent
1170 1170
 							print '<td class="right">';
1171 1171
 							if ($obj->opp_percent) {
1172
-								print price($obj->opp_percent, 1, '', 1, 0) . '%';
1172
+								print price($obj->opp_percent, 1, '', 1, 0).'%';
1173 1173
 							}
1174 1174
 							print '</td>';
1175 1175
 							// Status
1176
-							print '<td class="right">' . $projecttmp->getLibStatut(5) . '</td>';
1176
+							print '<td class="right">'.$projecttmp->getLibStatut(5).'</td>';
1177 1177
 
1178 1178
 							print '</tr>';
1179 1179
 						}
1180 1180
 						$i++;
1181 1181
 					}
1182 1182
 				} else {
1183
-					print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
1183
+					print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
1184 1184
 				}
1185 1185
 				$db->free($result);
1186 1186
 			} else {
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 	global $user, $extrafields, $hookmanager;
1219 1219
 	global $contextpage;
1220 1220
 
1221
-	require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
1221
+	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
1222 1222
 	$formcompany = new FormCompany($db);
1223 1223
 	$form = new Form($db);
1224 1224
 
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
 		't.rowid' => array('label' => "TechnicalID", 'checked' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? '1' : '0'), 'enabled' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? '1' : '0'), 'position' => 1),
1304 1304
 		't.name' => array('label' => "Name", 'checked' => '1', 'position' => 10),
1305 1305
 		't.poste' => array('label' => "PostOrFunction", 'checked' => '1', 'position' => 20),
1306
-		't.address' => array('label' => (empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address") . ' / ' . $langs->trans("Phone") . ' / ' . $langs->trans("Email") : $langs->trans("Address")), 'checked' => '1', 'position' => 30),
1306
+		't.address' => array('label' => (empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked' => '1', 'position' => 30),
1307 1307
 		't.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 35),
1308 1308
 		'sc.role' => array('label' => "ContactByDefaultFor", 'checked' => '1', 'position' => 40),
1309 1309
 		't.birthday' => array('label' => "Birthday", 'checked' => '0', 'position' => 45),
@@ -1314,12 +1314,12 @@  discard block
 block discarded – undo
1314 1314
 	$extrafieldsobjectkey = $contactstatic->table_element;
1315 1315
 	$extrafieldsobjectprefix = 'ef.';
1316 1316
 	$extrafieldspositionoffset = 1000;
1317
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
1317
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
1318 1318
 
1319 1319
 	// Initialize array of search criteria
1320 1320
 	$search = array();
1321 1321
 	foreach ($arrayfields as $key => $val) {
1322
-		$queryName = 'search_' . substr($key, 2);
1322
+		$queryName = 'search_'.substr($key, 2);
1323 1323
 		if (GETPOST($queryName, 'alpha')) {
1324 1324
 			$search[substr($key, 2)] = GETPOST($queryName, 'alpha');
1325 1325
 		}
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	if (empty($reshook)) {
1355 1355
 		if ($user->hasRight('societe', 'contact', 'creer')) {
1356 1356
 			$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
1357
-			$newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT . '/contact/card.php?socid=' . $object->id . '&action=create&backtopage=' . urlencode($backtopage));
1357
+			$newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
1358 1358
 		}
1359 1359
 	} else {
1360 1360
 		$newcardbutton = $hookmanager->resPrint;
@@ -1365,75 +1365,75 @@  discard block
 block discarded – undo
1365 1365
 	$title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany"));
1366 1366
 	print load_fiche_titre($title, $newcardbutton, 'contact');
1367 1367
 
1368
-	print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '" name="formfilter">';
1369
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
1368
+	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
1369
+	print '<input type="hidden" name="token" value="'.newToken().'">';
1370 1370
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1371
-	print '<input type="hidden" name="socid" value="' . $object->id . '">';
1372
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
1373
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
1374
-	print '<input type="hidden" name="page" value="' . $page . '">';
1371
+	print '<input type="hidden" name="socid" value="'.$object->id.'">';
1372
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1373
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1374
+	print '<input type="hidden" name="page" value="'.$page.'">';
1375 1375
 
1376 1376
 	$arrayofmassactions = array();
1377 1377
 	$mode = 'view';
1378 1378
 
1379 1379
 	$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1380
-	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
1380
+	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1381 1381
 	$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1382 1382
 	$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1383 1383
 
1384 1384
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
1385
-	print "\n" . '<table class="tagtable liste noborder">' . "\n";
1385
+	print "\n".'<table class="tagtable liste noborder">'."\n";
1386 1386
 
1387
-	$param = "socid=" . urlencode((string) ($object->id));
1387
+	$param = "socid=".urlencode((string) ($object->id));
1388 1388
 	if ($search_rowid != '') {
1389
-		$param .= '&search_rowid=' . urlencode((string) ($search_rowid));
1389
+		$param .= '&search_rowid='.urlencode((string) ($search_rowid));
1390 1390
 	}
1391 1391
 	if ($search_status != '') {
1392
-		$param .= '&search_status=' . urlencode((string) ($search_status));
1392
+		$param .= '&search_status='.urlencode((string) ($search_status));
1393 1393
 	}
1394 1394
 	if (count($search_roles) > 0) {
1395 1395
 		$param .= implode('&search_roles[]=', $search_roles);
1396 1396
 	}
1397 1397
 	if ($search_name != '') {
1398
-		$param .= '&search_name=' . urlencode($search_name);
1398
+		$param .= '&search_name='.urlencode($search_name);
1399 1399
 	}
1400 1400
 	if ($search_poste != '') {
1401
-		$param .= '&search_poste=' . urlencode($search_poste);
1401
+		$param .= '&search_poste='.urlencode($search_poste);
1402 1402
 	}
1403 1403
 	if ($search_address != '') {
1404
-		$param .= '&search_address=' . urlencode($search_address);
1404
+		$param .= '&search_address='.urlencode($search_address);
1405 1405
 	}
1406 1406
 	if ($search_note_private != '') {
1407
-		$param .= '&search_note_private=' . urlencode($search_note_private);
1407
+		$param .= '&search_note_private='.urlencode($search_note_private);
1408 1408
 	}
1409 1409
 	if ($search_birthday_dtstart != '') {
1410
-		$param .= '&search_birthday_dtstart=' . urlencode((string) $search_birthday_dtstart);
1410
+		$param .= '&search_birthday_dtstart='.urlencode((string) $search_birthday_dtstart);
1411 1411
 	}
1412 1412
 	if ($search_birthday_dtend != '') {
1413
-		$param .= '&search_birthday_dtend=' . urlencode((string) $search_birthday_dtend);
1413
+		$param .= '&search_birthday_dtend='.urlencode((string) $search_birthday_dtend);
1414 1414
 	}
1415 1415
 	if ($optioncss != '') {
1416
-		$param .= '&optioncss=' . urlencode($optioncss);
1416
+		$param .= '&optioncss='.urlencode($optioncss);
1417 1417
 	}
1418 1418
 
1419 1419
 	// Add $param from extra fields
1420 1420
 	$extrafieldsobjectkey = $contactstatic->table_element;
1421
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
1421
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1422 1422
 
1423 1423
 	$sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste,";
1424 1424
 	$sql .= " t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo, t.fk_soc,";
1425 1425
 	$sql .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday,";
1426 1426
 	$sql .= " t.note_private";
1427
-	$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
1428
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
1429
-	$sql .= " WHERE t.fk_soc = " . ((int) $object->id);
1430
-	$sql .= " AND t.entity IN (" . getEntity('socpeople') . ")";
1431
-	$sql .= " AND ((t.fk_user_creat = " . ((int) $user->id) . " AND t.priv = 1) OR t.priv = 0)";
1427
+	$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
1428
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
1429
+	$sql .= " WHERE t.fk_soc = ".((int) $object->id);
1430
+	$sql .= " AND t.entity IN (".getEntity('socpeople').")";
1431
+	$sql .= " AND ((t.fk_user_creat = ".((int) $user->id)." AND t.priv = 1) OR t.priv = 0)";
1432 1432
 	if ($search_rowid) {
1433 1433
 		$sql .= natural_search('t.rowid', $search_rowid);
1434 1434
 	}
1435 1435
 	if ($search_status != '' && $search_status != '-1') {
1436
-		$sql .= " AND t.statut = " . ((int) $search_status);
1436
+		$sql .= " AND t.statut = ".((int) $search_status);
1437 1437
 	}
1438 1438
 	if ($search_name) {
1439 1439
 		$sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
@@ -1448,17 +1448,17 @@  discard block
 block discarded – undo
1448 1448
 		$sql .= natural_search('t.note_private', $search_note_private);
1449 1449
 	}
1450 1450
 	if ($search_birthday_dtstart != '') {
1451
-		$sql .= " AND t.birthday >= '" . $db->idate($search_birthday_dtstart) . "'";
1451
+		$sql .= " AND t.birthday >= '".$db->idate($search_birthday_dtstart)."'";
1452 1452
 	}
1453 1453
 	if ($search_birthday_dtend != '') {
1454
-		$sql .= " AND t.birthday <= '" . $db->idate($search_birthday_dtend) . "'";
1454
+		$sql .= " AND t.birthday <= '".$db->idate($search_birthday_dtend)."'";
1455 1455
 	}
1456 1456
 	if (count($search_roles) > 0) {
1457
-		$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM " . MAIN_DB_PREFIX . "societe_contacts as sc WHERE sc.fk_c_type_contact IN (" . $db->sanitize(implode(',', $search_roles)) . "))";
1457
+		$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
1458 1458
 	}
1459 1459
 	// Add where from extra fields
1460 1460
 	$extrafieldsobjectkey = $contactstatic->table_element;
1461
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
1461
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
1462 1462
 	// Add where from hooks
1463 1463
 	$parameters = array('socid' => $object->id);
1464 1464
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1489,16 +1489,16 @@  discard block
 block discarded – undo
1489 1489
 	foreach ($contactstatic->fields as $key => $val) {
1490 1490
 		$align = '';
1491 1491
 		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1492
-			$align .= ($align ? ' ' : '') . 'center';
1492
+			$align .= ($align ? ' ' : '').'center';
1493 1493
 		}
1494 1494
 		if (in_array($val['type'], array('timestamp'))) {
1495
-			$align .= ($align ? ' ' : '') . 'nowrap';
1495
+			$align .= ($align ? ' ' : '').'nowrap';
1496 1496
 		}
1497 1497
 		if ($key == 'status' || $key == 'statut') {
1498
-			$align .= ($align ? ' ' : '') . 'center';
1498
+			$align .= ($align ? ' ' : '').'center';
1499 1499
 		}
1500
-		if (!empty($arrayfields['t.' . $key]['checked']) || !empty($arrayfields['sc.' . $key]['checked'])) {
1501
-			print '<td class="liste_titre' . ($align ? ' ' . $align : '') . '">';
1500
+		if (!empty($arrayfields['t.'.$key]['checked']) || !empty($arrayfields['sc.'.$key]['checked'])) {
1501
+			print '<td class="liste_titre'.($align ? ' '.$align : '').'">';
1502 1502
 			if (in_array($key, array('statut'))) {
1503 1503
 				print $form->selectarray('search_status', array('-1' => '', '0' => $contactstatic->LibStatut(0, 1), '1' => $contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
1504 1504
 			} elseif (in_array($key, array('role'))) {
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 				print $form->selectDate($search_birthday_dtend ? $search_birthday_dtend : '', "search_birthday_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1512 1512
 				print '</div>';
1513 1513
 			} else {
1514
-				print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . (!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '') . '">';
1514
+				print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
1515 1515
 			}
1516 1516
 			print '</td>';
1517 1517
 		}
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 	}
1522 1522
 	// Extra fields
1523 1523
 	$extrafieldsobjectkey = $contactstatic->table_element;
1524
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
1524
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1525 1525
 
1526 1526
 	// Fields from hook
1527 1527
 	$parameters = array('arrayfields' => $arrayfields);
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 		print $form->showFilterButtons();
1534 1534
 		print '</td>';
1535 1535
 	}
1536
-	print '</tr>' . "\n";
1536
+	print '</tr>'."\n";
1537 1537
 
1538 1538
 
1539 1539
 	// Fields title label
@@ -1541,44 +1541,44 @@  discard block
 block discarded – undo
1541 1541
 	print '<tr class="liste_titre">';
1542 1542
 	// Action column
1543 1543
 	if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1544
-		print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ') . "\n";
1544
+		print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n";
1545 1545
 	}
1546 1546
 	foreach ($contactstatic->fields as $key => $val) {
1547 1547
 		$align = '';
1548 1548
 		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1549
-			$align .= ($align ? ' ' : '') . 'center';
1549
+			$align .= ($align ? ' ' : '').'center';
1550 1550
 		}
1551 1551
 		if (in_array($val['type'], array('timestamp'))) {
1552
-			$align .= ($align ? ' ' : '') . 'nowrap';
1552
+			$align .= ($align ? ' ' : '').'nowrap';
1553 1553
 		}
1554 1554
 		if ($key == 'status' || $key == 'statut') {
1555
-			$align .= ($align ? ' ' : '') . 'center';
1555
+			$align .= ($align ? ' ' : '').'center';
1556 1556
 		}
1557
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
1558
-			print getTitleFieldOfList($val['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($align ? 'class="' . $align . '"' : ''), $sortfield, $sortorder, $align . ' ') . "\n";
1557
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
1558
+			print getTitleFieldOfList($val['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
1559 1559
 		}
1560 1560
 		if ($key == 'role') {
1561
-			$align .= ($align ? ' ' : '') . 'left';
1561
+			$align .= ($align ? ' ' : '').'left';
1562 1562
 		}
1563
-		if (!empty($arrayfields['sc.' . $key]['checked'])) {
1564
-			print getTitleFieldOfList($arrayfields['sc.' . $key]['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, ($align ? 'class="' . $align . '"' : ''), $sortfield, $sortorder, $align . ' ') . "\n";
1563
+		if (!empty($arrayfields['sc.'.$key]['checked'])) {
1564
+			print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
1565 1565
 		}
1566 1566
 	}
1567 1567
 	if ($showuserlogin) {
1568
-		print '<th class="wrapcolumntitle liste_titre">' . $langs->trans("DolibarrLogin") . '</th>';
1568
+		print '<th class="wrapcolumntitle liste_titre">'.$langs->trans("DolibarrLogin").'</th>';
1569 1569
 	}
1570 1570
 	// Extra fields
1571 1571
 	$extrafieldsobjectkey = $contactstatic->table_element;
1572
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
1572
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1573 1573
 	// Hook fields
1574 1574
 	$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
1575 1575
 	$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1576 1576
 	print $hookmanager->resPrint;
1577 1577
 	// Action column
1578 1578
 	if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1579
-		print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ') . "\n";
1579
+		print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n";
1580 1580
 	}
1581
-	print '</tr>' . "\n";
1581
+	print '</tr>'."\n";
1582 1582
 
1583 1583
 	$i = -1;
1584 1584
 
@@ -1634,21 +1634,21 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
 				// Add to agenda
1636 1636
 				if (isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) {
1637
-					print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&actioncode=&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
1637
+					print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
1638 1638
 					print img_object($langs->trans("Event"), "action");
1639 1639
 					print '</a> &nbsp; ';
1640 1640
 				}
1641 1641
 
1642 1642
 				// Edit
1643 1643
 				if ($user->hasRight('societe', 'contact', 'creer')) {
1644
-					print '<a class="editfielda paddingleft" href="' . DOL_URL_ROOT . '/contact/card.php?action=edit&token=' . newToken() . '&id=' . $obj->rowid . '&backtopage=' . urlencode($backtopage) . '">';
1644
+					print '<a class="editfielda paddingleft" href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
1645 1645
 					print img_edit();
1646 1646
 					print '</a>';
1647 1647
 				}
1648 1648
 
1649 1649
 				// Delete
1650 1650
 				if ($user->hasRight('societe', 'contact', 'delete')) {
1651
-					print '<a class="marginleftonly right" href="' . DOL_URL_ROOT . '/societe/contact.php?action=delete&token=' . newToken() . '&id=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
1651
+					print '<a class="marginleftonly right" href="'.DOL_URL_ROOT.'/societe/contact.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
1652 1652
 					print img_delete();
1653 1653
 					print '</a>';
1654 1654
 				}
@@ -1667,13 +1667,13 @@  discard block
 block discarded – undo
1667 1667
 			if (!empty($arrayfields['t.name']['checked'])) {
1668 1668
 				print '<td class="tdoverflowmax150">';
1669 1669
 				print $form->showphoto('contact', $contactstatic, 0, 0, 0, 'photorefnoborder valignmiddle marginrightonly', 'small', 1, 0, 'user');
1670
-				print $contactstatic->getNomUrl(0, '', 0, '&backtopage=' . urlencode($backtopage));
1670
+				print $contactstatic->getNomUrl(0, '', 0, '&backtopage='.urlencode($backtopage));
1671 1671
 				print '</td>';
1672 1672
 			}
1673 1673
 
1674 1674
 			// Job position
1675 1675
 			if (!empty($arrayfields['t.poste']['checked'])) {
1676
-				print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag($obj->poste) . '">';
1676
+				print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->poste).'">';
1677 1677
 				if ($obj->poste) {
1678 1678
 					print dol_escape_htmltag($obj->poste);
1679 1679
 				}
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 			// Status
1713 1713
 			if (!empty($arrayfields['t.statut']['checked'])) {
1714
-				print '<td class="center">' . $contactstatic->getLibStatut(5) . '</td>';
1714
+				print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
1715 1715
 			}
1716 1716
 
1717 1717
 			if ($showuserlogin) {
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 			// Extra fields
1729 1729
 			$extrafieldsobjectkey = $contactstatic->table_element;
1730
-			include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
1730
+			include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1731 1731
 
1732 1732
 			// Actions
1733 1733
 			if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@@ -1735,21 +1735,21 @@  discard block
 block discarded – undo
1735 1735
 
1736 1736
 				// Add to agenda
1737 1737
 				if (isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) {
1738
-					print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&actioncode=&contactid=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
1738
+					print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
1739 1739
 					print img_object($langs->trans("Event"), "action");
1740 1740
 					print '</a> &nbsp; ';
1741 1741
 				}
1742 1742
 
1743 1743
 				// Edit
1744 1744
 				if ($user->hasRight('societe', 'contact', 'creer')) {
1745
-					print '<a class="editfielda paddingleft" href="' . DOL_URL_ROOT . '/contact/card.php?action=edit&token=' . newToken() . '&id=' . $obj->rowid . '&backtopage=' . urlencode($backtopage) . '">';
1745
+					print '<a class="editfielda paddingleft" href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
1746 1746
 					print img_edit();
1747 1747
 					print '</a>';
1748 1748
 				}
1749 1749
 
1750 1750
 				// Delete
1751 1751
 				if ($user->hasRight('societe', 'contact', 'delete')) {
1752
-					print '<a class="marginleftonly right" href="' . DOL_URL_ROOT . '/societe/contact.php?action=delete&token=' . newToken() . '&id=' . $obj->rowid . '&socid=' . $object->id . '&backtopage=' . urlencode($backtopage) . '">';
1752
+					print '<a class="marginleftonly right" href="'.DOL_URL_ROOT.'/societe/contact.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
1753 1753
 					print img_delete();
1754 1754
 					print '</a>';
1755 1755
 				}
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 					$colspan++;
1769 1769
 				}
1770 1770
 			}
1771
-			print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
1771
+			print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1772 1772
 		}
1773 1773
 	} else {
1774 1774
 		$colspan = 1 + ($showuserlogin ? 1 : 0);
@@ -1777,12 +1777,12 @@  discard block
 block discarded – undo
1777 1777
 				$colspan++;
1778 1778
 			}
1779 1779
 		}
1780
-		print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
1780
+		print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
1781 1781
 	}
1782 1782
 	print "\n</table>\n";
1783 1783
 	print '</div>';
1784 1784
 
1785
-	print '</form>' . "\n";
1785
+	print '</form>'."\n";
1786 1786
 
1787 1787
 	return $i;
1788 1788
 }
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 		$tms_start = '';
1856 1856
 		$tms_end = '';
1857 1857
 	}
1858
-	require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
1858
+	require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1859 1859
 
1860 1860
 	// Check parameters
1861 1861
 	if (!is_object($filterobj) && !is_object($objcon)) {
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 	}
1877 1877
 	$sortfield_new = implode(',', $sortfield_new_list);
1878 1878
 
1879
-	$complete = (string) ($filters['search_complete'] ?? '');	// Can be 'na', '0', '50', '100'
1879
+	$complete = (string) ($filters['search_complete'] ?? ''); // Can be 'na', '0', '50', '100'
1880 1880
 	$percent = $complete !== '' ? $complete : -1;
1881 1881
 	if ((string) $complete == '0') {
1882 1882
 		$percent = '0';
@@ -1929,16 +1929,16 @@  discard block
 block discarded – undo
1929 1929
 
1930 1930
 		// Fields from hook
1931 1931
 		$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
1932
-		$reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters);    // Note that $action and $object may have been modified by hook
1932
+		$reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook
1933 1933
 		if (!empty($hookmanager->resPrint)) {
1934 1934
 			$sql .= $hookmanager->resPrint;
1935 1935
 		}
1936 1936
 
1937
-		$sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a";
1937
+		$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
1938 1938
 		// Link to the owner of action
1939
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_action";
1939
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
1940 1940
 		// Link to action types
1941
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_actioncomm as c ON a.fk_action = c.id";
1941
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
1942 1942
 
1943 1943
 		// Set $force_filter_contact:
1944 1944
 		// - true for a filter on a user or a contact, so a link on table llx_actioncomm_resources or llx_actioncomm.fk_user_action
@@ -1953,101 +1953,101 @@  discard block
 block discarded – undo
1953 1953
 
1954 1954
 		// Fields from hook
1955 1955
 		$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
1956
-		$reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters);    // Note that $action and $object may have been modified by hook
1956
+		$reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook
1957 1957
 		if (!empty($hookmanager->resPrint)) {
1958 1958
 			$sql .= $hookmanager->resPrint;
1959 1959
 		}
1960 1960
 		if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
1961
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople as sp ON a.fk_contact = sp.rowid";
1961
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
1962 1962
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
1963
-			$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "element_resources as er";
1963
+			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
1964 1964
 			$sql .= " ON er.resource_type = 'dolresource'";
1965 1965
 			$sql .= " AND er.element_type = 'action'";
1966 1966
 			$sql .= " AND er.element_id = a.id";
1967
-			$sql .= " AND er.resource_id = " . ((int) $filterobj->id);
1967
+			$sql .= " AND er.resource_id = ".((int) $filterobj->id);
1968 1968
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Project') {
1969 1969
 			/* Nothing */
1970 1970
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
1971
-			$sql .= ", " . MAIN_DB_PREFIX . "adherent as m";
1971
+			$sql .= ", ".MAIN_DB_PREFIX."adherent as m";
1972 1972
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
1973
-			$sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as o";
1973
+			$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
1974 1974
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
1975
-			$sql .= ", " . MAIN_DB_PREFIX . "product as o";
1975
+			$sql .= ", ".MAIN_DB_PREFIX."product as o";
1976 1976
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
1977
-			$sql .= ", " . MAIN_DB_PREFIX . "ticket as o";
1977
+			$sql .= ", ".MAIN_DB_PREFIX."ticket as o";
1978 1978
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
1979
-			$sql .= ", " . MAIN_DB_PREFIX . "bom_bom as o";
1979
+			$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
1980 1980
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
1981
-			$sql .= ", " . MAIN_DB_PREFIX . "contrat as o";
1981
+			$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
1982 1982
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') {
1983
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expedition as s ON a.fk_element = s.rowid AND a.elementtype = 'shipping'"; // Jointure sur la table des expéditions avec condition ON
1983
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expedition as s ON a.fk_element = s.rowid AND a.elementtype = 'shipping'"; // Jointure sur la table des expéditions avec condition ON
1984 1984
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Propal') {
1985
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "propal as o ON a.fk_element = o.rowid AND a.elementtype = 'propal'";
1985
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."propal as o ON a.fk_element = o.rowid AND a.elementtype = 'propal'";
1986 1986
 		} elseif (
1987 1987
 			is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid'])
1988 1988
 			&& ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre'])))  // @phan-suppress-current-line PhanTypeInvalidDimOffset
1989 1989
 			&& $filterobj->table_element && $filterobj->element
1990 1990
 		) {
1991
-			$sql .= ", " . MAIN_DB_PREFIX . $filterobj->table_element . " as o";
1991
+			$sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o";
1992 1992
 		}
1993 1993
 
1994
-		$sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")";
1994
+		$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
1995 1995
 		if (!$force_filter_contact) {
1996 1996
 			if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
1997
-				$sql .= " AND a.fk_soc = " . ((int) $filterobj->id);
1997
+				$sql .= " AND a.fk_soc = ".((int) $filterobj->id);
1998 1998
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
1999 1999
 				/* Nothing */
2000 2000
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) {
2001
-				$sql .= " AND a.fk_project = " . ((int) $filterobj->id);
2001
+				$sql .= " AND a.fk_project = ".((int) $filterobj->id);
2002 2002
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
2003 2003
 				$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
2004 2004
 				if ($filterobj->id) {
2005
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2005
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2006 2006
 				}
2007 2007
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') {
2008 2008
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order'";
2009 2009
 				if ($filterobj->id) {
2010
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2010
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2011 2011
 				}
2012 2012
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
2013 2013
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
2014 2014
 				if ($filterobj->id) {
2015
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2015
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2016 2016
 				}
2017 2017
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') {
2018 2018
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice'";
2019 2019
 				if ($filterobj->id) {
2020
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2020
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2021 2021
 				}
2022 2022
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'FactureFournisseur') {
2023 2023
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice_supplier'";
2024 2024
 				if ($filterobj->id) {
2025
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2025
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2026 2026
 				}
2027 2027
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
2028 2028
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
2029 2029
 				if ($filterobj->id) {
2030
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2030
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2031 2031
 				}
2032 2032
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
2033 2033
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
2034 2034
 				if ($filterobj->id) {
2035
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2035
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2036 2036
 				}
2037 2037
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
2038 2038
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
2039 2039
 				if ($filterobj->id) {
2040
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2040
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2041 2041
 				}
2042 2042
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
2043 2043
 				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
2044 2044
 				if ($filterobj->id) {
2045
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2045
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2046 2046
 				}
2047 2047
 			} elseif (is_object($filterobj) && get_class($filterobj) == 'Expedition') {
2048 2048
 				$sql .= " AND a.fk_element = s.rowid AND a.elementtype = 'shipping'"; //expedition filter
2049 2049
 				if ($filterobj->id) {
2050
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2050
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2051 2051
 				}
2052 2052
 			} elseif (
2053 2053
 				is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid'])
@@ -2055,32 +2055,32 @@  discard block
 block discarded – undo
2055 2055
 				&& $filterobj->table_element && $filterobj->element
2056 2056
 			) {
2057 2057
 				// Generic case (if there is a $filterobj and a field rowid and (ref or label) exists.
2058
-				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '" . $db->escape($filterobj->element) . ($module ? "@" . $module : "") . "'";
2058
+				$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
2059 2059
 				if ($filterobj->id) {
2060
-					$sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2060
+					$sql .= " AND a.fk_element = ".((int) $filterobj->id);
2061 2061
 				}
2062 2062
 			} elseif (is_object($filterobj)) {
2063 2063
 				return 'Bad value for $filterobj';
2064 2064
 			}
2065 2065
 		} else {
2066 2066
 			if (is_object($filterobj) && $filterobj->id > 0 && get_class($filterobj) == 'User') {
2067
-				$sql .= " AND (u.rowid = " . ((int) $filterobj->id) . ' OR ';
2068
-				$sql .= " EXISTS (SELECT r.rowid FROM " . MAIN_DB_PREFIX . "actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
2069
-				$sql .= " AND r.element_type = '" . $db->escape($filterobj->table_element) . "' AND r.fk_element = " . ((int) $filterobj->id) . ')';
2067
+				$sql .= " AND (u.rowid = ".((int) $filterobj->id).' OR ';
2068
+				$sql .= " EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
2069
+				$sql .= " AND r.element_type = '".$db->escape($filterobj->table_element)."' AND r.fk_element = ".((int) $filterobj->id).')';
2070 2070
 				$sql .= ")";
2071 2071
 			}
2072 2072
 			if (is_object($objcon) && $objcon->id > 0) {
2073
-				$sql .= " AND EXISTS (SELECT r.rowid FROM " . MAIN_DB_PREFIX . "actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
2074
-				$sql .= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . ((int) $objcon->id) . ')';
2073
+				$sql .= " AND EXISTS (SELECT r.rowid FROM ".MAIN_DB_PREFIX."actioncomm_resources as r WHERE a.id = r.fk_actioncomm";
2074
+				$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id).')';
2075 2075
 			}
2076 2076
 		}
2077 2077
 
2078 2078
 		if (!empty($tms_start) && !empty($tms_end)) {
2079
-			$sql .= " AND ((a.datep BETWEEN '" . $db->idate($tms_start) . "' AND '" . $db->idate($tms_end) . "') OR (a.datep2 BETWEEN '" . $db->idate($tms_start) . "' AND '" . $db->idate($tms_end) . "'))";
2079
+			$sql .= " AND ((a.datep BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."') OR (a.datep2 BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."'))";
2080 2080
 		} elseif (empty($tms_start) && !empty($tms_end)) {
2081
-			$sql .= " AND ((a.datep <= '" . $db->idate($tms_end) . "') OR (a.datep2 <= '" . $db->idate($tms_end) . "'))";
2081
+			$sql .= " AND ((a.datep <= '".$db->idate($tms_end)."') OR (a.datep2 <= '".$db->idate($tms_end)."'))";
2082 2082
 		} elseif (!empty($tms_start) && empty($tms_end)) {
2083
-			$sql .= " AND ((a.datep >= '" . $db->idate($tms_start) . "') OR (a.datep2 >= '" . $db->idate($tms_start) . "'))";
2083
+			$sql .= " AND ((a.datep >= '".$db->idate($tms_start)."') OR (a.datep2 >= '".$db->idate($tms_start)."'))";
2084 2084
 		}
2085 2085
 
2086 2086
 		if (is_array($actioncode) && !empty($actioncode)) {
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 
2111 2111
 		// Fields from hook
2112 2112
 		$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module);
2113
-		$reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters);    // Note that $action and $object may have been modified by hook
2113
+		$reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook
2114 2114
 		if (!empty($hookmanager->resPrint)) {
2115 2115
 			$sql .= $hookmanager->resPrint;
2116 2116
 		}
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
 				$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);
2122 2122
 				if (!empty($sql2)) {
2123 2123
 					if (!empty($sql)) {
2124
-						$sql = $sql . " UNION " . $sql2;
2124
+						$sql = $sql." UNION ".$sql2;
2125 2125
 					} elseif (empty($sql)) {
2126 2126
 						$sql = $sql2;
2127 2127
 					}
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 		} else {
2132 2132
 			$sql2 = addMailingEventTypeSQL($actioncode, $objcon, $filterobj);
2133 2133
 			if (!empty($sql) && !empty($sql2)) {
2134
-				$sql = $sql . " UNION " . $sql2;
2134
+				$sql = $sql." UNION ".$sql2;
2135 2135
 			} elseif (empty($sql) && !empty($sql2)) {
2136 2136
 				$sql = $sql2;
2137 2137
 			}
@@ -2245,10 +2245,10 @@  discard block
 block discarded – undo
2245 2245
 	if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) {
2246 2246
 		$delay_warning = getDolGlobalInt('MAIN_DELAY_ACTIONS_TODO') * 24 * 60 * 60;
2247 2247
 
2248
-		require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
2249
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2250
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
2251
-		require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
2248
+		require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
2249
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2250
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
2251
+		require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
2252 2252
 
2253 2253
 		$formactions = new FormActions($db);
2254 2254
 
@@ -2258,20 +2258,20 @@  discard block
 block discarded – undo
2258 2258
 		$contactstatic = new Contact($db);
2259 2259
 		$elementlinkcache = array();
2260 2260
 
2261
-		$out .= '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
2262
-		$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
2261
+		$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
2262
+		$out .= '<input type="hidden" name="token" value="'.newToken().'">';
2263 2263
 		if (
2264 2264
 			$objcon && get_class($objcon) == 'Contact' &&
2265 2265
 			(is_null($filterobj) || get_class($filterobj) == 'Societe')
2266 2266
 		) {
2267
-			$out .= '<input type="hidden" name="id" value="' . $objcon->id . '" />';
2267
+			$out .= '<input type="hidden" name="id" value="'.$objcon->id.'" />';
2268 2268
 		} else {
2269
-			$out .= '<input type="hidden" name="id" value="' . $filterobj->id . '" />';
2269
+			$out .= '<input type="hidden" name="id" value="'.$filterobj->id.'" />';
2270 2270
 		}
2271 2271
 		if ($filterobj && get_class($filterobj) == 'Societe') {
2272
-			$out .= '<input type="hidden" name="socid" value="' . $filterobj->id . '" />';
2272
+			$out .= '<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
2273 2273
 		} else {
2274
-			$out .= '<input type="hidden" name="userid" value="' . $filterobj->id . '" />';
2274
+			$out .= '<input type="hidden" name="userid" value="'.$filterobj->id.'" />';
2275 2275
 		}
2276 2276
 
2277 2277
 		$out .= "\n";
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 		}
2295 2295
 
2296 2296
 		// ID
2297
-		$out .= '<td class="liste_titre"><input type="text" class="width50" name="search_rowid" value="' . (isset($filters['search_rowid']) ? $filters['search_rowid'] : '') . '"></td>';
2297
+		$out .= '<td class="liste_titre"><input type="text" class="width50" name="search_rowid" value="'.(isset($filters['search_rowid']) ? $filters['search_rowid'] : '').'"></td>';
2298 2298
 		// Date
2299 2299
 		$out .= '<td class="liste_titre center">';
2300 2300
 		$out .= $form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1);
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
 		$out .= $formactions->select_type_actions($actioncode, "actioncode", '', getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? -1 : 1, 0, (getDolGlobalString('AGENDA_USE_MULTISELECT_TYPE') ? 1 : 0), 1, 'selecttype combolargeelem minwidth100 maxwidth150', 1);
2307 2307
 		$out .= '</td>';
2308 2308
 		// Label
2309
-		$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="' . $filters['search_agenda_label'] . '"></td>';
2309
+		$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
2310 2310
 		$out .= '<td class="liste_titre"></td>';
2311 2311
 		$out .= '<td class="liste_titre"></td>';
2312 2312
 		// Status ($percent can be 'na'or < 100 or 100)
@@ -2330,10 +2330,10 @@  discard block
 block discarded – undo
2330 2330
 		if ($donetodo && $filterobj !== null) {
2331 2331
 			$tmp = '';
2332 2332
 			if (get_class($filterobj) == 'Societe') {
2333
-				$tmp .= '<a href="' . DOL_URL_ROOT . '/comm/action/list.php?mode=show_list&socid=' . $filterobj->id . '&status=done">';
2333
+				$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&socid='.$filterobj->id.'&status=done">';
2334 2334
 			}
2335 2335
 			if (get_class($filterobj) == 'User') {
2336
-				$tmp .= '<a href="' . DOL_URL_ROOT . '/comm/action/list.php?mode=show_list&userid=' . $filterobj->id . '&status=done">';
2336
+				$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&userid='.$filterobj->id.'&status=done">';
2337 2337
 			}
2338 2338
 			$tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
2339 2339
 			$tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
 		}
2362 2362
 		$out .= '</tr>';
2363 2363
 
2364
-		require_once DOL_DOCUMENT_ROOT . '/comm/action/class/cactioncomm.class.php';
2364
+		require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
2365 2365
 		$caction = new CActionComm($db);
2366 2366
 		$arraylist = $caction->liste_array(1, 'code', '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 0 : 1), '', 1);
2367 2367
 
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 			// Ref
2391 2391
 			$out .= '<td class="nowraponall">';
2392 2392
 			if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
2393
-				$out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo[$key]['id'] . '">' . img_object($langs->trans("ShowEMailing"), "email") . ' ';
2393
+				$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
2394 2394
 				$out .= $histo[$key]['id'];
2395 2395
 				$out .= '</a>';
2396 2396
 			} else {
@@ -2399,7 +2399,7 @@  discard block
 block discarded – undo
2399 2399
 			$out .= '</td>';
2400 2400
 
2401 2401
 			// Date
2402
-			$out .=  '<td class="center nowraponall nopaddingtopimp nopaddingbottomimp">';
2402
+			$out .= '<td class="center nowraponall nopaddingtopimp nopaddingbottomimp">';
2403 2403
 			if ($histo[$key]['dateend']) {	// There is also a end date
2404 2404
 				$tmpa = dol_getdate($histo[$key]['datestart']);
2405 2405
 				$tmpb = dol_getdate($histo[$key]['dateend']);
@@ -2423,19 +2423,19 @@  discard block
 block discarded – undo
2423 2423
 					}
2424 2424
 				} else {
2425 2425
 					// Not the same day
2426
-					$out .=  '<div class="center inline-block lineheightsmall">';
2427
-					$out .=  dol_print_date($histo[$key]['datestart'], 'dayreduceformat', 'tzuserrel');
2428
-					$out .=  '<br><span class="opacitymedium hourspan">';
2429
-					$out .=  dol_print_date($histo[$key]['datestart'], 'hourreduceformat', 'tzuserrel');
2430
-					$out .=  '</span>';
2431
-					$out .=  '</div>';
2432
-					$out .=  ' ';
2433
-					$out .=  '<div class="center inline-block lineheightsmall">';
2434
-					$out .=  dol_print_date($histo[$key]['dateend'], 'dayreduceformat', 'tzuserrel');
2435
-					$out .=  '<br><span class="opacitymedium hourspan">';
2436
-					$out .=  dol_print_date($histo[$key]['dateend'], 'hourreduceformat', 'tzuserrel');
2437
-					$out .=  '</span>';
2438
-					$out .=  '</div>';
2426
+					$out .= '<div class="center inline-block lineheightsmall">';
2427
+					$out .= dol_print_date($histo[$key]['datestart'], 'dayreduceformat', 'tzuserrel');
2428
+					$out .= '<br><span class="opacitymedium hourspan">';
2429
+					$out .= dol_print_date($histo[$key]['datestart'], 'hourreduceformat', 'tzuserrel');
2430
+					$out .= '</span>';
2431
+					$out .= '</div>';
2432
+					$out .= ' ';
2433
+					$out .= '<div class="center inline-block lineheightsmall">';
2434
+					$out .= dol_print_date($histo[$key]['dateend'], 'dayreduceformat', 'tzuserrel');
2435
+					$out .= '<br><span class="opacitymedium hourspan">';
2436
+					$out .= dol_print_date($histo[$key]['dateend'], 'hourreduceformat', 'tzuserrel');
2437
+					$out .= '</span>';
2438
+					$out .= '</div>';
2439 2439
 				}
2440 2440
 			}
2441 2441
 			// Add the late warning
@@ -2453,9 +2453,9 @@  discard block
 block discarded – undo
2453 2453
 				$late = 1;
2454 2454
 			}
2455 2455
 			if ($late) {
2456
-				$out .= img_warning($langs->trans("Late")) . ' ';
2456
+				$out .= img_warning($langs->trans("Late")).' ';
2457 2457
 			}
2458
-			$out .=  '</td>';
2458
+			$out .= '</td>';
2459 2459
 
2460 2460
 			/*
2461 2461
 			$out .= '<td class="center nowraponall">';
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 					$labelOfTypeToShow = $langs->trans("Emailing");
2524 2524
 				}
2525 2525
 				if ($actionstatic->type_code == 'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labelOfTypeToShow && !empty($arraylist[$actionstatic->code])) {
2526
-					$labelOfTypeToShow .= ' - ' . $arraylist[$actionstatic->code]; // Show also detailed code
2526
+					$labelOfTypeToShow .= ' - '.$arraylist[$actionstatic->code]; // Show also detailed code
2527 2527
 				}
2528 2528
 			}
2529 2529
 
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
 				$labelOfTypeToShowLong .= ' (auto)';
2533 2533
 			}
2534 2534
 
2535
-			$out .= '<td class="tdoverflowmax125" title="' . $labelOfTypeToShowLong . '">';
2535
+			$out .= '<td class="tdoverflowmax125" title="'.$labelOfTypeToShowLong.'">';
2536 2536
 			$out .= $actionstatic->getTypePicto();
2537 2537
 			$out .= $labelOfTypeToShow;
2538 2538
 			$out .= '</td>';
@@ -2540,19 +2540,19 @@  discard block
 block discarded – undo
2540 2540
 			// Title/Label of event
2541 2541
 			$out .= '<td class="tdoverflowmax300"';
2542 2542
 			if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
2543
-				$transcode = $langs->trans("Action" . $histo[$key]['acode']);
2543
+				$transcode = $langs->trans("Action".$histo[$key]['acode']);
2544 2544
 				//$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
2545 2545
 				$label = $histo[$key]['note'];
2546 2546
 				$actionstatic->id = $histo[$key]['id'];
2547
-				$out .= ' title="' . dol_escape_htmltag($label) . '">';
2547
+				$out .= ' title="'.dol_escape_htmltag($label).'">';
2548 2548
 				$out .= dol_trunc($label, 120);
2549 2549
 			}
2550 2550
 			if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
2551
-				$transcode = $langs->trans("Action" . $histo[$key]['acode']);
2552
-				$label = ($transcode != "Action" . $histo[$key]['acode'] ? $transcode : 'Send mass mailing');
2553
-				$label .= ' - ' . $histo[$key]['note'];
2554
-				$out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo[$key]['id'] . '"';
2555
-				$out .= ' title="' . dol_escape_htmltag($label) . '">';
2551
+				$transcode = $langs->trans("Action".$histo[$key]['acode']);
2552
+				$label = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
2553
+				$label .= ' - '.$histo[$key]['note'];
2554
+				$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'"';
2555
+				$out .= ' title="'.dol_escape_htmltag($label).'">';
2556 2556
 				//$out .= img_object($langs->trans("EMailing").'<br>'.$histo[$key]['note'], "email").' ';
2557 2557
 				$out .= dol_trunc($label, 120);
2558 2558
 				$out .= '</a>';
@@ -2590,7 +2590,7 @@  discard block
 block discarded – undo
2590 2590
 						$out .= $contact->getNomUrl(-3, '', 10, '', -1, 0, 'paddingright');
2591 2591
 						if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
2592 2592
 							if (!empty($contact->phone_pro)) {
2593
-								$out .= '(' . dol_print_phone($contact->phone_pro) . ')';
2593
+								$out .= '('.dol_print_phone($contact->phone_pro).')';
2594 2594
 							}
2595 2595
 						}
2596 2596
 						$out .= '<div class="paddingright"></div>';
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
 				$contactstatic->firstname = $histo[$key]['firstname'];
2603 2603
 				$contactstatic->id = $histo[$key]['contact_id'];
2604 2604
 				$contactstatic->photo = $histo[$key]['contact_photo'];
2605
-				$out .= '<td width="120">' . $contactstatic->getNomUrl(-1, '', 10) . '</td>';
2605
+				$out .= '<td width="120">'.$contactstatic->getNomUrl(-1, '', 10).'</td>';
2606 2606
 			} else {
2607 2607
 				$out .= '<td>&nbsp;</td>';
2608 2608
 			}
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
 		}
2622 2622
 		if (empty($histo)) {
2623 2623
 			$colspan = 9;
2624
-			$out .= '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
2624
+			$out .= '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
2625 2625
 		}
2626 2626
 
2627 2627
 		$out .= "</table>\n";
@@ -2652,9 +2652,9 @@  discard block
 block discarded – undo
2652 2652
 	$i = -1;
2653 2653
 
2654 2654
 	$sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas, s.status";
2655
-	$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
2656
-	$sql .= " WHERE s.parent = " . ((int) $object->id);
2657
-	$sql .= " AND s.entity IN (" . getEntity('societe') . ")";
2655
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
2656
+	$sql .= " WHERE s.parent = ".((int) $object->id);
2657
+	$sql .= " AND s.entity IN (".getEntity('societe').")";
2658 2658
 	$sql .= " ORDER BY s.nom";
2659 2659
 
2660 2660
 	$result = $db->query($sql);
@@ -2665,12 +2665,12 @@  discard block
 block discarded – undo
2665 2665
 
2666 2666
 		print load_fiche_titre($langs->trans("Subsidiaries"), '', '');
2667 2667
 
2668
-		print "\n" . '<div class="div-table-responsive-no-min">' . "\n";
2669
-		print '<table class="noborder centpercent">' . "\n";
2668
+		print "\n".'<div class="div-table-responsive-no-min">'."\n";
2669
+		print '<table class="noborder centpercent">'."\n";
2670 2670
 
2671
-		print '<tr class="liste_titre"><td>' . $langs->trans("Company") . '</td>';
2672
-		print '<td>' . $langs->trans("Address") . '</td><td>' . $langs->trans("Zip") . '</td>';
2673
-		print '<td>' . $langs->trans("Town") . '</td><td>' . $langs->trans("CustomerCode") . '</td>';
2671
+		print '<tr class="liste_titre"><td>'.$langs->trans("Company").'</td>';
2672
+		print '<td>'.$langs->trans("Address").'</td><td>'.$langs->trans("Zip").'</td>';
2673
+		print '<td>'.$langs->trans("Town").'</td><td>'.$langs->trans("CustomerCode").'</td>';
2674 2674
 		print "<td>&nbsp;</td>";
2675 2675
 		print "</tr>";
2676 2676
 
@@ -2700,13 +2700,13 @@  discard block
 block discarded – undo
2700 2700
 			print $socstatic->getNomUrl(1);
2701 2701
 			print '</td>';
2702 2702
 
2703
-			print '<td class="tdoverflowmax400" title="' . dol_escape_htmltag($obj->address) . '">' . dol_escape_htmltag($obj->address) . '</td>';
2704
-			print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag($obj->zip) . '">' . $obj->zip . '</td>';
2705
-			print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($obj->town) . '">' . $obj->town . '</td>';
2706
-			print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($obj->code_client) . '">' . $obj->code_client . '</td>';
2703
+			print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->address).'">'.dol_escape_htmltag($obj->address).'</td>';
2704
+			print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).'">'.$obj->zip.'</td>';
2705
+			print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">'.$obj->town.'</td>';
2706
+			print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->code_client).'">'.$obj->code_client.'</td>';
2707 2707
 
2708 2708
 			print '<td class="center">';
2709
-			print '<a class="editfielda" href="' . DOL_URL_ROOT . '/societe/card.php?socid=' . ((int) $obj->rowid) . '&action=edit&token=' . newToken() . '">';
2709
+			print '<a class="editfielda" href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $obj->rowid).'&action=edit&token='.newToken().'">';
2710 2710
 			print img_edit();
2711 2711
 			print '</a></td>';
2712 2712
 
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
 			$i++;
2715 2715
 		}
2716 2716
 		print "\n</table>\n";
2717
-		print '</div>' . "\n";
2717
+		print '</div>'."\n";
2718 2718
 	}
2719 2719
 
2720 2720
 	print "<br>\n";
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
 		} elseif ($actioncode == 'AC_ALL_AUTO') {
2758 2758
 			$sql .= " $sqlANDOR c.type = 'systemauto'";
2759 2759
 		} else {
2760
-			$sql .= " $sqlANDOR c.code = '" . $db->escape($actioncode) . "'";
2760
+			$sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'";
2761 2761
 		}
2762 2762
 	}
2763 2763
 
@@ -2778,9 +2778,9 @@  discard block
 block discarded – undo
2778 2778
 	global $db;
2779 2779
 
2780 2780
 	if ($donetodo == 'todo') {
2781
-		$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '" . $db->idate($now) . "'))";
2781
+		$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
2782 2782
 	} elseif ($donetodo == 'done') {
2783
-		$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) . "'))";
2783
+		$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
2784 2784
 	}
2785 2785
 	if (is_array($filters) && isset($filters['search_complete']) && $filters['search_complete'] === 'na') {
2786 2786
 		$sql .= " AND a.percent = -1";
@@ -2836,8 +2836,8 @@  discard block
 block discarded – undo
2836 2836
 		} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
2837 2837
 			$sql2 .= ", '' as ref";
2838 2838
 		}
2839
-		$sql2 .= " FROM " . MAIN_DB_PREFIX . "mailing as m, " . MAIN_DB_PREFIX . "mailing_cibles as mc, " . MAIN_DB_PREFIX . "user as u";
2840
-		$sql2 .= " WHERE mc.email = '" . $db->escape($objcon->email) . "'"; // Search is done on email.
2839
+		$sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
2840
+		$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
2841 2841
 		$sql2 .= " AND mc.statut = 1";
2842 2842
 		$sql2 .= " AND u.rowid = m.fk_user_valid";
2843 2843
 		$sql2 .= " AND mc.fk_mailing=m.rowid";
@@ -2879,15 +2879,15 @@  discard block
 block discarded – undo
2879 2879
 	//$urllogo = '';
2880 2880
 	$urllogopublic = '';
2881 2881
 	if ($showlogo) {
2882
-		if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $logosmall)) {
2882
+		if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
2883 2883
 			//$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$logosmall);
2884
-			$urllogopublic = $dolibarr_main_url_root . '/viewimage.php?modulepart=mycompany&entity=' . $conf->entity . '&file=' . urlencode('logos/thumbs/' . $logosmall);
2885
-		} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $logo)) {
2884
+			$urllogopublic = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
2885
+		} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
2886 2886
 			//$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$logo);
2887
-			$urllogopublic = $dolibarr_main_url_root . '/viewimage.php?modulepart=mycompany&entity=' . $conf->entity . '&file=' . urlencode('logos/' . $logo);
2888
-		} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.svg')) {
2887
+			$urllogopublic = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
2888
+		} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
2889 2889
 			//$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
2890
-			$urllogopublic = $dolibarr_main_url_root . '/theme/dolibarr_logo.svg';
2890
+			$urllogopublic = $dolibarr_main_url_root.'/theme/dolibarr_logo.svg';
2891 2891
 		}
2892 2892
 	}
2893 2893
 
@@ -2899,19 +2899,19 @@  discard block
 block discarded – undo
2899 2899
 		print '<div class="logopublicpayment">';
2900 2900
 		if ($urllogopublic) {
2901 2901
 			if (!is_numeric($showlogo)) {
2902
-				print '<a href="' . $showlogo . '">';
2902
+				print '<a href="'.$showlogo.'">';
2903 2903
 			}
2904
-			print '<img id="dolpaymentlogo" src="' . $urllogopublic . '">';
2904
+			print '<img id="dolpaymentlogo" src="'.$urllogopublic.'">';
2905 2905
 			if (!is_numeric($showlogo)) {
2906 2906
 				print '</a>';
2907 2907
 			}
2908 2908
 		}
2909 2909
 		if ($alttext) {
2910
-			print '<div class="clearboth"></div><strong>' . $alttext . '</strong>';
2910
+			print '<div class="clearboth"></div><strong>'.$alttext.'</strong>';
2911 2911
 		}
2912 2912
 		print '</div>';
2913 2913
 		if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
2914
-			print '<div class="poweredbypublicpayment opacitymedium right hideonsmartphone"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">' . $langs->trans("PoweredBy") . '<br><img class="poweredbyimg" src="' . DOL_URL_ROOT . '/theme/dolibarr_logo.svg" width="80px"></a></div>';
2914
+			print '<div class="poweredbypublicpayment opacitymedium right hideonsmartphone"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
2915 2915
 		}
2916 2916
 		print '</div>';
2917 2917
 	}
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
 	// Add an optional image under the ban with logo/title
2920 2920
 	if (getDolGlobalString($subimageconst)) {
2921 2921
 		print '<div class="backimagepublicsubimage">';
2922
-		print '<img id="id' . $subimageconst . '" src="' . getDolGlobalString($subimageconst) . '">';
2922
+		print '<img id="id'.$subimageconst.'" src="'.getDolGlobalString($subimageconst).'">';
2923 2923
 		print '</div>';
2924 2924
 	}
2925 2925
 
@@ -2946,11 +2946,11 @@  discard block
 block discarded – undo
2946 2946
 	// Juridical status
2947 2947
 	$line1 = "";
2948 2948
 	if ($fromcompany->forme_juridique_code) {
2949
-		$line1 .= ($line1 ? " - " : "") . getFormeJuridiqueLabel((string) $fromcompany->forme_juridique_code);
2949
+		$line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel((string) $fromcompany->forme_juridique_code);
2950 2950
 	}
2951 2951
 	// Capital
2952 2952
 	if ($fromcompany->capital) {
2953
-		$line1 .= ($line1 ? " - " : "") . $langs->transnoentities("CapitalOf", (string) $fromcompany->capital) . " " . $langs->transnoentities("Currency" . getDolCurrency());
2953
+		$line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", (string) $fromcompany->capital)." ".$langs->transnoentities("Currency".getDolCurrency());
2954 2954
 	}
2955 2955
 	// Prof Id 1
2956 2956
 	if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
@@ -2958,7 +2958,7 @@  discard block
 block discarded – undo
2958 2958
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
2959 2959
 			$field = $reg[1];
2960 2960
 		}
2961
-		$line1 .= ($line1 ? " - " : "") . $field . ": " . $fromcompany->idprof1;
2961
+		$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
2962 2962
 	}
2963 2963
 	// Prof Id 2
2964 2964
 	if ($fromcompany->idprof2) {
@@ -2966,7 +2966,7 @@  discard block
 block discarded – undo
2966 2966
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
2967 2967
 			$field = $reg[1];
2968 2968
 		}
2969
-		$line1 .= ($line1 ? " - " : "") . $field . ": " . $fromcompany->idprof2;
2969
+		$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
2970 2970
 	}
2971 2971
 
2972 2972
 	// Second line of company infos
@@ -2977,7 +2977,7 @@  discard block
 block discarded – undo
2977 2977
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
2978 2978
 			$field = $reg[1];
2979 2979
 		}
2980
-		$line2 .= ($line2 ? " - " : "") . $field . ": " . $fromcompany->idprof3;
2980
+		$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
2981 2981
 	}
2982 2982
 	// Prof Id 4
2983 2983
 	if ($fromcompany->idprof4) {
@@ -2985,33 +2985,33 @@  discard block
 block discarded – undo
2985 2985
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
2986 2986
 			$field = $reg[1];
2987 2987
 		}
2988
-		$line2 .= ($line2 ? " - " : "") . $field . ": " . $fromcompany->idprof4;
2988
+		$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
2989 2989
 	}
2990 2990
 	// IntraCommunautary VAT
2991 2991
 	if ($fromcompany->tva_intra != '') {
2992
-		$line2 .= ($line2 ? " - " : "") . $langs->transnoentities("VATIntraShort") . ": " . $fromcompany->tva_intra;
2992
+		$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
2993 2993
 	}
2994 2994
 
2995
-	print '<!-- htmlPrintOnlineFooter -->' . "\n";
2995
+	print '<!-- htmlPrintOnlineFooter -->'."\n";
2996 2996
 
2997 2997
 	// css centpercent has been removed from class="..." because not compatible with paddingleft/right and there is an horizontal scroll appearring on payment page for example.
2998
-	print '<footer class="center centpercent opacitymedium">' . "\n";
2998
+	print '<footer class="center centpercent opacitymedium">'."\n";
2999 2999
 	print '<br>';
3000 3000
 	if ($addformmessage) {
3001
-		print '<!-- object = ' . (empty($object) ? 'undefined' : $object->element) . ' -->';
3001
+		print '<!-- object = '.(empty($object) ? 'undefined' : $object->element).' -->';
3002 3002
 		print '<br>';
3003 3003
 
3004
-		$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_' . $suffix;
3004
+		$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
3005 3005
 		if (getDolGlobalString($parammessageform) !== '') {
3006 3006
 			print $langs->transnoentities(getDolGlobalString($parammessageform));
3007
-		} elseif (getDolGlobalString('ONLINE_PAYMENT_MESSAGE_FORM')  !== '') {
3007
+		} elseif (getDolGlobalString('ONLINE_PAYMENT_MESSAGE_FORM') !== '') {
3008 3008
 			print $langs->transnoentities(getDolGlobalString('ONLINE_PAYMENT_MESSAGE_FORM'));
3009 3009
 		}
3010 3010
 
3011 3011
 		// Add other message if VAT exists
3012 3012
 		if (!empty($object->total_vat) || !empty($object->total_tva)) {
3013
-			$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_' . $suffix;
3014
-			if (getDolGlobalString($parammessageform)  !== '') {
3013
+			$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
3014
+			if (getDolGlobalString($parammessageform) !== '') {
3015 3015
 				print $langs->transnoentities(getDolGlobalString($parammessageform));
3016 3016
 			} elseif (getDolGlobalString('ONLINE_PAYMENT_MESSAGE_FORMIFVAT') !== '') {
3017 3017
 				print $langs->transnoentities(getDolGlobalString('ONLINE_PAYMENT_MESSAGE_FORMIFVAT'));
@@ -3019,15 +3019,15 @@  discard block
 block discarded – undo
3019 3019
 		}
3020 3020
 	}
3021 3021
 
3022
-	print '<span style="font-size: 10px;"><br><hr>' . "\n";
3023
-	print $fromcompany->name . '<br>';
3022
+	print '<span style="font-size: 10px;"><br><hr>'."\n";
3023
+	print $fromcompany->name.'<br>';
3024 3024
 	print $line1;
3025
-	if (strlen($line1 . $line2) > 50) {
3025
+	if (strlen($line1.$line2) > 50) {
3026 3026
 		print '<br>';
3027 3027
 	} else {
3028 3028
 		print ' - ';
3029 3029
 	}
3030 3030
 	print $line2;
3031 3031
 	print '</span>';
3032
-	print '</footer>' . "\n";
3032
+	print '</footer>'."\n";
3033 3033
 }
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * Note: cond_reglement can not be aliased to cond_reglement!!!
524 524
 	 */
525
-	private $cond_reglement;  // Private to call DolDeprecationHandler
525
+	private $cond_reglement; // Private to call DolDeprecationHandler
526 526
 	/**
527 527
 	 * @var int|string Internal to detect deprecated access
528 528
 	 */
529
-	protected $depr_cond_reglement;  // Internal value for deprecation
529
+	protected $depr_cond_reglement; // Internal value for deprecation
530 530
 
531 531
 	/**
532 532
 	 * @var ?int 		Delivery address ID
@@ -578,12 +578,12 @@  discard block
 block discarded – undo
578 578
 	/**
579 579
 	 * @var float|string Multicurrency total localtax1
580 580
 	 */
581
-	public $multicurrency_total_localtax1;	// not in database
581
+	public $multicurrency_total_localtax1; // not in database
582 582
 
583 583
 	/**
584 584
 	 * @var float|string Multicurrency total localtax2
585 585
 	 */
586
-	public $multicurrency_total_localtax2;	// not in database
586
+	public $multicurrency_total_localtax2; // not in database
587 587
 
588 588
 	/**
589 589
 	 * @var float 		Multicurrency total amount including taxes (TTC = "Toutes Taxes Comprises" in French)
@@ -1053,17 +1053,17 @@  discard block
 block discarded – undo
1053 1053
 				}
1054 1054
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1055 1055
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1056
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1056
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1057 1057
 				} else {
1058
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1059
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1058
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1059
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1060 1060
 					$count++;
1061 1061
 				}
1062 1062
 			}
1063 1063
 			$data['closedivextra'] = '</div>';
1064 1064
 		}
1065 1065
 
1066
-		$hookmanager->initHooks(array($this->element . 'dao'));
1066
+		$hookmanager->initHooks(array($this->element.'dao'));
1067 1067
 		$parameters = array(
1068 1068
 			'tooltipcontentarray' => &$data,
1069 1069
 			'params' => $params,
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 			$sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")";
1586 1586
 		}
1587 1587
 		if ($status >= 0) {
1588
-			$sql .= " AND t.statut = ".((int) $status);	// t is llx_user or llx_socpeople
1588
+			$sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople
1589 1589
 		}
1590 1590
 		if ($statusoflink >= 0) {
1591 1591
 			$sql .= " AND ec.statut = ".((int) $statusoflink);
@@ -1974,7 +1974,7 @@  discard block
 block discarded – undo
1974 1974
 		}
1975 1975
 
1976 1976
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1977
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1977
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1978 1978
 		$sql .= " LIMIT 1";
1979 1979
 
1980 1980
 		$query = $this->db->query($sql);
@@ -2293,9 +2293,9 @@  discard block
 block discarded – undo
2293 2293
 
2294 2294
 		$oldvalue = null;
2295 2295
 		if ($trigkey) {
2296
-			$sql = "SELECT " . $field;
2297
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2298
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2296
+			$sql = "SELECT ".$field;
2297
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2298
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2299 2299
 
2300 2300
 			$resql = $this->db->query($sql);
2301 2301
 			if ($resql) {
@@ -2675,7 +2675,7 @@  discard block
 block discarded – undo
2675 2675
 		// Triggers
2676 2676
 		if (!$error && !$notrigger) {
2677 2677
 			// Call triggers
2678
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2678
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2679 2679
 			if ($result < 0) {
2680 2680
 				$error++;
2681 2681
 			} //Do also here what you must do to rollback action if trigger fail
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
3085 3085
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
3086 3086
 			if (in_array($this->table_element, array('propal', 'commande', 'supplier_proposal', 'commande_fournisseur', 'societe'))) {
3087
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3087
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3088 3088
 			}
3089 3089
 			$sql .= ' WHERE rowid='.((int) $this->id);
3090 3090
 
@@ -3377,7 +3377,7 @@  discard block
 block discarded – undo
3377 3377
 				$this->context['bankaccountupdate'] = 1;
3378 3378
 
3379 3379
 				$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
3380
-				$result = $this->call_trigger($triggerName . '_MODIFY', $userused);
3380
+				$result = $this->call_trigger($triggerName.'_MODIFY', $userused);
3381 3381
 				if ($result < 0) {
3382 3382
 					$error++;
3383 3383
 				}
@@ -3429,10 +3429,10 @@  discard block
 block discarded – undo
3429 3429
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3430 3430
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3431 3431
 		if (!$renum) {
3432
-			$sql .= " AND " . $fieldposition . " = 0";
3432
+			$sql .= " AND ".$fieldposition." = 0";
3433 3433
 		}
3434 3434
 		if ($renum) {
3435
-			$sql .= " AND " . $fieldposition . " <> 0";
3435
+			$sql .= " AND ".$fieldposition." <> 0";
3436 3436
 		}
3437 3437
 
3438 3438
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3453,7 +3453,7 @@  discard block
 block discarded – undo
3453 3453
 			if ($fk_parent_line) {
3454 3454
 				$sql .= ' AND fk_parent_line IS NULL';
3455 3455
 			}
3456
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3456
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3457 3457
 
3458 3458
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3459 3459
 			$resql = $this->db->query($sql);
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3508 3508
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3509 3509
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3510
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3510
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3511 3511
 
3512 3512
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3513 3513
 
@@ -3634,7 +3634,7 @@  discard block
 block discarded – undo
3634 3634
 
3635 3635
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3636 3636
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3637
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3637
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3638 3638
 		if (!$this->db->query($sql)) {
3639 3639
 			$this->error = $this->db->lasterror();
3640 3640
 			return -1;
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
 
3672 3672
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3673 3673
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3674
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3674
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3675 3675
 		if (!$this->db->query($sql)) {
3676 3676
 			$this->error = $this->db->lasterror();
3677 3677
 			return -1;
@@ -3700,7 +3700,7 @@  discard block
 block discarded – undo
3700 3700
 			$fieldposition = 'position';
3701 3701
 		}
3702 3702
 
3703
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3703
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3704 3704
 		$sql .= " WHERE rowid = ".((int) $rowid);
3705 3705
 
3706 3706
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3728,7 +3728,7 @@  discard block
 block discarded – undo
3728 3728
 
3729 3729
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3730 3730
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3731
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3731
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3732 3732
 		$resql = $this->db->query($sql);
3733 3733
 		if (!$resql) {
3734 3734
 			return 0;
@@ -3842,7 +3842,7 @@  discard block
 block discarded – undo
3842 3842
 			$newsuffix = '';
3843 3843
 		}
3844 3844
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3845
-			$fieldusermod =  "fk_user_mod";
3845
+			$fieldusermod = "fk_user_mod";
3846 3846
 		} elseif ($this->table_element == 'ecm_files') {
3847 3847
 			$fieldusermod = "fk_user_m";
3848 3848
 		} else {
@@ -3882,7 +3882,7 @@  discard block
 block discarded – undo
3882 3882
 						$triggerName = 'EXPENSE_REPORT_MODIFY';
3883 3883
 						break;
3884 3884
 					default:
3885
-						$triggerName = (!empty($this->TRIGGER_PREFIX) ? $this->TRIGGER_PREFIX : strtoupper($this->element)) . '_MODIFY';
3885
+						$triggerName = (!empty($this->TRIGGER_PREFIX) ? $this->TRIGGER_PREFIX : strtoupper($this->element)).'_MODIFY';
3886 3886
 				}
3887 3887
 				$ret = $this->call_trigger($triggerName, $user);
3888 3888
 				if ($ret < 0) {
@@ -4180,7 +4180,7 @@  discard block
 block discarded – undo
4180 4180
 			// Situations totals
4181 4181
 			if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {  // @phan-suppress-current-line PhanUndeclaredProperty
4182 4182
 				'@phan-var-force Facture $this';
4183
-				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4183
+				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4184 4184
 				if ($this->type != Facture::TYPE_CREDIT_NOTE) {	// @phpstan-ignore-line
4185 4185
 					if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
4186 4186
 						$prev_sits = $this->get_prev_sits();
@@ -4306,26 +4306,26 @@  discard block
 block discarded – undo
4306 4306
 		$this->db->begin();
4307 4307
 		$error = 0;
4308 4308
 
4309
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4309
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4310 4310
 		$sql .= "fk_source";
4311 4311
 		$sql .= ", sourcetype";
4312 4312
 		$sql .= ", fk_target";
4313 4313
 		$sql .= ", targettype";
4314 4314
 		$sql .= ") VALUES (";
4315 4315
 		$sql .= ((int) $origin_id);
4316
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4317
-		$sql .= ", " . ((int) $this->id);
4318
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4316
+		$sql .= ", '".$this->db->escape($origin)."'";
4317
+		$sql .= ", ".((int) $this->id);
4318
+		$sql .= ", '".$this->db->escape($targettype)."'";
4319 4319
 		$sql .= ")";
4320 4320
 
4321
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4321
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4322 4322
 		if ($this->db->query($sql)) {
4323 4323
 			if (!$notrigger) {
4324 4324
 				// Call trigger
4325 4325
 				$this->context['link_origin'] = $origin;
4326 4326
 				$this->context['link_origin_id'] = $origin_id;
4327 4327
 
4328
-				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user);	// Note: We should have used here a hook. Not a business event
4328
+				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user); // Note: We should have used here a hook. Not a business event
4329 4329
 				if ($result < 0) {
4330 4330
 					$error++;
4331 4331
 				}
@@ -4590,20 +4590,20 @@  discard block
 block discarded – undo
4590 4590
 		$this->db->begin();
4591 4591
 		$error = 0;
4592 4592
 
4593
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4593
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4594 4594
 		if ($updatesource) {
4595
-			$sql .= "fk_source = " . ((int) $sourceid);
4596
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4597
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4598
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4595
+			$sql .= "fk_source = ".((int) $sourceid);
4596
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4597
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4598
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4599 4599
 		} elseif ($updatetarget) {
4600
-			$sql .= "fk_target = " . ((int) $targetid);
4601
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4602
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4603
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4600
+			$sql .= "fk_target = ".((int) $targetid);
4601
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4602
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4603
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4604 4604
 		}
4605 4605
 
4606
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4606
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4607 4607
 		if ($this->db->query($sql)) {
4608 4608
 			if (!$notrigger) {
4609 4609
 				// Call trigger
@@ -4612,7 +4612,7 @@  discard block
 block discarded – undo
4612 4612
 				$this->context['link_target_id'] = $targetid;
4613 4613
 				$this->context['link_target_type'] = $targettype;
4614 4614
 
4615
-				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user);	// Note: We should have used here a hook. Not a business event
4615
+				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user); // Note: We should have used here a hook. Not a business event
4616 4616
 				if ($result < 0) {
4617 4617
 					$error++;
4618 4618
 				}
@@ -4674,7 +4674,7 @@  discard block
 block discarded – undo
4674 4674
 			$this->context['link_target_id'] = $targetid;
4675 4675
 			$this->context['link_target_type'] = $targettype;
4676 4676
 
4677
-			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user);	// Note: We should have used here a hook. Not a business event
4677
+			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user); // Note: We should have used here a hook. Not a business event
4678 4678
 			if ($result < 0) {
4679 4679
 				$error++;
4680 4680
 			}
@@ -4682,25 +4682,25 @@  discard block
 block discarded – undo
4682 4682
 		}
4683 4683
 
4684 4684
 		if (!$error) {
4685
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4685
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4686 4686
 			$sql .= " WHERE";
4687 4687
 			if ($rowid > 0) {
4688
-				$sql .= " rowid = " . ((int) $rowid);
4688
+				$sql .= " rowid = ".((int) $rowid);
4689 4689
 			} else {
4690 4690
 				if ($deletesource) {
4691
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4692
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'";
4691
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4692
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'";
4693 4693
 				} elseif ($deletetarget) {
4694
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4695
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'";
4694
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4695
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'";
4696 4696
 				} else {
4697
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')";
4697
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')";
4698 4698
 					$sql .= " OR";
4699
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')";
4699
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')";
4700 4700
 				}
4701 4701
 			}
4702 4702
 
4703
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4703
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4704 4704
 			if (!$this->db->query($sql)) {
4705 4705
 				$this->error = $this->db->lasterror();
4706 4706
 				$this->errors[] = $this->error;
@@ -4872,14 +4872,14 @@  discard block
 block discarded – undo
4872 4872
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4873 4873
 		}
4874 4874
 		$sql .= " WHERE rowid = ".((int) $elementId);
4875
-		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status);	// We avoid update if status already correct
4875
+		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status); // We avoid update if status already correct
4876 4876
 
4877 4877
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4878 4878
 		$resql = $this->db->query($sql);
4879 4879
 		if ($resql) {
4880 4880
 			$error = 0;
4881 4881
 
4882
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4882
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4883 4883
 
4884 4884
 			if ($nb_rows_affected > 0) {
4885 4885
 				if (empty($trigkey)) {
@@ -4928,9 +4928,9 @@  discard block
 block discarded – undo
4928 4928
 					} elseif ($fieldstatus == 'tosell') {
4929 4929
 						$this->status = $status;
4930 4930
 					} elseif ($fieldstatus == 'tobuy') {
4931
-						$this->status_buy = $status;	// @phpstan-ignore-line
4931
+						$this->status_buy = $status; // @phpstan-ignore-line
4932 4932
 					} elseif ($fieldstatus == 'tobatch') {
4933
-						$this->status_batch = $status;	// @phpstan-ignore-line
4933
+						$this->status_batch = $status; // @phpstan-ignore-line
4934 4934
 					} else {
4935 4935
 						$this->status = $status;
4936 4936
 					}
@@ -5036,7 +5036,7 @@  discard block
 block discarded – undo
5036 5036
 			return -1;
5037 5037
 		}
5038 5038
 
5039
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5039
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5040 5040
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
5041 5041
 		$tmparray = array_keys($this->childtables);
5042 5042
 		if (is_numeric($tmparray[0])) {
@@ -5480,7 +5480,7 @@  discard block
 block discarded – undo
5480 5480
 	 */
5481 5481
 	public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafields = null, $defaulttpldir = '/core/tpl')
5482 5482
 	{
5483
-		global $conf, $langs, $user, $object, $hookmanager;	// used into tpl
5483
+		global $conf, $langs, $user, $object, $hookmanager; // used into tpl
5484 5484
 		global $form;
5485 5485
 		global $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
5486 5486
 
@@ -5534,7 +5534,7 @@  discard block
 block discarded – undo
5534 5534
 			}
5535 5535
 
5536 5536
 			$line->subprice_ttc = (float) price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
5537
-			$line->pu_ttc = $line->subprice_ttc;	// deprecated
5537
+			$line->pu_ttc = $line->subprice_ttc; // deprecated
5538 5538
 
5539 5539
 			// Output template part (modules that overwrite templates must declare this into descriptor)
5540 5540
 			// Use global variables + $dateSelector + $seller and $buyer
@@ -5573,7 +5573,7 @@  discard block
 block discarded – undo
5573 5573
 			$label = (!empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
5574 5574
 
5575 5575
 			$line->subprice_ttc = (float) price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
5576
-			$line->pu_ttc = $line->subprice_ttc;	// deprecated
5576
+			$line->pu_ttc = $line->subprice_ttc; // deprecated
5577 5577
 
5578 5578
 			// Output template part (modules that overwrite templates must declare this into descriptor)
5579 5579
 			// Use global variables + $dateSelector + $seller and $buyer
@@ -6102,7 +6102,7 @@  discard block
 block discarded – undo
6102 6102
 		} else {
6103 6103
 			// TODO: Try to set type above again
6104 6104
 			'@phan-var-force ModeleBarCode|ModeleExports|ModeleImports|ModelePDFAsset|ModelePDFContract|ModelePDFDeliveryOrder|ModelePDFEvaluation|ModelePDFFactures|ModelePDFFicheinter|ModelePDFMo|ModelePDFMovement|ModelePDFProduct|ModelePDFProjects|ModelePDFPropales|ModelePDFRecruitmentJobPosition|ModelePDFStock|ModelePDFStockTransfer|ModelePDFSupplierProposal|ModelePDFSuppliersInvoices|ModelePDFSuppliersOrders|ModelePDFSuppliersPayments|ModelePDFTask|ModelePDFTicket|ModelePDFUser|ModelePDFUserGroup|ModelePdfExpedition|ModelePdfReception|ModeleThirdPartyDoc $obj';
6105
-			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);  // @phan-suppress-line-PhanTypeMismatchArgument
6105
+			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument
6106 6106
 		}
6107 6107
 		// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
6108 6108
 
@@ -6175,7 +6175,7 @@  discard block
 block discarded – undo
6175 6175
 			$setsharekey = false;
6176 6176
 			if ($this->element == 'propal' || $this->element == 'proposal') {
6177 6177
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
6178
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
6178
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
6179 6179
 				}
6180 6180
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
6181 6181
 					$setsharekey = true;
@@ -6235,7 +6235,7 @@  discard block
 block discarded – undo
6235 6235
 				$ecmfile->gen_or_uploaded = 'generated';
6236 6236
 				$ecmfile->description = ''; // indexed content
6237 6237
 				$ecmfile->keywords = ''; // keyword content
6238
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
6238
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
6239 6239
 				$ecmfile->src_object_id   = $this->id;
6240 6240
 
6241 6241
 				$result = $ecmfile->create($user);
@@ -6545,7 +6545,7 @@  discard block
 block discarded – undo
6545 6545
 		$savDisableCompute = $conf->disable_compute;
6546 6546
 		$conf->disable_compute = 1;
6547 6547
 
6548
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6548
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6549 6549
 
6550 6550
 		$conf->disable_compute = $savDisableCompute;
6551 6551
 
@@ -6607,7 +6607,7 @@  discard block
 block discarded – undo
6607 6607
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6608 6608
 			$sql = "SELECT rowid";
6609 6609
 			foreach ($optionsArray as $name => $label) {
6610
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6610
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6611 6611
 					$sql .= ", ".$name;
6612 6612
 				}
6613 6613
 				// use geo sql fonction to read as text
@@ -6652,7 +6652,7 @@  discard block
 block discarded – undo
6652 6652
 					 **/
6653 6653
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6654 6654
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6655
-							$this->array_options['options_' . $key] = null;
6655
+							$this->array_options['options_'.$key] = null;
6656 6656
 						}
6657 6657
 					}
6658 6658
 				}
@@ -6664,9 +6664,9 @@  discard block
 block discarded – undo
6664 6664
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6665 6665
 							//var_dump($conf->disable_compute);
6666 6666
 							if (empty($conf->disable_compute)) {
6667
-								global $objectoffield;        // We set a global variable to $objectoffield so
6668
-								$objectoffield = $this;        // we can use it inside computed formula
6669
-								$this->array_options['options_' . $key] = dol_eval((string) $extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6667
+								global $objectoffield; // We set a global variable to $objectoffield so
6668
+								$objectoffield = $this; // we can use it inside computed formula
6669
+								$this->array_options['options_'.$key] = dol_eval((string) $extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6670 6670
 							}
6671 6671
 						}
6672 6672
 					}
@@ -6852,7 +6852,7 @@  discard block
 block discarded – undo
6852 6852
 									// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6853 6853
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6854 6854
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6855
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6855
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6856 6856
 										} else {
6857 6857
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6858 6858
 										}
@@ -6863,7 +6863,7 @@  discard block
 block discarded – undo
6863 6863
 									// If value has changed
6864 6864
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6865 6865
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6866
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6866
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6867 6867
 										} else {
6868 6868
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6869 6869
 										}
@@ -6875,7 +6875,7 @@  discard block
 block discarded – undo
6875 6875
 								//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6876 6876
 								// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6877 6877
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6878
-									$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6878
+									$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6879 6879
 								} else {
6880 6880
 									$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6881 6881
 								}
@@ -6920,9 +6920,9 @@  discard block
 block discarded – undo
6920 6920
 
6921 6921
 							$sqlFetchObject = "SELECT rowid FROM ".$this->db->prefix().$object->table_element;
6922 6922
 							if (is_numeric($value)) {
6923
-								$sqlFetchObject .= " WHERE rowid = " . (int) $value;
6923
+								$sqlFetchObject .= " WHERE rowid = ".(int) $value;
6924 6924
 							} else {
6925
-								$sqlFetchObject .= " WHERE ref = '" . $this->db->escape($value) . "'";
6925
+								$sqlFetchObject .= " WHERE ref = '".$this->db->escape($value)."'";
6926 6926
 							}
6927 6927
 
6928 6928
 							$obj = $this->db->getRow($sqlFetchObject);
@@ -6968,7 +6968,7 @@  discard block
 block discarded – undo
6968 6968
 			}
6969 6969
 			$geoDataType = ExtraFields::$geoDataTypes[$attributeType] ?? null;
6970 6970
 			// Add field of attribute
6971
-			if (! $geoDataType) {
6971
+			if (!$geoDataType) {
6972 6972
 				// not a geodata type
6973 6973
 				if ($newValue != '') {
6974 6974
 					$sqlColumnValues[$attributeKey] = "'".$this->db->escape($newValue)."'";
@@ -7001,7 +7001,7 @@  discard block
 block discarded – undo
7001 7001
 		if ($table_element == 'categorie') {
7002 7002
 			$table_element = 'categories'; // For compatibility
7003 7003
 		}
7004
-		$extrafieldsTable = $this->db->prefix() . $table_element . '_extrafields';
7004
+		$extrafieldsTable = $this->db->prefix().$table_element.'_extrafields';
7005 7005
 
7006 7006
 		dol_syslog(get_class($this)."::insertExtraFields update or insert record line", LOG_DEBUG);
7007 7007
 
@@ -7024,7 +7024,7 @@  discard block
 block discarded – undo
7024 7024
 				 * @param string $key
7025 7025
 				 * @return string
7026 7026
 				 */
7027
-				array_map(function ($key) use ($sqlColumnValues) {
7027
+				array_map(function($key) use ($sqlColumnValues) {
7028 7028
 					return "{$key} = {$sqlColumnValues[$key]}";
7029 7029
 				}, array_keys($sqlColumnValues))
7030 7030
 			);
@@ -7328,7 +7328,7 @@  discard block
 block discarded – undo
7328 7328
 								if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) {	// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
7329 7329
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7330 7330
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
7331
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7331
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7332 7332
 										} else {
7333 7333
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7334 7334
 										}
@@ -7348,7 +7348,7 @@  discard block
 block discarded – undo
7348 7348
 								}
7349 7349
 							} else {
7350 7350
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7351
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7351
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7352 7352
 								} else {
7353 7353
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7354 7354
 								}
@@ -7946,7 +7946,7 @@  discard block
 block discarded – undo
7946 7946
 				// 7 : sort field
7947 7947
 
7948 7948
 				// If there is filter
7949
-				if (! empty($InfoFieldList[4])) {
7949
+				if (!empty($InfoFieldList[4])) {
7950 7950
 					$pos = 0;
7951 7951
 					$parenthesisopen = 0;
7952 7952
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8010,8 +8010,8 @@  discard block
 block discarded – undo
8010 8010
 					}
8011 8011
 
8012 8012
 					$sqlwhere = '';
8013
-					$sql = "SELECT " . $keyList;
8014
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
8013
+					$sql = "SELECT ".$keyList;
8014
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
8015 8015
 
8016 8016
 					if (!empty($InfoFieldList[4])) {
8017 8017
 						// can use SELECT request
@@ -8029,11 +8029,11 @@  discard block
 block discarded – undo
8029 8029
 						// We have to join on extrafield table
8030 8030
 						$errstr = '';
8031 8031
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8032
-							$sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra";
8033
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8034
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8032
+							$sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra";
8033
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8034
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8035 8035
 						} else {
8036
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8036
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8037 8037
 						}
8038 8038
 					} else {
8039 8039
 						$sqlwhere .= ' WHERE 1=1';
@@ -8054,7 +8054,7 @@  discard block
 block discarded – undo
8054 8054
 
8055 8055
 					// Some tables may have field, some other not. For the moment we disable it.
8056 8056
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8057
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8057
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8058 8058
 					}
8059 8059
 					$sql .= $sqlwhere;
8060 8060
 
@@ -8064,10 +8064,10 @@  discard block
 block discarded – undo
8064 8064
 					} else {
8065 8065
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
8066 8066
 					}
8067
-					$sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8067
+					$sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8068 8068
 					// print $sql;
8069 8069
 
8070
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
8070
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
8071 8071
 					$resql = $this->db->query($sql);
8072 8072
 					if ($resql) {
8073 8073
 						$out .= '<option value="0">&nbsp;</option>';
@@ -8083,7 +8083,7 @@  discard block
 block discarded – undo
8083 8083
 							if (count($fields_label) > 1) {
8084 8084
 								$notrans = true;
8085 8085
 								foreach ($fields_label as $field_toshow) {
8086
-									$labeltoshow .= $obj->$field_toshow . ' ';
8086
+									$labeltoshow .= $obj->$field_toshow.' ';
8087 8087
 								}
8088 8088
 							} else {
8089 8089
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8094,12 +8094,12 @@  discard block
 block discarded – undo
8094 8094
 								foreach ($fields_label as $field_toshow) {
8095 8095
 									$translabel = $langs->trans($obj->$field_toshow);
8096 8096
 									if ($translabel != $obj->$field_toshow) {
8097
-										$labeltoshow = dol_trunc($translabel) . ' ';
8097
+										$labeltoshow = dol_trunc($translabel).' ';
8098 8098
 									} else {
8099
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
8099
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
8100 8100
 									}
8101 8101
 								}
8102
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8102
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8103 8103
 							} else {
8104 8104
 								if (!$notrans) {
8105 8105
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -8113,25 +8113,25 @@  discard block
 block discarded – undo
8113 8113
 									$labeltoshow = '(not defined)';
8114 8114
 								}
8115 8115
 								if ($value == $obj->rowid) {
8116
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8116
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8117 8117
 								}
8118 8118
 
8119 8119
 								if (!empty($InfoFieldList[3]) && $parentField) {
8120
-									$parent = $parentName . ':' . $obj->{$parentField};
8120
+									$parent = $parentName.':'.$obj->{$parentField};
8121 8121
 									$isDependList = 1;
8122 8122
 								}
8123 8123
 
8124
-								$out .= '<option value="' . $obj->rowid . '"';
8124
+								$out .= '<option value="'.$obj->rowid.'"';
8125 8125
 								$out .= ($value == $obj->rowid ? ' selected' : '');
8126
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
8127
-								$out .= '>' . $labeltoshow . '</option>';
8126
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
8127
+								$out .= '>'.$labeltoshow.'</option>';
8128 8128
 							}
8129 8129
 
8130 8130
 							$i++;
8131 8131
 						}
8132 8132
 						$this->db->free($resql);
8133 8133
 					} else {
8134
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8134
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8135 8135
 					}
8136 8136
 				} else {
8137 8137
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8145,9 +8145,9 @@  discard block
 block discarded – undo
8145 8145
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8146 8146
 					$out .= '<option value="0">&nbsp;</option>';
8147 8147
 					foreach ($data as $data_key => $data_value) {
8148
-						$out .= '<option value="' . $data_key . '"';
8148
+						$out .= '<option value="'.$data_key.'"';
8149 8149
 						$out .= ($value == $data_key ? ' selected' : '');
8150
-						$out .= '>' . $data_value . '</option>';
8150
+						$out .= '>'.$data_value.'</option>';
8151 8151
 					}
8152 8152
 				}
8153 8153
 			}
@@ -8187,7 +8187,7 @@  discard block
 block discarded – undo
8187 8187
 				// 7 : sort field
8188 8188
 
8189 8189
 				// If there is a filter
8190
-				if (! empty($InfoFieldList[4])) {
8190
+				if (!empty($InfoFieldList[4])) {
8191 8191
 					$pos = 0;
8192 8192
 					$parenthesisopen = 0;
8193 8193
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8253,8 +8253,8 @@  discard block
 block discarded – undo
8253 8253
 					}
8254 8254
 
8255 8255
 					$sqlwhere = '';
8256
-					$sql = "SELECT " . $keyList;
8257
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
8256
+					$sql = "SELECT ".$keyList;
8257
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
8258 8258
 
8259 8259
 					if (!empty($InfoFieldList[4])) {
8260 8260
 						// can use SELECT request
@@ -8272,11 +8272,11 @@  discard block
 block discarded – undo
8272 8272
 						// We have to join on extrafield table
8273 8273
 						$errstr = '';
8274 8274
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8275
-							$sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra';
8276
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8277
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8275
+							$sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra';
8276
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8277
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8278 8278
 						} else {
8279
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8279
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8280 8280
 						}
8281 8281
 					} else {
8282 8282
 						$sqlwhere .= ' WHERE 1=1';
@@ -8297,14 +8297,14 @@  discard block
 block discarded – undo
8297 8297
 
8298 8298
 					// Some tables may have field, some other not. For the moment we disable it.
8299 8299
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8300
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8300
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8301 8301
 					}
8302 8302
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
8303 8303
 					// print $sql;
8304 8304
 
8305 8305
 					$sql .= $sqlwhere;
8306 8306
 
8307
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
8307
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
8308 8308
 
8309 8309
 					$resql = $this->db->query($sql);
8310 8310
 					if ($resql) {
@@ -8323,7 +8323,7 @@  discard block
 block discarded – undo
8323 8323
 							if (count($fields_label) > 1) {
8324 8324
 								$notrans = true;
8325 8325
 								foreach ($fields_label as $field_toshow) {
8326
-									$labeltoshow .= $obj->$field_toshow . ' ';
8326
+									$labeltoshow .= $obj->$field_toshow.' ';
8327 8327
 								}
8328 8328
 							} else {
8329 8329
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8334,9 +8334,9 @@  discard block
 block discarded – undo
8334 8334
 								foreach ($fields_label as $field_toshow) {
8335 8335
 									$translabel = $langs->trans($obj->$field_toshow);
8336 8336
 									if ($translabel != $obj->$field_toshow) {
8337
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
8337
+										$labeltoshow = dol_trunc($translabel, 18).' ';
8338 8338
 									} else {
8339
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
8339
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
8340 8340
 									}
8341 8341
 								}
8342 8342
 
@@ -8359,20 +8359,20 @@  discard block
 block discarded – undo
8359 8359
 								}
8360 8360
 
8361 8361
 								if (!empty($InfoFieldList[3]) && $parentField) {
8362
-									$parent = $parentName . ':' . $obj->{$parentField};
8362
+									$parent = $parentName.':'.$obj->{$parentField};
8363 8363
 									$isDependList = 1;
8364 8364
 								}
8365 8365
 
8366
-								$data[$obj->rowid] = $labeltoshow;	// Warning: $obj->rowid is an alias and can be an int, but also a string ref.
8366
+								$data[$obj->rowid] = $labeltoshow; // Warning: $obj->rowid is an alias and can be an int, but also a string ref.
8367 8367
 							}
8368 8368
 
8369 8369
 							$i++;
8370 8370
 						}
8371 8371
 						$this->db->free($resql);
8372 8372
 
8373
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8373
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8374 8374
 					} else {
8375
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8375
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8376 8376
 					}
8377 8377
 				} else {
8378 8378
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8384,7 +8384,7 @@  discard block
 block discarded – undo
8384 8384
 					}
8385 8385
 
8386 8386
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8387
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8387
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8388 8388
 				}
8389 8389
 			}
8390 8390
 		} elseif ($type == 'link') {
@@ -8419,7 +8419,7 @@  discard block
 block discarded – undo
8419 8419
 			// $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller.
8420 8420
 
8421 8421
 			//$objectfield = $valparent;
8422
-			$objectfield = $val;			// Is better than using old method $valparent
8422
+			$objectfield = $val; // Is better than using old method $valparent
8423 8423
 
8424 8424
 			// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
8425 8425
 			$out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield);
@@ -8632,7 +8632,7 @@  discard block
 block discarded – undo
8632 8632
 			$value = $this->getLibStatut(3);
8633 8633
 		} elseif ($type == 'date') {
8634 8634
 			if (!empty($value)) {
8635
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8635
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8636 8636
 			} else {
8637 8637
 				$value = '';
8638 8638
 			}
@@ -8733,7 +8733,7 @@  discard block
 block discarded – undo
8733 8733
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8734 8734
 			if (strpos($value, "|") !== false) {
8735 8735
 				$value = $langs->trans(explode('|', $value)[0]);
8736
-			} elseif (! is_numeric($value)) {
8736
+			} elseif (!is_numeric($value)) {
8737 8737
 				$value = $langs->trans($value);
8738 8738
 			}
8739 8739
 		} elseif ($type == 'sellist') {
@@ -8795,9 +8795,9 @@  discard block
 block discarded – undo
8795 8795
 									$translabel = $langs->trans($obj->$field_toshow);
8796 8796
 								}
8797 8797
 								if ($translabel != $field_toshow) {
8798
-									$value .= dol_trunc($translabel, 18) . ' ';
8798
+									$value .= dol_trunc($translabel, 18).' ';
8799 8799
 								} else {
8800
-									$value .= $obj->$field_toshow . ' ';
8800
+									$value .= $obj->$field_toshow.' ';
8801 8801
 								}
8802 8802
 							}
8803 8803
 						} else {
@@ -8813,7 +8813,7 @@  discard block
 block discarded – undo
8813 8813
 						}
8814 8814
 					}
8815 8815
 				} else {
8816
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8816
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8817 8817
 
8818 8818
 					$toprint = array();
8819 8819
 					$obj = $this->db->fetch_object($resql);
@@ -8821,7 +8821,7 @@  discard block
 block discarded – undo
8821 8821
 					$c->fetch($obj->rowid);
8822 8822
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8823 8823
 					foreach ($ways as $way) {
8824
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8824
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8825 8825
 					}
8826 8826
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8827 8827
 				}
@@ -8837,11 +8837,11 @@  discard block
 block discarded – undo
8837 8837
 				$toprint = array();
8838 8838
 				foreach ($value_arr as $keyval => $valueval) {
8839 8839
 					if (!empty($valueval)) {
8840
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8840
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8841 8841
 					}
8842 8842
 				}
8843 8843
 				if (!empty($toprint)) {
8844
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8844
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8845 8845
 				}
8846 8846
 			}
8847 8847
 		} elseif ($type == 'chkbxlst') {
@@ -8896,9 +8896,9 @@  discard block
 block discarded – undo
8896 8896
 										$translabel = $langs->trans($obj->$field_toshow);
8897 8897
 									}
8898 8898
 									if ($translabel != $field_toshow) {
8899
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8899
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8900 8900
 									} else {
8901
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8901
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8902 8902
 									}
8903 8903
 								}
8904 8904
 							} else {
@@ -8907,15 +8907,15 @@  discard block
 block discarded – undo
8907 8907
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8908 8908
 								}
8909 8909
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8910
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8910
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8911 8911
 								} else {
8912
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8912
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8913 8913
 								}
8914 8914
 							}
8915 8915
 						}
8916 8916
 					}
8917 8917
 				} else {
8918
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8918
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8919 8919
 
8920 8920
 					$toprint = array();
8921 8921
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8924,7 +8924,7 @@  discard block
 block discarded – undo
8924 8924
 							$c->fetch($obj->rowid);
8925 8925
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8926 8926
 							foreach ($ways as $way) {
8927
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8927
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8928 8928
 							}
8929 8929
 						}
8930 8930
 					}
@@ -9094,7 +9094,7 @@  discard block
 block discarded – undo
9094 9094
 		global $langs;
9095 9095
 
9096 9096
 		if (!class_exists('Validate')) {
9097
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
9097
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
9098 9098
 		}
9099 9099
 
9100 9100
 		$this->clearFieldError($fieldKey);
@@ -9334,7 +9334,7 @@  discard block
 block discarded – undo
9334 9334
 				$out .= "\n";
9335 9335
 
9336 9336
 				$nbofextrafieldsshown = 0;
9337
-				$e = 0;	// var to manage the modulo (odd/even)
9337
+				$e = 0; // var to manage the modulo (odd/even)
9338 9338
 
9339 9339
 				$lastseparatorkeyfound = '';
9340 9340
 				$extrafields_collapse_num = '';
@@ -9372,9 +9372,9 @@  discard block
 block discarded – undo
9372 9372
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
9373 9373
 					} elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) {
9374 9374
 						// We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost
9375
-						$ef_name = 'options_' . $key;
9375
+						$ef_name = 'options_'.$key;
9376 9376
 						$ef_value = $this->array_options[$ef_name];
9377
-						$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
9377
+						$out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n";
9378 9378
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
9379 9379
 					} elseif ($mode == 'view' && empty($visibility)) {
9380 9380
 						continue;
@@ -10464,7 +10464,7 @@  discard block
 block discarded – undo
10464 10464
 						continue;
10465 10465
 					}
10466 10466
 				}
10467
-				$keys_with_alias[] = $alias . '.' . $fieldname;
10467
+				$keys_with_alias[] = $alias.'.'.$fieldname;
10468 10468
 			}
10469 10469
 			return implode(', ', $keys_with_alias);
10470 10470
 		} else {
@@ -10608,7 +10608,7 @@  discard block
 block discarded – undo
10608 10608
 		if (!$error) {
10609 10609
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10610 10610
 			$sql .= " (".implode(", ", $keys).')';
10611
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10611
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10612 10612
 
10613 10613
 			$res = $this->db->query($sql);
10614 10614
 			if (!$res) {
@@ -10922,7 +10922,7 @@  discard block
 block discarded – undo
10922 10922
 
10923 10923
 		// Update extrafield
10924 10924
 		if (!$error) {
10925
-			$result = $this->insertExtraFields();	// This update extrafields
10925
+			$result = $this->insertExtraFields(); // This update extrafields
10926 10926
 			if ($result < 0) {
10927 10927
 				$error++;
10928 10928
 			}
@@ -11056,7 +11056,7 @@  discard block
 block discarded – undo
11056 11056
 		if (!$error) {
11057 11057
 			$dir = getMultidirOutput($this)."/".dol_sanitizeFileName($this->ref);
11058 11058
 			// For remove dir
11059
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
11059
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
11060 11060
 			if (dol_is_dir($dir)) {
11061 11061
 				if (!dol_delete_dir_recursive($dir)) {
11062 11062
 					$this->errors[] = 'ErrorFailToDeleteDir';
@@ -11157,12 +11157,12 @@  discard block
 block discarded – undo
11157 11157
 				$error++;
11158 11158
 			} else {
11159 11159
 				while ($obj = $this->db->fetch_object($resql)) {
11160
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
11160
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
11161 11161
 					if ($result < 0) {
11162 11162
 						$error++;
11163 11163
 						$this->errors[] = $this->error;
11164 11164
 					} else {
11165
-						$result = $this->delete($user);	// @phpstan-ignore-line
11165
+						$result = $this->delete($user); // @phpstan-ignore-line
11166 11166
 						if ($result < 0) {
11167 11167
 							$error++;
11168 11168
 							$this->errors[] = $this->error;
@@ -11329,7 +11329,7 @@  discard block
 block discarded – undo
11329 11329
 		);
11330 11330
 		foreach ($fields as $key => $value) {
11331 11331
 			if (array_key_exists($key, $this->fields)) {
11332
-				$this->{$key} = $value;		// @phpstan-ignore-line
11332
+				$this->{$key} = $value; // @phpstan-ignore-line
11333 11333
 			}
11334 11334
 		}
11335 11335
 
Please login to merge, or discard this patch.