Completed
Branch develop (fde605)
by
unknown
25:27
created
htdocs/webportal/admin/configcss.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
  * @var Translate $langs
34 34
  * @var User $user
35 35
  */
36
-require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
37
-require_once DOL_DOCUMENT_ROOT . "/webportal/lib/webportal.lib.php";
36
+require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
37
+require_once DOL_DOCUMENT_ROOT."/webportal/lib/webportal.lib.php";
38 38
 
39 39
 // Translations
40 40
 $langs->loadLangs(array("admin", "hrm", "other", "website"));
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 }
80 80
 
81 81
 if ($action == 'updatecss') {
82
-	$csscontent = GETPOST('WEBPORTAL_CUSTOM_CSS', 'restricthtml');	// Will return a sanitized HTML content (so with double spaes that may be replaced with one, ...
82
+	$csscontent = GETPOST('WEBPORTAL_CUSTOM_CSS', 'restricthtml'); // Will return a sanitized HTML content (so with double spaes that may be replaced with one, ...
83 83
 	$csscontent = dol_string_nohtmltag($csscontent, 2, 'UTF-8', 0, 0);
84 84
 
85 85
 	dolibarr_set_const($db, "WEBPORTAL_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 );
117 117
 
118 118
 // Subheader
119
-$linkback = '<a href="' . ($backtopage ? $backtopage : DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1') . '">' . $langs->trans("BackToModuleList") . '</a>';
119
+$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
120 120
 
121 121
 print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
122 122
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 print dol_get_fiche_head($head, 'css', $langs->trans($title), -1, "webportal");
126 126
 
127 127
 // Setup page goes here
128
-echo '<span class="opacitymedium">' . $langs->trans("WebPortalCSS") . '</span><br><br>';
128
+echo '<span class="opacitymedium">'.$langs->trans("WebPortalCSS").'</span><br><br>';
129 129
 
130 130
 //WYSIWYG Editor
131
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
131
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
132 132
 
133
-print '<form enctype="multipart/form-data" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
133
+print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
134 134
 
135
-print '<input type="hidden" name="token" value="' . newToken() . '">';
135
+print '<input type="hidden" name="token" value="'.newToken().'">';
136 136
 print '<input type="hidden" name="action" value="updatecss">';
137 137
 
138 138
 clearstatcache();
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 
149 149
 $doleditor = new DolEditor('WEBPORTAL_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
150 150
 $doleditor->Create(0, '', true, 'css', 'css');
151
-print '</td></tr>' . "\n";
151
+print '</td></tr>'."\n";
152 152
 
153
-print '</table>' . "\n";
153
+print '</table>'."\n";
154 154
 print '</div>';
155 155
 
156 156
 print '<div class="center">';
157
-print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
157
+print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="'.$langs->trans("Save").'">';
158 158
 //print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
159 159
 print '</div>';
160 160
 
Please login to merge, or discard this patch.
htdocs/webportal/class/context.class.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 * \brief      File of context class for WebPortal
24 24
 */
25 25
 
26
-require_once __DIR__ . '/controller.class.php';
27
-require_once __DIR__ . '/webPortalTheme.class.php';
26
+require_once __DIR__.'/controller.class.php';
27
+require_once __DIR__.'/webPortalTheme.class.php';
28 28
 
29 29
 /**
30 30
  * Class Context
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$this->db = $db;
185 185
 
186
-		$this->tplDir = __DIR__ . '/../';
186
+		$this->tplDir = __DIR__.'/../';
187 187
 
188 188
 		$this->getControllerUrl();
189 189
 
190 190
 		$this->topMenu = new stdClass();
191 191
 
192
-		$this->tplPath = realpath(__DIR__ . '/../../public/webportal/tpl');
192
+		$this->tplPath = realpath(__DIR__.'/../../public/webportal/tpl');
193 193
 
194 194
 		$this->controller = GETPOST('controller', 'aZ09'); // for security, limited to 'aZ09'
195
-		$this->action = GETPOST('action', 'aZ09');// for security, limited to 'aZ09'
195
+		$this->action = GETPOST('action', 'aZ09'); // for security, limited to 'aZ09'
196 196
 
197 197
 		if (empty($this->controller)) {
198 198
 			$this->controller = 'default';
@@ -234,17 +234,17 @@  discard block
 block discarded – undo
234 234
 	{
235 235
 		global $hookmanager;
236 236
 
237
-		$defaultControllersPath = __DIR__ . '/../controllers/';
237
+		$defaultControllersPath = __DIR__.'/../controllers/';
238 238
 
239 239
 		// define controllers definition
240
-		$this->addControllerDefinition('login', $defaultControllersPath . 'login.controller.class.php', 'LoginController');
241
-		$this->addControllerDefinition('default', $defaultControllersPath . 'default.controller.class.php', 'DefaultController');
242
-		$this->addControllerDefinition('document', $defaultControllersPath . 'document.controller.class.php', 'DocumentController');
243
-		$this->addControllerDefinition('propallist', $defaultControllersPath . 'propallist.controller.class.php', 'PropalListController');
244
-		$this->addControllerDefinition('orderlist', $defaultControllersPath . 'orderlist.controller.class.php', 'OrderListController');
245
-		$this->addControllerDefinition('invoicelist', $defaultControllersPath . 'invoicelist.controller.class.php', 'InvoiceListController');
246
-		$this->addControllerDefinition('membercard', $defaultControllersPath . 'membercard.controller.class.php', 'MemberCardController');
247
-		$this->addControllerDefinition('partnershipcard', $defaultControllersPath . 'partnershipcard.controller.class.php', 'PartnershipCardController');
240
+		$this->addControllerDefinition('login', $defaultControllersPath.'login.controller.class.php', 'LoginController');
241
+		$this->addControllerDefinition('default', $defaultControllersPath.'default.controller.class.php', 'DefaultController');
242
+		$this->addControllerDefinition('document', $defaultControllersPath.'document.controller.class.php', 'DocumentController');
243
+		$this->addControllerDefinition('propallist', $defaultControllersPath.'propallist.controller.class.php', 'PropalListController');
244
+		$this->addControllerDefinition('orderlist', $defaultControllersPath.'orderlist.controller.class.php', 'OrderListController');
245
+		$this->addControllerDefinition('invoicelist', $defaultControllersPath.'invoicelist.controller.class.php', 'InvoiceListController');
246
+		$this->addControllerDefinition('membercard', $defaultControllersPath.'membercard.controller.class.php', 'MemberCardController');
247
+		$this->addControllerDefinition('partnershipcard', $defaultControllersPath.'partnershipcard.controller.class.php', 'PartnershipCardController');
248 248
 
249 249
 		// Hooks for init controller
250 250
 		$hookmanager->initHooks(array('webportaldao'));
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$length = strlen($needle);
279 279
 		$isControllerFile = $length > 0 ? substr($fileName, -$length) === $needle : true;
280 280
 		if (!$isControllerFile) {
281
-			$this->setError('Error: controller definition ' . $fileName);
281
+			$this->setError('Error: controller definition '.$fileName);
282 282
 			return false;
283 283
 		}
284 284
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				$rootUrl .= '/';
314 314
 			}
315 315
 		} else {
316
-			$rootUrl = dol_buildpath('/public/webportal/', 3);	// Return the public URL for external access
316
+			$rootUrl = dol_buildpath('/public/webportal/', 3); // Return the public URL for external access
317 317
 		}
318 318
 
319 319
 		return $rootUrl;
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 		if (!empty($Tparams)) {
399 399
 			$TCompiledAttr = array();
400 400
 			foreach ($Tparams as $key => $value) {
401
-				$TCompiledAttr[] = $key . '=' . $value;
401
+				$TCompiledAttr[] = $key.'='.$value;
402 402
 			}
403
-			$url .= '?' . implode("&", $TCompiledAttr);
403
+			$url .= '?'.implode("&", $TCompiledAttr);
404 404
 		}
405 405
 
406 406
 		// if $moreParams is a string
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 
433 433
 		$ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on');
434 434
 		$sp = strtolower($s['SERVER_PROTOCOL']);
435
-		$protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');
435
+		$protocol = substr($sp, 0, strpos($sp, '/')).(($ssl) ? 's' : '');
436 436
 		$port = $s['SERVER_PORT'];
437
-		$port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
437
+		$port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':'.$port;
438 438
 		$host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null);
439
-		$host = isset($host) ? $host : $s['SERVER_NAME'] . $port;
439
+		$host = isset($host) ? $host : $s['SERVER_NAME'].$port;
440 440
 
441
-		$url = $protocol . '://' . $host;
441
+		$url = $protocol.'://'.$host;
442 442
 
443 443
 		if ($withRequestUri) {
444 444
 			$url .= $s['REQUEST_URI'];
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
 	public function setEventMessages($mesg, $mesgs, $style = 'mesgs')
574 574
 	{
575 575
 		if (empty($mesg) && empty($mesgs)) {
576
-			dol_syslog(__METHOD__ . ' Try to add a message in stack, but value to add is empty message', LOG_WARNING);
576
+			dol_syslog(__METHOD__.' Try to add a message in stack, but value to add is empty message', LOG_WARNING);
577 577
 		} else {
578 578
 			if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) {
579
-				dol_print_error(null, 'Bad parameter style=' . $style . ' for setEventMessages');
579
+				dol_print_error(null, 'Bad parameter style='.$style.' for setEventMessages');
580 580
 			}
581 581
 			if (empty($mesgs)) {
582 582
 				$this->setEventMessage($mesg, $style);
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	{
662 662
 		$token = $this->newToken();
663 663
 		if ($token) {
664
-			return '&' . $this->tokenKey . '=' . $this->newToken();
664
+			return '&'.$this->tokenKey.'='.$this->newToken();
665 665
 		}
666 666
 
667 667
 		return null;
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	{
677 677
 		$token = $this->newToken();
678 678
 		if ($token) {
679
-			return '<input type="hidden" name="' . $this->tokenKey . '" value="' . $this->newToken() . '" />';
679
+			return '<input type="hidden" name="'.$this->tokenKey.'" value="'.$this->newToken().'" />';
680 680
 		}
681 681
 
682 682
 		return null;
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 		$id = 0;
695 695
 
696 696
 		$sql = "SELECT sa.rowid as id, sa.pass_crypted";
697
-		$sql .= " FROM " . $this->db->prefix() . "societe_account as sa";
698
-		$sql .= " WHERE sa.login = '" . $this->db->escape($login) . "'";
697
+		$sql .= " FROM ".$this->db->prefix()."societe_account as sa";
698
+		$sql .= " WHERE sa.login = '".$this->db->escape($login)."'";
699 699
 		//$sql .= " AND BINARY sa.pass_crypted = '" . $this->db->escape($pass) . "'"; // case sensitive
700 700
 		$sql .= " AND sa.site = 'dolibarr_portal'";
701 701
 		$sql .= " AND sa.status = 1";
702
-		$sql .= " AND sa.entity IN (" . getEntity('societe') . ")";
702
+		$sql .= " AND sa.entity IN (".getEntity('societe').")";
703 703
 
704
-		dol_syslog(__METHOD__ . ' Try to find the third-party account id for login"' . $login . '" and site="dolibarr_portal"', LOG_DEBUG);
704
+		dol_syslog(__METHOD__.' Try to find the third-party account id for login"'.$login.'" and site="dolibarr_portal"', LOG_DEBUG);
705 705
 		$result = $this->db->query($sql);
706 706
 		if ($result) {
707 707
 			if ($this->db->num_rows($result) == 1) {
@@ -732,13 +732,13 @@  discard block
 block discarded – undo
732 732
 					if ($passok) {
733 733
 						$id = $obj->id;
734 734
 					} else {
735
-						dol_syslog(__METHOD__ .' Authentication KO bad password for ' . $login . ', cryptType=' . $cryptType, LOG_NOTICE);
735
+						dol_syslog(__METHOD__.' Authentication KO bad password for '.$login.', cryptType='.$cryptType, LOG_NOTICE);
736 736
 						sleep(1); // Brut force protection. Must be same delay when login is not valid
737 737
 						return -3;
738 738
 					}
739 739
 				}
740 740
 			} else {
741
-				dol_syslog(__METHOD__ . ' Many third-party account found for login"' . $login . '" and site="dolibarr_portal"', LOG_ERR);
741
+				dol_syslog(__METHOD__.' Many third-party account found for login"'.$login.'" and site="dolibarr_portal"', LOG_ERR);
742 742
 				return -2;
743 743
 			}
744 744
 		} else {
Please login to merge, or discard this patch.
htdocs/webportal/class/html.formcardwebportal.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * \brief      File of class with all html predefined components for WebPortal
26 26
  */
27 27
 
28
-require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formwebportal.class.php';
28
+require_once DOL_DOCUMENT_ROOT.'/webportal/class/html.formwebportal.class.php';
29 29
 
30 30
 /**
31 31
  *    Class to manage generation of HTML components
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 		global $hookmanager, $langs;
147 147
 
148 148
 		$elementEnUpper = strtoupper($elementEn);
149
-		$objectclass = 'WebPortal' . ucfirst($elementEn);
149
+		$objectclass = 'WebPortal'.ucfirst($elementEn);
150 150
 
151
-		$elementCardAccess = getDolGlobalString('WEBPORTAL_' . $elementEnUpper . '_CARD_ACCESS', 'hidden');
151
+		$elementCardAccess = getDolGlobalString('WEBPORTAL_'.$elementEnUpper.'_CARD_ACCESS', 'hidden');
152 152
 		if ($elementCardAccess == 'hidden' || $id <= 0) {
153 153
 			accessforbidden();
154 154
 		}
155 155
 
156 156
 		// load module libraries
157
-		dol_include_once('/webportal/class/webportal' . $elementEn . '.class.php');
157
+		dol_include_once('/webportal/class/webportal'.$elementEn.'.class.php');
158 158
 
159 159
 		// Load translation files required by the page
160 160
 		$langs->loadLangs(array('website', 'other'));
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 		$action = GETPOST('action', 'aZ09');
166 166
 		$confirm = GETPOST('confirm', 'alpha');
167 167
 		$cancel = GETPOST('cancel', 'aZ09');
168
-		$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'webportal' . $elementEn . 'card'; // To manage different context of search
169
-		$backtopage = GETPOST('backtopage', 'alpha');                    // if not set, a default page will be used
170
-		$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');    // if not set, $backtopage will be used
168
+		$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'webportal'.$elementEn.'card'; // To manage different context of search
169
+		$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
170
+		$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
171 171
 
172 172
 		// Initialize a technical objects
173 173
 		$object = new $objectclass($this->db);
174 174
 		//$extrafields = new ExtraFields($db);
175
-		$hookmanager->initHooks(array('webportal' . $elementEn . 'card', 'globalcard')); // Note that conf->hooks_modules contains array
175
+		$hookmanager->initHooks(array('webportal'.$elementEn.'card', 'globalcard')); // Note that conf->hooks_modules contains array
176 176
 
177 177
 		// Fetch optionals attributes and labels
178 178
 		//$extrafields->fetch_name_optionals_label($object->table_element);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// Load object
186
-		include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
186
+		include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
187 187
 
188 188
 		// Security check (enable the most restrictive one)
189 189
 		if (!isModEnabled('webportal')) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$this->permissiontodelete = $permissiontodelete;
207 207
 		$this->permissionnote = $permissionnote;
208 208
 		$this->permissiondellink = $permissiondellink;
209
-		$this->titleKey = $objectclass . 'CardTitle';
209
+		$this->titleKey = $objectclass.'CardTitle';
210 210
 		$this->ref = $ref;
211 211
 	}
212 212
 
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 
240 240
 		if (empty($backtopage) || ($cancel && empty($id))) {
241 241
 			if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
242
-				$backtopage = $context->getControllerUrl($elementEn . 'card');
242
+				$backtopage = $context->getControllerUrl($elementEn.'card');
243 243
 			}
244 244
 		}
245 245
 
246 246
 		// Action to cancel record
247 247
 		if ($cancel) {
248 248
 			if (!empty($backtopageforcancel)) {
249
-				header("Location: " . $backtopageforcancel);
249
+				header("Location: ".$backtopageforcancel);
250 250
 				exit;
251 251
 			} elseif (!empty($backtopage)) {
252
-				header("Location: " . $backtopage);
252
+				header("Location: ".$backtopage);
253 253
 				exit;
254 254
 			}
255 255
 			$action = '';
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 			foreach ($object->fields as $key => $val) {
261 261
 				// Check if field was submitted to be edited
262 262
 				if ($object->fields[$key]['type'] == 'duration') {
263
-					if (!GETPOSTISSET($key . 'hour') || !GETPOSTISSET($key . 'min')) {
263
+					if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
264 264
 						continue; // The field was not submitted to be saved
265 265
 					}
266 266
 				} elseif ($object->fields[$key]['type'] == 'boolean') {
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 					}
327 327
 					$value = dol_mktime($timeHours, $timeMinutes, $timeSeconds, $dateMonth, $dateDay, $dateYear);
328 328
 				} elseif ($object->fields[$key]['type'] == 'duration') {
329
-					if (GETPOSTINT($key . 'hour') != '' || GETPOSTINT($key . 'min') != '') {
330
-						$value = 60 * 60 * GETPOSTINT($key . 'hour') + 60 * GETPOSTINT($key . 'min');
329
+					if (GETPOSTINT($key.'hour') != '' || GETPOSTINT($key.'min') != '') {
330
+						$value = 60 * 60 * GETPOSTINT($key.'hour') + 60 * GETPOSTINT($key.'min');
331 331
 					} else {
332 332
 						$value = '';
333 333
 					}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
397 397
 					$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
398 398
 					if ($urltogo && empty($noback)) {
399
-						header("Location: " . $urltogo);
399
+						header("Location: ".$urltogo);
400 400
 						exit;
401 401
 					}
402 402
 				} else {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		// main information - begin
464 464
 		$html .= '<div class="header-card-main-information inline-block valignmiddle">';
465 465
 		// ref
466
-		$html .= '<div><strong>' . $langs->trans("Ref").' : '.dol_escape_htmltag($object->ref) . '</strong></div>';
466
+		$html .= '<div><strong>'.$langs->trans("Ref").' : '.dol_escape_htmltag($object->ref).'</strong></div>';
467 467
 		// full name
468 468
 		$fullname = '';
469 469
 		if (method_exists($object, 'getFullName')) {
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 			/** @var Adherent $object */
476 476
 			if ($object->morphy == 'mor' && !empty($object->company)) {
477 477
 				$html .= dol_htmlentities((string) $object->company);
478
-				$html .= (!empty($fullname) && $object->company != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '';
478
+				$html .= (!empty($fullname) && $object->company != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '';
479 479
 			} else {
480
-				$html .= dol_htmlentities($fullname) . $addgendertxt;
480
+				$html .= dol_htmlentities($fullname).$addgendertxt;
481 481
 				if (empty($object->socid)) {
482
-					$html .= (!empty($object->company) && $object->company != $fullname) ? ' (' . dol_htmlentities((string) $object->company) . ')' : '';
482
+					$html .= (!empty($object->company) && $object->company != $fullname) ? ' ('.dol_htmlentities((string) $object->company).')' : '';
483 483
 				}
484 484
 			}
485 485
 		} else {
@@ -569,23 +569,23 @@  discard block
 block discarded – undo
569 569
 
570 570
 			$value = $object->$key;
571 571
 
572
-			$html .= '<div class="grid field_' . $key . '">';
572
+			$html .= '<div class="grid field_'.$key.'">';
573 573
 
574
-			$html .= '<div class="' . (empty($val['tdcss']) ? '' : $val['tdcss']) . ' fieldname_' . $key;
574
+			$html .= '<div class="'.(empty($val['tdcss']) ? '' : $val['tdcss']).' fieldname_'.$key;
575 575
 			$html .= '">';
576 576
 			$labeltoshow = '';
577
-			$labeltoshow .= '<strong>' . $langs->trans($val['label']) . '</strong>';
577
+			$labeltoshow .= '<strong>'.$langs->trans($val['label']).'</strong>';
578 578
 			$html .= $labeltoshow;
579 579
 			$html .= '</div>';
580 580
 
581
-			$html .= '<div class="valuefield fieldname_' . $key;
581
+			$html .= '<div class="valuefield fieldname_'.$key;
582 582
 			if (!empty($val['cssview'])) {
583
-				$html .= ' ' . $val['cssview'];
583
+				$html .= ' '.$val['cssview'];
584 584
 			}
585 585
 			$html .= '">';
586 586
 			if ($key == 'lang') {
587 587
 				$langs->load('languages');
588
-				$labellang = ($value ? $langs->trans('Language_' . $value) : '');
588
+				$labellang = ($value ? $langs->trans('Language_'.$value) : '');
589 589
 				//$html .= picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"');
590 590
 				$html .= $labellang;
591 591
 			} else {
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 				continue; // We don't want this field
646 646
 			}
647 647
 
648
-			$html .= '<div class="grid field_' . $key . '">';
648
+			$html .= '<div class="grid field_'.$key.'">';
649 649
 			$html .= '<div class="titlefieldcreate';
650 650
 			if (isset($val['notnull']) && $val['notnull'] > 0) {
651 651
 				$html .= ' required';
@@ -677,15 +677,15 @@  discard block
 block discarded – undo
677 677
 				$value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key;
678 678
 			} elseif (in_array($val['type'], array('date', 'datetime'))) {
679 679
 				$isPostDate = GETPOSTISSET($key);
680
-				$isPostTime = GETPOSTISSET($key . '_time');
680
+				$isPostTime = GETPOSTISSET($key.'_time');
681 681
 				if ($isPostDate) {
682 682
 					$postDate = GETPOST($key, 'alphanohtml');
683 683
 					if ($isPostTime) {
684
-						$postTime = GETPOST($key . '_time', 'alphanohtml') . ':00';
684
+						$postTime = GETPOST($key.'_time', 'alphanohtml').':00';
685 685
 					} else {
686 686
 						$postTime = '00:00:00';
687 687
 					}
688
-					$valueDateTimeStr = $postDate . ' ' . $postTime;
688
+					$valueDateTimeStr = $postDate.' '.$postTime;
689 689
 				} else {
690 690
 					// format date timestamp to YYYY-MM-DD HH:ii:ss
691 691
 					$valueDateTimeStr = dol_print_date($object->$key, '%Y-%m-%d %H:%M:%S');
@@ -758,19 +758,19 @@  discard block
 block discarded – undo
758 758
 			$html .= '<article>';
759 759
 			//$html .= load_fiche_titre($title, '', 'object_'.$object->picto);
760 760
 			$html .= '<header>';
761
-			$html .= '<h2>' . $title . '</h2>';
761
+			$html .= '<h2>'.$title.'</h2>';
762 762
 			$html .= '</header>';
763 763
 
764 764
 			$url_file = $context->getControllerUrl($context->controller, '', false);
765
-			$html .= '<form method="POST" action="' . $url_file . '">';
765
+			$html .= '<form method="POST" action="'.$url_file.'">';
766 766
 			$html .= $context->getFormToken();
767 767
 			$html .= '<input type="hidden" name="action" value="update">';
768
-			$html .= '<input type="hidden" name="id" value="' . $object->id . '">';
768
+			$html .= '<input type="hidden" name="id" value="'.$object->id.'">';
769 769
 			if ($backtopage) {
770
-				$html .= '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
770
+				$html .= '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
771 771
 			}
772 772
 			if ($backtopageforcancel) {
773
-				$html .= '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
773
+				$html .= '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
774 774
 			}
775 775
 
776 776
 			//$html .= '<table>'."\n";
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 
785 785
 			// Save and Cancel buttons
786 786
 			$html .= '<div class="grid">';
787
-			$html .= '<div><input type="submit" name="save" role="button" value="' . dol_escape_htmltag($langs->trans('Save')) . '" /></div>';
788
-			$html .= '<div><input type="submit" name="cancel" role="button" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '" /></div>';
787
+			$html .= '<div><input type="submit" name="save" role="button" value="'.dol_escape_htmltag($langs->trans('Save')).'" /></div>';
788
+			$html .= '<div><input type="submit" name="cancel" role="button" value="'.dol_escape_htmltag($langs->trans('Cancel')).'" /></div>';
789 789
 			$html .= '</div>';
790 790
 
791 791
 			$html .= '</form>';
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 
827 827
 			// Buttons for actions
828 828
 			if ($action != 'presend' && $action != 'editline') {
829
-				$html .= '<div>' . "\n";
829
+				$html .= '<div>'."\n";
830 830
 				$parameters = array();
831 831
 				$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
832 832
 				if ($reshook < 0) {
@@ -836,10 +836,10 @@  discard block
 block discarded – undo
836 836
 				if (empty($reshook)) {
837 837
 					if ($permissiontoadd) {
838 838
 						$url_file = $context->getControllerUrl($context->controller, '', false);
839
-						$html .= '<a href="' . $url_file . '&id=' . $object->id . '&action=edit" role="button">' . $langs->trans('Modify') . '</a>';
839
+						$html .= '<a href="'.$url_file.'&id='.$object->id.'&action=edit" role="button">'.$langs->trans('Modify').'</a>';
840 840
 					}
841 841
 				}
842
-				$html .= '</div>' . "\n";
842
+				$html .= '</div>'."\n";
843 843
 			}
844 844
 		}
845 845
 
Please login to merge, or discard this patch.
htdocs/main.inc.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		session_set_cookie_params($sessioncookieparams);
138 138
 	}
139 139
 	session_name($sessionname);
140
-	dol_session_start();	// This call the open and read of session handler
140
+	dol_session_start(); // This call the open and read of session handler
141 141
 	//exit;	// this exist generates a call to write and close
142 142
 }
143 143
 
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 	if (!$ok) {
175 175
 		if (session_id() && isset($_SESSION["dol_login"]) && !in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
176 176
 			print 'Sorry, your application is offline.'."\n";
177
-			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
177
+			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
178 178
 			$nexturl = DOL_URL_ROOT.'/user/logout.php?token='.newToken();
179 179
 			print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
180 180
 		} else {
181
-			print 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
181
+			print 'Sorry, your application is offline. Only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
182 182
 			$nexturl = DOL_URL_ROOT.'/';
183 183
 			print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
184 184
 		}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
395 395
 					print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
396 396
 					if (getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
397
-						print " instead of " . getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
397
+						print " instead of ".getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
398 398
 					}
399 399
 					print " into setup).\n";
400 400
 				}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		unset($_GET['action']);
423 423
 		unset($_GET['confirmmassaction']);
424 424
 		unset($_GET['massaction']);
425
-		unset($_GET['token']);			// TODO Make a redirect if we have a token in url to remove it ?
425
+		unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ?
426 426
 		if (isset($savid)) {
427 427
 			$_POST['id'] = ((int) $savid);
428 428
 		}
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 	foreach ($disabled_modules as $module) {
445 445
 		if ($module) {
446 446
 			if (empty($conf->$module)) {
447
-				$conf->$module = new stdClass(); 	// To avoid warnings
447
+				$conf->$module = new stdClass(); // To avoid warnings
448 448
 			}
449 449
 
450
-			$conf->$module->enabled = false;		// Old usage
450
+			$conf->$module->enabled = false; // Old usage
451 451
 			unset($conf->modules[$module]);
452 452
 
453 453
 			foreach ($modulepartkeys as $modulepartkey) {
454 454
 				unset($conf->modules_parts[$modulepartkey][$module]);
455 455
 			}
456 456
 			if ($module == 'fournisseur') {		// Special case
457
-				$conf->supplier_order->enabled = 0;		// Old usage
458
-				$conf->supplier_invoice->enabled = 0;	// Old usage
457
+				$conf->supplier_order->enabled = 0; // Old usage
458
+				$conf->supplier_invoice->enabled = 0; // Old usage
459 459
 				unset($conf->modules['supplier_order']);
460 460
 				unset($conf->modules['supplier_invoice']);
461 461
 			}
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 					if (is_object($captchaobj) && method_exists($captchaobj, 'validateCodeAfterLoginSubmit')) {
592 592
 						$ok = $captchaobj->validateCodeAfterLoginSubmit(); // @phan-suppress-current-line PhanUndeclaredMethod
593 593
 					} else {
594
-						$_SESSION["dol_loginmesg"] =  'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
594
+						$_SESSION["dol_loginmesg"] = 'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
595 595
 						$test = false;
596 596
 						$error++;
597 597
 					}
598 598
 				} else {
599
-					$_SESSION["dol_loginmesg"] =  'Error, the captcha handler class '.$classname.' was not found after the include';
599
+					$_SESSION["dol_loginmesg"] = 'Error, the captcha handler class '.$classname.' was not found after the include';
600 600
 					$test = false;
601 601
 					$error++;
602 602
 				}
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 		$allowedmethodtopostusername = 3;
642 642
 		if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
643
-			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');	// Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
643
+			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); // Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
644 644
 		}
645 645
 		// TODO Remove use of $_COOKIE['login_dolibarr'] by replacing line with $usertotest = GETPOST("username", "alpha", $allowedmethodtopostusername); ?
646 646
 		$usertotest = (!empty($_COOKIE['login_dolibarr']) ? preg_replace('/[^a-zA-Z0-9_@\-\.]/', '', $_COOKIE['login_dolibarr']) : GETPOST("username", "alpha", $allowedmethodtopostusername));
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 				}
790 790
 
791 791
 				// Show login form
792
-				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));	// This include http headers
792
+				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers
793 793
 			}
794 794
 			exit;
795 795
 		}
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 } else {
1149 1149
 	// We may have NOLOGIN set, but NOREQUIREUSER not
1150 1150
 	if (!empty($user) && method_exists($user, 'loadDefaultValues') && !defined('NODEFAULTVALUES')) {
1151
-		$user->loadDefaultValues();		// Load default values for everybody (works even if $user->id = 0
1151
+		$user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0
1152 1152
 	}
1153 1153
 }
1154 1154
 
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 	$conf->dol_optimize_smallscreen = 1;
1212 1212
 
1213 1213
 	if (getDolGlobalInt('PRODUIT_DESC_IN_FORM') == 1) {
1214
-		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;	// This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1214
+		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0; // This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1215 1215
 	}
1216 1216
 }
1217 1217
 // Replace themes bugged with jmobile with eldy
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 	define('ROWS_9', 8);
1300 1300
 }
1301 1301
 
1302
-$heightforframes = 52;	// Used by frames.php page
1302
+$heightforframes = 52; // Used by frames.php page
1303 1303
 
1304 1304
 // Init menu manager
1305 1305
 if (!defined('NOREQUIREMENU')) {
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 
1340 1340
 if (!empty(GETPOST('seteventmessages', 'alpha'))) {
1341 1341
 	$message = GETPOST('seteventmessages', 'alpha');
1342
-	$messages  = explode(',', $message);
1342
+	$messages = explode(',', $message);
1343 1343
 	foreach ($messages as $key => $msg) {
1344 1344
 		$tmp = explode(':', $msg);
1345 1345
 		setEventMessages($tmp[0], null, !empty($tmp[1]) ? $tmp[1] : 'mesgs');
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 		}
1679 1679
 
1680 1680
 		if (getDolGlobalString('THEME_ELDY_TOPMENU_BACK1')) {
1681
-			print '<meta name="theme-color" content="rgb(' . getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1681
+			print '<meta name="theme-color" content="rgb('.getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1682 1682
 		}
1683 1683
 
1684 1684
 		// Auto refresh page
@@ -1767,9 +1767,9 @@  discard block
 block discarded – undo
1767 1767
 					$jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME');
1768 1768
 				}
1769 1769
 				if (constant('JS_JQUERY_UI')) {
1770
-					print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // Forced JQuery
1770
+					print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // Forced JQuery
1771 1771
 				} else {
1772
-					print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // JQuery
1772
+					print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1773 1773
 				}
1774 1774
 			}
1775 1775
 			if (!defined('DISABLE_JQUERY_JNOTIFY')) {
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 
1803 1803
 		if (!defined('DISABLE_CSS_DEFAULT_THEME')) {
1804 1804
 			print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1805
-			print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1805
+			print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1806 1806
 		}
1807 1807
 
1808 1808
 		// To fix old chrome bug
@@ -1876,9 +1876,9 @@  discard block
 block discarded – undo
1876 1876
 			}
1877 1877
 			if (!defined('DISABLE_JQUERY_UI')) {
1878 1878
 				if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1879
-					print '<script nonce="' . getNonce() . '" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1879
+					print '<script nonce="'.getNonce().'" src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1880 1880
 				} else {
1881
-					print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1881
+					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1882 1882
 				}
1883 1883
 			}
1884 1884
 			// jQuery jnotify
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
 			// Global js function
1974 1974
 			print '<!-- Includes JS of Dolibarr -->'."\n";
1975 1975
 			if (!defined('DISABLE_LIB_HEAD_JS')) {
1976
-				print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . ($ext ? '&amp;' . $ext : '') . '"></script>' . "\n";
1976
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.($ext ? '&amp;'.$ext : '').'"></script>'."\n";
1977 1977
 			}
1978 1978
 
1979 1979
 			// Leaflet
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 			print $head."\n";
2025 2025
 		}
2026 2026
 		if (getDolGlobalString('MAIN_HTML_HEADER')) {
2027
-			print getDolGlobalString('MAIN_HTML_HEADER') . "\n";
2027
+			print getDolGlobalString('MAIN_HTML_HEADER')."\n";
2028 2028
 		}
2029 2029
 
2030 2030
 		$parameters = array();
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 
2162 2162
 		$toprightmenu .= '</div>';
2163 2163
 
2164
-		$toprightmenu .= '</div>'."\n";		 // end div class="login_block_tools"
2164
+		$toprightmenu .= '</div>'."\n"; // end div class="login_block_tools"
2165 2165
 
2166 2166
 
2167 2167
 		// Add block for other tools
@@ -2911,7 +2911,7 @@  discard block
 block discarded – undo
2911 2911
 		$langs->load(explode('@', $item['name'])[1]);
2912 2912
 		$dropDownQuickAddHtml .= '
2913 2913
 			<a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item['url'].'" title="'.$langs->trans(explode('@', $item['title'])[0]).'">
2914
-			'. img_picto('', $item['picto'], 'style="width:18px;"') . ' ' . $langs->trans(explode('@', $item['name'])[0]) . '</a>
2914
+			'. img_picto('', $item['picto'], 'style="width:18px;"').' '.$langs->trans(explode('@', $item['name'])[0]).'</a>
2915 2915
 		';
2916 2916
 	}
2917 2917
 
@@ -3031,7 +3031,7 @@  discard block
 block discarded – undo
3031 3031
  */
3032 3032
 function top_menu_search()
3033 3033
 {
3034
-	global $langs, $conf, $db, $user, $hookmanager;	// used by htdocs/core/ajax/selectsearchbox.php
3034
+	global $langs, $conf, $db, $user, $hookmanager; // used by htdocs/core/ajax/selectsearchbox.php
3035 3035
 
3036 3036
 	$html = '';
3037 3037
 
@@ -3804,7 +3804,7 @@  discard block
 block discarded – undo
3804 3804
 		$forceping = GETPOST('forceping', 'alpha');
3805 3805
 		if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
3806 3806
 			//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.getDolGlobalString('MAIN_FIRST_PING_OK_ID').' -->';
3807
-			$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256');	// Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3807
+			$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3808 3808
 
3809 3809
 			if (!getDolGlobalString('MAIN_FIRST_PING_OK_DATE')
3810 3810
 				|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != getDolGlobalString('MAIN_FIRST_PING_OK_ID')) && (getDolGlobalString('MAIN_FIRST_PING_OK_ID') != 'disabled'))
Please login to merge, or discard this patch.
htdocs/admin/ihm.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
95 95
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
96 96
 
97
-	$logofile = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND');
97
+	$logofile = $conf->mycompany->dir_output.'/logos/'.getDolGlobalString('MAIN_LOGIN_BACKGROUND');
98 98
 	dol_delete_file($logofile);
99 99
 	dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
100 100
 	$mysoc->logo = '';
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		//dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
292 292
 
293 293
 		$varforimage = 'imagebackground';
294
-		$dirforimage = $conf->mycompany->dir_output . '/logos/';
294
+		$dirforimage = $conf->mycompany->dir_output.'/logos/';
295 295
 		if ($_FILES[$varforimage]["tmp_name"]) {
296 296
 			$reg = array();
297 297
 			if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
 
300 300
 				$isimage = image_format_supported($original_file);
301 301
 				if ($isimage >= 0) {
302
-					dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
302
+					dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
303 303
 					if (!is_dir($dirforimage)) {
304 304
 						dol_mkdir($dirforimage);
305 305
 					}
306
-					$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
306
+					$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
307 307
 					if ($result > 0) {
308 308
 						dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
309 309
 					} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	}
326 326
 
327 327
 	if ($mode == 'css') {
328
-		$csscontent = GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml');	// Will return a sanitized HTML content (so with double spaes that may be replaced with one, ...
328
+		$csscontent = GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'); // Will return a sanitized HTML content (so with double spaes that may be replaced with one, ...
329 329
 		$csscontent = dol_string_nohtmltag($csscontent, 2, 'UTF-8', 0, 0);
330 330
 
331 331
 		dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity);
@@ -412,17 +412,17 @@  discard block
 block discarded – undo
412 412
 	print '</tr>';
413 413
 
414 414
 	// Multilingual GUI
415
-	print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
415
+	print '<tr class="oddeven"><td>'.$langs->trans("EnableMultilangInterface").'</td><td>';
416 416
 	print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
417 417
 	print '</td>';
418 418
 	print '</tr>';
419 419
 
420
-	print '</table>' . "\n";
420
+	print '</table>'."\n";
421 421
 	print '</div>';
422 422
 
423 423
 	print '<div class="center">';
424
-	print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
425
-	print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
424
+	print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
425
+	print '<input class="button button-cancel reposition" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
426 426
 	print '</div>';
427 427
 
428 428
 	print '<br>';
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 	if (!empty($conf->use_javascript_ajax)) {
442 442
 		// Show Quick Add link
443
-		print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
443
+		print '<tr class="oddeven"><td>'.$langs->trans("ShowQuickAddLink").'</td><td>';
444 444
 		print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
445 445
 		print '</td>';
446 446
 		print '</tr>';
@@ -448,14 +448,14 @@  discard block
 block discarded – undo
448 448
 
449 449
 	// Hide wiki link on login page
450 450
 	$pictohelp = '<span class="fa fa-question-circle"></span>';
451
-	print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
451
+	print '<tr class="oddeven"><td>'.str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')).'</td><td>';
452 452
 	print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
453 453
 	//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
454 454
 	print '</td>';
455 455
 	print '</tr>';
456 456
 
457 457
 	// Max size of lists
458
-	print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="';
458
+	print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="';
459 459
 	if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') > 0) {
460 460
 		print getDolGlobalString('MAIN_SIZE_LISTE_LIMIT');
461 461
 	}
@@ -467,49 +467,49 @@  discard block
 block discarded – undo
467 467
 	print '</tr>';
468 468
 
469 469
 	// Max size of short lists on customer card
470
-	print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat width50" name="MAIN_SIZE_SHORTLIST_LIMIT" value="' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') . '"></td>';
470
+	print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat width50" name="MAIN_SIZE_SHORTLIST_LIMIT" value="'.getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT').'"></td>';
471 471
 	print '</tr>';
472 472
 
473 473
 	// Display checkboxes and fields menu left / right
474
-	print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
474
+	print '<tr class="oddeven"><td>'.$langs->trans("MAIN_CHECKBOX_LEFT_COLUMN").'</td><td>';
475 475
 	print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
476 476
 	print '</td>';
477 477
 	print '</tr>';
478 478
 
479 479
 	// First day for weeks
480
-	print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
480
+	print '<tr class="oddeven"><td>'.$langs->trans("WeekStartOnDay").'</td><td>';
481 481
 	print $formother->select_dayofweek(getDolGlobalString('MAIN_START_WEEK', '1'), 'MAIN_START_WEEK', 0);
482 482
 	print '</td>';
483 483
 	print '</tr>';
484 484
 
485 485
 	// DefaultWorkingDays
486
-	print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
487
-	print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5') . '">';
486
+	print '<tr class="oddeven"><td>'.$langs->trans("DefaultWorkingDays").'</td><td>';
487
+	print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5').'">';
488 488
 	print '</td>';
489 489
 	print '</tr>';
490 490
 
491 491
 	// DefaultWorkingHours
492
-	print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
493
-	print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18') . '">';
492
+	print '<tr class="oddeven"><td>'.$langs->trans("DefaultWorkingHours").'</td><td>';
493
+	print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18').'">';
494 494
 	print '</td>';
495 495
 	print '</tr>';
496 496
 
497 497
 	// Firstname/Name
498
-	print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
499
-	$array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
498
+	print '<tr class="oddeven"><td>'.$langs->trans("FirstnameNamePosition").'</td><td>';
499
+	$array = array(0 => $langs->trans("Firstname").' '.$langs->trans("Lastname"), 1 => $langs->trans("Lastname").' '.$langs->trans("Firstname"));
500 500
 	print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, getDolGlobalInt('MAIN_FIRSTNAME_NAME_POSITION', 0));
501 501
 	print '</td>';
502 502
 	print '</tr>';
503 503
 
504 504
 	// Hide unauthorized menus
505
-	print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
505
+	print '<tr class="oddeven"><td>'.$langs->trans("HideUnauthorizedMenu").'</td><td>';
506 506
 	//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
507 507
 	print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
508 508
 	print '</td>';
509 509
 	print '</tr>';
510 510
 
511 511
 	// Hide unauthorized button
512
-	print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
512
+	print '<tr class="oddeven"><td>'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
513 513
 	//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
514 514
 	print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
515 515
 	print '</td>';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 
528 528
 	// Show search area in top menu
529
-	print '<tr class="oddeven"><td>' . $langs->trans("ShowSearchAreaInTopMenu") . '</td><td>';
529
+	print '<tr class="oddeven"><td>'.$langs->trans("ShowSearchAreaInTopMenu").'</td><td>';
530 530
 	print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
531 531
 	print '</td>';
532 532
 	print '</tr>';
@@ -535,17 +535,17 @@  discard block
 block discarded – undo
535 535
 	print '<tr class="oddeven"><td>';
536 536
 	print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
537 537
 	print '</td><td>';
538
-	print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . getDolGlobalString('MAIN_BUGTRACK_ENABLELINK') . '">';
538
+	print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="'.getDolGlobalString('MAIN_BUGTRACK_ENABLELINK').'">';
539 539
 	print '</td>';
540 540
 	print '</tr>';
541 541
 
542 542
 	// Disable javascript and ajax
543
-	print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
543
+	print '<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")).'</td><td>';
544 544
 	print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
545 545
 	print '</td>';
546 546
 	print '</tr>';
547 547
 
548
-	print '</table>' . "\n";
548
+	print '</table>'."\n";
549 549
 	print '</div>';
550 550
 }
551 551
 
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 	complete_substitutions_array($substitutionarray, $langs);
566 566
 
567 567
 	print '<tr class="oddeven width25p"><td>';
568
-	$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
568
+	$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
569 569
 	foreach ($substitutionarray as $key => $val) {
570
-		$texthelp .= $key . '<br>';
570
+		$texthelp .= $key.'<br>';
571 571
 	}
572 572
 	print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
573 573
 
@@ -591,80 +591,80 @@  discard block
 block discarded – undo
591 591
 	print '</td><td class="titlefieldmiddle">';
592 592
 	print '</td></tr>';
593 593
 
594
-	print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
594
+	print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableGlobal').'</td><td>';
595 595
 	print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
596 596
 	print '</td>';
597 597
 	print '</tr>';
598 598
 
599 599
 	if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
600 600
 		// Block meteo
601
-		print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
601
+		print '<tr class="oddeven"><td>'.$langs->trans('MAIN_DISABLE_METEO').'</td><td>';
602 602
 		print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
603 603
 		print '</td>';
604 604
 		print '</tr>';
605 605
 
606 606
 		// Block agenda
607
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
607
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockAgenda').'</td><td>';
608 608
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
609 609
 		print '</td>';
610 610
 		print '</tr>';
611 611
 
612 612
 		// Block agenda
613
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
613
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockProject').'</td><td>';
614 614
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
615 615
 		print '</td>';
616 616
 		print '</tr>';
617 617
 
618 618
 		// Block customer
619
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
619
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockCustomer').'</td><td>';
620 620
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
621 621
 		print '</td>';
622 622
 		print '</tr>';
623 623
 
624 624
 		// Block supplier
625
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
625
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockSupplier').'</td><td>';
626 626
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
627 627
 		print '</td>';
628 628
 		print '</tr>';
629 629
 
630 630
 		// Block contract
631
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
631
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockContract').'</td><td>';
632 632
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
633 633
 		print '</td>';
634 634
 		print '</tr>';
635 635
 
636 636
 		// Block ticket
637
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
637
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockTicket').'</td><td>';
638 638
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
639 639
 		print '</td>';
640 640
 		print '</tr>';
641 641
 
642 642
 		// Block bank
643
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
643
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockBank').'</td><td>';
644 644
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
645 645
 		print '</td>';
646 646
 		print '</tr>';
647 647
 
648 648
 		// Block adherent
649
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
649
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockAdherent').'</td><td>';
650 650
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
651 651
 		print '</td>';
652 652
 		print '</tr>';
653 653
 
654 654
 		// Block expense report
655
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
655
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockExpenseReport').'</td><td>';
656 656
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
657 657
 		print '</td>';
658 658
 		print '</tr>';
659 659
 
660 660
 		// Block holiday
661
-		print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
661
+		print '<tr class="oddeven"><td>'.$langs->trans('DashboardDisableBlockHoliday').'</td><td>';
662 662
 		print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
663 663
 		print '</td>';
664 664
 		print '</tr>';
665 665
 	}
666 666
 
667
-	print '</table>' . "\n";
667
+	print '</table>'."\n";
668 668
 	print '</div>';
669 669
 }
670 670
 
@@ -692,18 +692,18 @@  discard block
 block discarded – undo
692 692
 	$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
693 693
 	complete_substitutions_array($substitutionarray, $langs);
694 694
 	print '<tr class="oddeven"><td>';
695
-	$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
695
+	$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
696 696
 	foreach ($substitutionarray as $key => $val) {
697
-		$texthelp .= $key . '<br>';
697
+		$texthelp .= $key.'<br>';
698 698
 	}
699 699
 	print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
700 700
 	print '</td><td>';
701 701
 	$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
702 702
 	$doleditor->Create();
703
-	print '</td></tr>' . "\n";
703
+	print '</td></tr>'."\n";
704 704
 
705 705
 	// Background
706
-	print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
706
+	print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td>';
707 707
 	print '<div class="centpercent inline-block">';
708 708
 	$disabled = '';
709 709
 	if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
@@ -712,25 +712,25 @@  discard block
 block discarded – undo
712 712
 	$maxfilesizearray = getMaxFileSizeArray();
713 713
 	$maxmin = $maxfilesizearray['maxmin'];
714 714
 	if ($maxmin > 0) {
715
-		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
715
+		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
716 716
 	}
717
-	print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
717
+	print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"'.$disabled.'>';
718 718
 	if ($disabled) {
719
-		print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
719
+		print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
720 720
 	}
721 721
 	if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
722
-		print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
723
-		if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
722
+		print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin&token='.newToken().'&mode=login">'.img_delete($langs->trans("Delete")).'</a>';
723
+		if (file_exists($conf->mycompany->dir_output.'/logos/'.getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
724 724
 			print ' &nbsp; ';
725
-			print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND')) . '">';
725
+			print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.getDolGlobalString('MAIN_LOGIN_BACKGROUND')).'">';
726 726
 		}
727 727
 	} else {
728
-		print '<img class="marginleftonly valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
728
+		print '<img class="marginleftonly valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
729 729
 	}
730 730
 	print '</div>';
731 731
 	print '</td></tr>';
732 732
 
733
-	print '</table>' . "\n";
733
+	print '</table>'."\n";
734 734
 	print '</div>';
735 735
 }
736 736
 
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 
755 755
 
756 756
 print '<div class="center">';
757
-print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
758
-print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
757
+print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="'.$langs->trans("Save").'">';
758
+print '<input class="button button-cancel reposition" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
759 759
 print '</div>';
760 760
 
761 761
 print '</form>';
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * Note: cond_reglement can not be aliased to cond_reglement!!!
478 478
 	 */
479
-	private $cond_reglement;  // Private to call DolDeprecationHandler
479
+	private $cond_reglement; // Private to call DolDeprecationHandler
480 480
 	/**
481 481
 	 * @var int|string Internal to detect deprecated access
482 482
 	 */
483
-	protected $depr_cond_reglement;  // Internal value for deprecation
483
+	protected $depr_cond_reglement; // Internal value for deprecation
484 484
 
485 485
 	/**
486 486
 	 * @var ?int 		Delivery address ID
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	/**
533 533
 	 * @var float|string Multicurrency total localtax1
534 534
 	 */
535
-	public $multicurrency_total_localtax1;	// not in database
535
+	public $multicurrency_total_localtax1; // not in database
536 536
 
537 537
 	/**
538 538
 	 * @var float|string Multicurrency total localtax2
539 539
 	 */
540
-	public $multicurrency_total_localtax2;	// not in database
540
+	public $multicurrency_total_localtax2; // not in database
541 541
 
542 542
 	/**
543 543
 	 * @var float 		Multicurrency total amount including taxes (TTC = "Toutes Taxes Comprises" in French)
@@ -1042,17 +1042,17 @@  discard block
 block discarded – undo
1042 1042
 				}
1043 1043
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1044 1044
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1045
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1045
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1046 1046
 				} else {
1047
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1048
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1047
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1048
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1049 1049
 					$count++;
1050 1050
 				}
1051 1051
 			}
1052 1052
 			$data['closedivextra'] = '</div>';
1053 1053
 		}
1054 1054
 
1055
-		$hookmanager->initHooks(array($this->element . 'dao'));
1055
+		$hookmanager->initHooks(array($this->element.'dao'));
1056 1056
 		$parameters = array(
1057 1057
 			'tooltipcontentarray' => &$data,
1058 1058
 			'params' => $params,
@@ -1272,8 +1272,8 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
 		if ($this->restrictiononfksoc && property_exists($this, 'socid') && !empty($this->socid) && !$user->hasRight('societe', 'client', 'voir')) {
1274 1274
 			$sql_allowed_contacts = 'SELECT COUNT(*) as cnt FROM '.$this->db->prefix().'societe_commerciaux as sc';
1275
-			$sql_allowed_contacts.= ' WHERE sc.fk_soc = '.(int) $this->socid;
1276
-			$sql_allowed_contacts.= ' AND sc.fk_user = '.(int) $user->id;
1275
+			$sql_allowed_contacts .= ' WHERE sc.fk_soc = '.(int) $this->socid;
1276
+			$sql_allowed_contacts .= ' AND sc.fk_user = '.(int) $user->id;
1277 1277
 
1278 1278
 			$resql_allowed_contacts = $this->db->query($sql_allowed_contacts);
1279 1279
 
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 			$sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")";
1573 1573
 		}
1574 1574
 		if ($status >= 0) {
1575
-			$sql .= " AND t.statut = ".((int) $status);	// t is llx_user or llx_socpeople
1575
+			$sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople
1576 1576
 		}
1577 1577
 		if ($statusoflink >= 0) {
1578 1578
 			$sql .= " AND ec.statut = ".((int) $statusoflink);
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 		}
1962 1962
 
1963 1963
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1964
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1964
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1965 1965
 		$sql .= " LIMIT 1";
1966 1966
 
1967 1967
 		$query = $this->db->query($sql);
@@ -2280,9 +2280,9 @@  discard block
 block discarded – undo
2280 2280
 
2281 2281
 		$oldvalue = null;
2282 2282
 		if ($trigkey) {
2283
-			$sql = "SELECT " . $field;
2284
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2285
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2283
+			$sql = "SELECT ".$field;
2284
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2285
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2286 2286
 
2287 2287
 			$resql = $this->db->query($sql);
2288 2288
 			if ($resql) {
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
 		// Triggers
2663 2663
 		if (!$error && !$notrigger) {
2664 2664
 			// Call triggers
2665
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2665
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2666 2666
 			if ($result < 0) {
2667 2667
 				$error++;
2668 2668
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
 					// Call triggers
2726 2726
 					$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
2727 2727
 					if (get_class($this) == 'Commande') {
2728
-						$triggerName = 'ORDER';	// TODO Remove this when TRIGGER_PREFI in order is implemented
2728
+						$triggerName = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
2729 2729
 					}
2730 2730
 					$result = $this->call_trigger($triggerName.'_MODIFY', $user);
2731 2731
 					if ($result < 0) {
@@ -3074,7 +3074,7 @@  discard block
 block discarded – undo
3074 3074
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
3075 3075
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
3076 3076
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
3077
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3077
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3078 3078
 			}
3079 3079
 			$sql .= ' WHERE rowid='.((int) $this->id);
3080 3080
 
@@ -3242,7 +3242,7 @@  discard block
 block discarded – undo
3242 3242
 				$this->context = array('shippingmethodupdate' => 1);
3243 3243
 				$triggerPrefix = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
3244 3244
 				if (get_class($this) == 'Commande') {
3245
-					$triggerPrefix = 'ORDER';	// TODO Remove this when TRIGGER_PREFI in order is implemented
3245
+					$triggerPrefix = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
3246 3246
 				}
3247 3247
 				$result = $this->call_trigger($triggerPrefix.'_MODIFY', $userused);
3248 3248
 				if ($result < 0) {
@@ -3371,7 +3371,7 @@  discard block
 block discarded – undo
3371 3371
 
3372 3372
 				$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
3373 3373
 				if (get_class($this) == 'Commande') {
3374
-					$triggerName = 'ORDER';	// TODO Remove this when TRIGGER_PREFI in order is implemented
3374
+					$triggerName = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
3375 3375
 				}
3376 3376
 				if ($triggerName == 'FACTUREREC_MODIFY') {	// TODO Use the $this->TRIGGER_PREFIX when implemented
3377 3377
 					$triggerName = 'BILLREC_MODIFY';
@@ -3428,10 +3428,10 @@  discard block
 block discarded – undo
3428 3428
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3429 3429
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3430 3430
 		if (!$renum) {
3431
-			$sql .= " AND " . $fieldposition . " = 0";
3431
+			$sql .= " AND ".$fieldposition." = 0";
3432 3432
 		}
3433 3433
 		if ($renum) {
3434
-			$sql .= " AND " . $fieldposition . " <> 0";
3434
+			$sql .= " AND ".$fieldposition." <> 0";
3435 3435
 		}
3436 3436
 
3437 3437
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3452,7 +3452,7 @@  discard block
 block discarded – undo
3452 3452
 			if ($fk_parent_line) {
3453 3453
 				$sql .= ' AND fk_parent_line IS NULL';
3454 3454
 			}
3455
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3455
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3456 3456
 
3457 3457
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3458 3458
 			$resql = $this->db->query($sql);
@@ -3506,7 +3506,7 @@  discard block
 block discarded – undo
3506 3506
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3507 3507
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3508 3508
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3509
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3509
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3510 3510
 
3511 3511
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3512 3512
 
@@ -3633,7 +3633,7 @@  discard block
 block discarded – undo
3633 3633
 
3634 3634
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3635 3635
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3636
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3636
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3637 3637
 		if (!$this->db->query($sql)) {
3638 3638
 			$this->error = $this->db->lasterror();
3639 3639
 			return -1;
@@ -3670,7 +3670,7 @@  discard block
 block discarded – undo
3670 3670
 
3671 3671
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3672 3672
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3673
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3673
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3674 3674
 		if (!$this->db->query($sql)) {
3675 3675
 			$this->error = $this->db->lasterror();
3676 3676
 			return -1;
@@ -3699,7 +3699,7 @@  discard block
 block discarded – undo
3699 3699
 			$fieldposition = 'position';
3700 3700
 		}
3701 3701
 
3702
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3702
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3703 3703
 		$sql .= " WHERE rowid = ".((int) $rowid);
3704 3704
 
3705 3705
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3727,7 +3727,7 @@  discard block
 block discarded – undo
3727 3727
 
3728 3728
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3729 3729
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3730
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3730
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3731 3731
 		$resql = $this->db->query($sql);
3732 3732
 		if (!$resql) {
3733 3733
 			return 0;
@@ -3841,7 +3841,7 @@  discard block
 block discarded – undo
3841 3841
 			$newsuffix = '';
3842 3842
 		}
3843 3843
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3844
-			$fieldusermod =  "fk_user_mod";
3844
+			$fieldusermod = "fk_user_mod";
3845 3845
 		} elseif ($this->table_element == 'ecm_files') {
3846 3846
 			$fieldusermod = "fk_user_m";
3847 3847
 		} else {
@@ -3884,7 +3884,7 @@  discard block
 block discarded – undo
3884 3884
 						$triggerName = 'EXPENSE_REPORT_MODIFY';
3885 3885
 						break;
3886 3886
 					default:
3887
-						$triggerName = strtoupper($this->element) . '_MODIFY';
3887
+						$triggerName = strtoupper($this->element).'_MODIFY';
3888 3888
 				}
3889 3889
 				$ret = $this->call_trigger($triggerName, $user);
3890 3890
 				if ($ret < 0) {
@@ -4182,7 +4182,7 @@  discard block
 block discarded – undo
4182 4182
 			// Situations totals
4183 4183
 			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
4184 4184
 				'@phan-var-force Facture $this';
4185
-				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
4185
+				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
4186 4186
 				if ($this->type != Facture::TYPE_CREDIT_NOTE) {	// @phpstan-ignore-line
4187 4187
 					if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
4188 4188
 						$prev_sits = $this->get_prev_sits();
@@ -4308,26 +4308,26 @@  discard block
 block discarded – undo
4308 4308
 		$this->db->begin();
4309 4309
 		$error = 0;
4310 4310
 
4311
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4311
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4312 4312
 		$sql .= "fk_source";
4313 4313
 		$sql .= ", sourcetype";
4314 4314
 		$sql .= ", fk_target";
4315 4315
 		$sql .= ", targettype";
4316 4316
 		$sql .= ") VALUES (";
4317 4317
 		$sql .= ((int) $origin_id);
4318
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4319
-		$sql .= ", " . ((int) $this->id);
4320
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4318
+		$sql .= ", '".$this->db->escape($origin)."'";
4319
+		$sql .= ", ".((int) $this->id);
4320
+		$sql .= ", '".$this->db->escape($targettype)."'";
4321 4321
 		$sql .= ")";
4322 4322
 
4323
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4323
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4324 4324
 		if ($this->db->query($sql)) {
4325 4325
 			if (!$notrigger) {
4326 4326
 				// Call trigger
4327 4327
 				$this->context['link_origin'] = $origin;
4328 4328
 				$this->context['link_origin_id'] = $origin_id;
4329 4329
 
4330
-				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user);	// Note: We should have used here a hook. Not a business event
4330
+				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user); // Note: We should have used here a hook. Not a business event
4331 4331
 				if ($result < 0) {
4332 4332
 					$error++;
4333 4333
 				}
@@ -4592,20 +4592,20 @@  discard block
 block discarded – undo
4592 4592
 		$this->db->begin();
4593 4593
 		$error = 0;
4594 4594
 
4595
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4595
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4596 4596
 		if ($updatesource) {
4597
-			$sql .= "fk_source = " . ((int) $sourceid);
4598
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4599
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4600
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4597
+			$sql .= "fk_source = ".((int) $sourceid);
4598
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4599
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4600
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4601 4601
 		} elseif ($updatetarget) {
4602
-			$sql .= "fk_target = " . ((int) $targetid);
4603
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4604
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4605
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4602
+			$sql .= "fk_target = ".((int) $targetid);
4603
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4604
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4605
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4606 4606
 		}
4607 4607
 
4608
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4608
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4609 4609
 		if ($this->db->query($sql)) {
4610 4610
 			if (!$notrigger) {
4611 4611
 				// Call trigger
@@ -4614,7 +4614,7 @@  discard block
 block discarded – undo
4614 4614
 				$this->context['link_target_id'] = $targetid;
4615 4615
 				$this->context['link_target_type'] = $targettype;
4616 4616
 
4617
-				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user);	// Note: We should have used here a hook. Not a business event
4617
+				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user); // Note: We should have used here a hook. Not a business event
4618 4618
 				if ($result < 0) {
4619 4619
 					$error++;
4620 4620
 				}
@@ -4676,7 +4676,7 @@  discard block
 block discarded – undo
4676 4676
 			$this->context['link_target_id'] = $targetid;
4677 4677
 			$this->context['link_target_type'] = $targettype;
4678 4678
 
4679
-			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user);	// Note: We should have used here a hook. Not a business event
4679
+			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user); // Note: We should have used here a hook. Not a business event
4680 4680
 			if ($result < 0) {
4681 4681
 				$error++;
4682 4682
 			}
@@ -4684,25 +4684,25 @@  discard block
 block discarded – undo
4684 4684
 		}
4685 4685
 
4686 4686
 		if (!$error) {
4687
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4687
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4688 4688
 			$sql .= " WHERE";
4689 4689
 			if ($rowid > 0) {
4690
-				$sql .= " rowid = " . ((int) $rowid);
4690
+				$sql .= " rowid = ".((int) $rowid);
4691 4691
 			} else {
4692 4692
 				if ($deletesource) {
4693
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4694
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'";
4693
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4694
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'";
4695 4695
 				} elseif ($deletetarget) {
4696
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4697
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'";
4696
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4697
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'";
4698 4698
 				} else {
4699
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')";
4699
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')";
4700 4700
 					$sql .= " OR";
4701
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')";
4701
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')";
4702 4702
 				}
4703 4703
 			}
4704 4704
 
4705
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4705
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4706 4706
 			if (!$this->db->query($sql)) {
4707 4707
 				$this->error = $this->db->lasterror();
4708 4708
 				$this->errors[] = $this->error;
@@ -4874,14 +4874,14 @@  discard block
 block discarded – undo
4874 4874
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4875 4875
 		}
4876 4876
 		$sql .= " WHERE rowid = ".((int) $elementId);
4877
-		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status);	// We avoid update if status already correct
4877
+		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status); // We avoid update if status already correct
4878 4878
 
4879 4879
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4880 4880
 		$resql = $this->db->query($sql);
4881 4881
 		if ($resql) {
4882 4882
 			$error = 0;
4883 4883
 
4884
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4884
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4885 4885
 
4886 4886
 			if ($nb_rows_affected > 0) {
4887 4887
 				if (empty($trigkey)) {
@@ -4930,9 +4930,9 @@  discard block
 block discarded – undo
4930 4930
 					} elseif ($fieldstatus == 'tosell') {
4931 4931
 						$this->status = $status;
4932 4932
 					} elseif ($fieldstatus == 'tobuy') {
4933
-						$this->status_buy = $status;	// @phpstan-ignore-line
4933
+						$this->status_buy = $status; // @phpstan-ignore-line
4934 4934
 					} elseif ($fieldstatus == 'tobatch') {
4935
-						$this->status_batch = $status;	// @phpstan-ignore-line
4935
+						$this->status_batch = $status; // @phpstan-ignore-line
4936 4936
 					} else {
4937 4937
 						$this->status = $status;
4938 4938
 					}
@@ -5038,7 +5038,7 @@  discard block
 block discarded – undo
5038 5038
 			return -1;
5039 5039
 		}
5040 5040
 
5041
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5041
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5042 5042
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
5043 5043
 		$tmparray = array_keys($this->childtables);
5044 5044
 		if (is_numeric($tmparray[0])) {
@@ -5482,7 +5482,7 @@  discard block
 block discarded – undo
5482 5482
 	 */
5483 5483
 	public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafields = null, $defaulttpldir = '/core/tpl')
5484 5484
 	{
5485
-		global $conf, $langs, $user, $object, $hookmanager;	// used into tpl
5485
+		global $conf, $langs, $user, $object, $hookmanager; // used into tpl
5486 5486
 		global $form;
5487 5487
 		global $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
5488 5488
 
@@ -5536,7 +5536,7 @@  discard block
 block discarded – undo
5536 5536
 			}
5537 5537
 
5538 5538
 			$line->subprice_ttc = (float) price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
5539
-			$line->pu_ttc = $line->subprice_ttc;	// deprecated
5539
+			$line->pu_ttc = $line->subprice_ttc; // deprecated
5540 5540
 
5541 5541
 			// Output template part (modules that overwrite templates must declare this into descriptor)
5542 5542
 			// Use global variables + $dateSelector + $seller and $buyer
@@ -5575,7 +5575,7 @@  discard block
 block discarded – undo
5575 5575
 			$label = (!empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
5576 5576
 
5577 5577
 			$line->subprice_ttc = (float) price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
5578
-			$line->pu_ttc = $line->subprice_ttc;	// deprecated
5578
+			$line->pu_ttc = $line->subprice_ttc; // deprecated
5579 5579
 
5580 5580
 			// Output template part (modules that overwrite templates must declare this into descriptor)
5581 5581
 			// Use global variables + $dateSelector + $seller and $buyer
@@ -6104,7 +6104,7 @@  discard block
 block discarded – undo
6104 6104
 		} else {
6105 6105
 			// TODO: Try to set type above again
6106 6106
 			'@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';
6107
-			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);  // @phan-suppress-line-PhanTypeMismatchArgument
6107
+			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument
6108 6108
 		}
6109 6109
 		// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
6110 6110
 
@@ -6177,7 +6177,7 @@  discard block
 block discarded – undo
6177 6177
 			$setsharekey = false;
6178 6178
 			if ($this->element == 'propal' || $this->element == 'proposal') {
6179 6179
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
6180
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
6180
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
6181 6181
 				}
6182 6182
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
6183 6183
 					$setsharekey = true;
@@ -6237,7 +6237,7 @@  discard block
 block discarded – undo
6237 6237
 				$ecmfile->gen_or_uploaded = 'generated';
6238 6238
 				$ecmfile->description = ''; // indexed content
6239 6239
 				$ecmfile->keywords = ''; // keyword content
6240
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
6240
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
6241 6241
 				$ecmfile->src_object_id   = $this->id;
6242 6242
 
6243 6243
 				$result = $ecmfile->create($user);
@@ -6540,7 +6540,7 @@  discard block
 block discarded – undo
6540 6540
 		$savDisableCompute = $conf->disable_compute;
6541 6541
 		$conf->disable_compute = 1;
6542 6542
 
6543
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6543
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6544 6544
 
6545 6545
 		$conf->disable_compute = $savDisableCompute;
6546 6546
 
@@ -6602,7 +6602,7 @@  discard block
 block discarded – undo
6602 6602
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6603 6603
 			$sql = "SELECT rowid";
6604 6604
 			foreach ($optionsArray as $name => $label) {
6605
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6605
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6606 6606
 					$sql .= ", ".$name;
6607 6607
 				}
6608 6608
 				// use geo sql fonction to read as text
@@ -6647,7 +6647,7 @@  discard block
 block discarded – undo
6647 6647
 					 **/
6648 6648
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6649 6649
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6650
-							$this->array_options['options_' . $key] = null;
6650
+							$this->array_options['options_'.$key] = null;
6651 6651
 						}
6652 6652
 					}
6653 6653
 				}
@@ -6659,9 +6659,9 @@  discard block
 block discarded – undo
6659 6659
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6660 6660
 							//var_dump($conf->disable_compute);
6661 6661
 							if (empty($conf->disable_compute)) {
6662
-								global $objectoffield;        // We set a global variable to $objectoffield so
6663
-								$objectoffield = $this;        // we can use it inside computed formula
6664
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6662
+								global $objectoffield; // We set a global variable to $objectoffield so
6663
+								$objectoffield = $this; // we can use it inside computed formula
6664
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6665 6665
 							}
6666 6666
 						}
6667 6667
 					}
@@ -6847,7 +6847,7 @@  discard block
 block discarded – undo
6847 6847
 									// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6848 6848
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6849 6849
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6850
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6850
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6851 6851
 										} else {
6852 6852
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6853 6853
 										}
@@ -6858,7 +6858,7 @@  discard block
 block discarded – undo
6858 6858
 									// If value has changed
6859 6859
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6860 6860
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6861
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6861
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6862 6862
 										} else {
6863 6863
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6864 6864
 										}
@@ -6870,7 +6870,7 @@  discard block
 block discarded – undo
6870 6870
 								//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6871 6871
 								// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6872 6872
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6873
-									$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6873
+									$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6874 6874
 								} else {
6875 6875
 									$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6876 6876
 								}
@@ -6915,9 +6915,9 @@  discard block
 block discarded – undo
6915 6915
 
6916 6916
 							$sqlFetchObject = "SELECT rowid FROM ".$this->db->prefix().$object->table_element;
6917 6917
 							if (is_numeric($value)) {
6918
-								$sqlFetchObject .= " WHERE rowid = " . (int) $value;
6918
+								$sqlFetchObject .= " WHERE rowid = ".(int) $value;
6919 6919
 							} else {
6920
-								$sqlFetchObject .= " WHERE ref = '" . $this->db->escape($value) . "'";
6920
+								$sqlFetchObject .= " WHERE ref = '".$this->db->escape($value)."'";
6921 6921
 							}
6922 6922
 
6923 6923
 							$obj = $this->db->getRow($sqlFetchObject);
@@ -6962,7 +6962,7 @@  discard block
 block discarded – undo
6962 6962
 			}
6963 6963
 			$geoDataType = ExtraFields::$geoDataTypes[$attributeType] ?? null;
6964 6964
 			// Add field of attribute
6965
-			if (! $geoDataType) {
6965
+			if (!$geoDataType) {
6966 6966
 				// not a geodata type
6967 6967
 				if ($newValue != '') {
6968 6968
 					$sqlColumnValues[$attributeKey] = "'".$this->db->escape($newValue)."'";
@@ -6995,7 +6995,7 @@  discard block
 block discarded – undo
6995 6995
 		if ($table_element == 'categorie') {
6996 6996
 			$table_element = 'categories'; // For compatibility
6997 6997
 		}
6998
-		$extrafieldsTable = $this->db->prefix() . $table_element . '_extrafields';
6998
+		$extrafieldsTable = $this->db->prefix().$table_element.'_extrafields';
6999 6999
 
7000 7000
 		dol_syslog(get_class($this)."::insertExtraFields update or insert record line", LOG_DEBUG);
7001 7001
 
@@ -7018,7 +7018,7 @@  discard block
 block discarded – undo
7018 7018
 				 * @param string $key
7019 7019
 				 * @return string
7020 7020
 				 */
7021
-				array_map(function ($key) use ($sqlColumnValues) {
7021
+				array_map(function($key) use ($sqlColumnValues) {
7022 7022
 					return "{$key} = {$sqlColumnValues[$key]}";
7023 7023
 				}, array_keys($sqlColumnValues))
7024 7024
 			);
@@ -7321,7 +7321,7 @@  discard block
 block discarded – undo
7321 7321
 								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.
7322 7322
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7323 7323
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
7324
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7324
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7325 7325
 										} else {
7326 7326
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7327 7327
 										}
@@ -7341,7 +7341,7 @@  discard block
 block discarded – undo
7341 7341
 								}
7342 7342
 							} else {
7343 7343
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7344
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7344
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7345 7345
 								} else {
7346 7346
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7347 7347
 								}
@@ -7938,7 +7938,7 @@  discard block
 block discarded – undo
7938 7938
 				// 7 : sort field
7939 7939
 
7940 7940
 				// If there is filter
7941
-				if (! empty($InfoFieldList[4])) {
7941
+				if (!empty($InfoFieldList[4])) {
7942 7942
 					$pos = 0;
7943 7943
 					$parenthesisopen = 0;
7944 7944
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8002,8 +8002,8 @@  discard block
 block discarded – undo
8002 8002
 					}
8003 8003
 
8004 8004
 					$sqlwhere = '';
8005
-					$sql = "SELECT " . $keyList;
8006
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
8005
+					$sql = "SELECT ".$keyList;
8006
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
8007 8007
 
8008 8008
 					if (!empty($InfoFieldList[4])) {
8009 8009
 						// can use SELECT request
@@ -8021,11 +8021,11 @@  discard block
 block discarded – undo
8021 8021
 						// We have to join on extrafield table
8022 8022
 						$errstr = '';
8023 8023
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8024
-							$sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra";
8025
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8026
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8024
+							$sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra";
8025
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8026
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8027 8027
 						} else {
8028
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8028
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8029 8029
 						}
8030 8030
 					} else {
8031 8031
 						$sqlwhere .= ' WHERE 1=1';
@@ -8046,7 +8046,7 @@  discard block
 block discarded – undo
8046 8046
 
8047 8047
 					// Some tables may have field, some other not. For the moment we disable it.
8048 8048
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8049
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8049
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8050 8050
 					}
8051 8051
 					$sql .= $sqlwhere;
8052 8052
 
@@ -8056,10 +8056,10 @@  discard block
 block discarded – undo
8056 8056
 					} else {
8057 8057
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
8058 8058
 					}
8059
-					$sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8059
+					$sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8060 8060
 					// print $sql;
8061 8061
 
8062
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
8062
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
8063 8063
 					$resql = $this->db->query($sql);
8064 8064
 					if ($resql) {
8065 8065
 						$out .= '<option value="0">&nbsp;</option>';
@@ -8075,7 +8075,7 @@  discard block
 block discarded – undo
8075 8075
 							if (count($fields_label) > 1) {
8076 8076
 								$notrans = true;
8077 8077
 								foreach ($fields_label as $field_toshow) {
8078
-									$labeltoshow .= $obj->$field_toshow . ' ';
8078
+									$labeltoshow .= $obj->$field_toshow.' ';
8079 8079
 								}
8080 8080
 							} else {
8081 8081
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8086,12 +8086,12 @@  discard block
 block discarded – undo
8086 8086
 								foreach ($fields_label as $field_toshow) {
8087 8087
 									$translabel = $langs->trans($obj->$field_toshow);
8088 8088
 									if ($translabel != $obj->$field_toshow) {
8089
-										$labeltoshow = dol_trunc($translabel) . ' ';
8089
+										$labeltoshow = dol_trunc($translabel).' ';
8090 8090
 									} else {
8091
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
8091
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
8092 8092
 									}
8093 8093
 								}
8094
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8094
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8095 8095
 							} else {
8096 8096
 								if (!$notrans) {
8097 8097
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -8105,25 +8105,25 @@  discard block
 block discarded – undo
8105 8105
 									$labeltoshow = '(not defined)';
8106 8106
 								}
8107 8107
 								if ($value == $obj->rowid) {
8108
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8108
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8109 8109
 								}
8110 8110
 
8111 8111
 								if (!empty($InfoFieldList[3]) && $parentField) {
8112
-									$parent = $parentName . ':' . $obj->{$parentField};
8112
+									$parent = $parentName.':'.$obj->{$parentField};
8113 8113
 									$isDependList = 1;
8114 8114
 								}
8115 8115
 
8116
-								$out .= '<option value="' . $obj->rowid . '"';
8116
+								$out .= '<option value="'.$obj->rowid.'"';
8117 8117
 								$out .= ($value == $obj->rowid ? ' selected' : '');
8118
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
8119
-								$out .= '>' . $labeltoshow . '</option>';
8118
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
8119
+								$out .= '>'.$labeltoshow.'</option>';
8120 8120
 							}
8121 8121
 
8122 8122
 							$i++;
8123 8123
 						}
8124 8124
 						$this->db->free($resql);
8125 8125
 					} else {
8126
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8126
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8127 8127
 					}
8128 8128
 				} else {
8129 8129
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8137,9 +8137,9 @@  discard block
 block discarded – undo
8137 8137
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8138 8138
 					$out .= '<option value="0">&nbsp;</option>';
8139 8139
 					foreach ($data as $data_key => $data_value) {
8140
-						$out .= '<option value="' . $data_key . '"';
8140
+						$out .= '<option value="'.$data_key.'"';
8141 8141
 						$out .= ($value == $data_key ? ' selected' : '');
8142
-						$out .= '>' . $data_value . '</option>';
8142
+						$out .= '>'.$data_value.'</option>';
8143 8143
 					}
8144 8144
 				}
8145 8145
 			}
@@ -8179,7 +8179,7 @@  discard block
 block discarded – undo
8179 8179
 				// 7 : sort field
8180 8180
 
8181 8181
 				// If there is a filter
8182
-				if (! empty($InfoFieldList[4])) {
8182
+				if (!empty($InfoFieldList[4])) {
8183 8183
 					$pos = 0;
8184 8184
 					$parenthesisopen = 0;
8185 8185
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8245,8 +8245,8 @@  discard block
 block discarded – undo
8245 8245
 					}
8246 8246
 
8247 8247
 					$sqlwhere = '';
8248
-					$sql = "SELECT " . $keyList;
8249
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
8248
+					$sql = "SELECT ".$keyList;
8249
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
8250 8250
 
8251 8251
 					if (!empty($InfoFieldList[4])) {
8252 8252
 						// can use SELECT request
@@ -8264,11 +8264,11 @@  discard block
 block discarded – undo
8264 8264
 						// We have to join on extrafield table
8265 8265
 						$errstr = '';
8266 8266
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8267
-							$sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra';
8268
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8269
-							$sqlwhere .= " AND " . $InfoFieldList[4];
8267
+							$sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra';
8268
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8269
+							$sqlwhere .= " AND ".$InfoFieldList[4];
8270 8270
 						} else {
8271
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
8271
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
8272 8272
 						}
8273 8273
 					} else {
8274 8274
 						$sqlwhere .= ' WHERE 1=1';
@@ -8289,14 +8289,14 @@  discard block
 block discarded – undo
8289 8289
 
8290 8290
 					// Some tables may have field, some other not. For the moment we disable it.
8291 8291
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8292
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8292
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8293 8293
 					}
8294 8294
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
8295 8295
 					// print $sql;
8296 8296
 
8297 8297
 					$sql .= $sqlwhere;
8298 8298
 
8299
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
8299
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
8300 8300
 
8301 8301
 					$resql = $this->db->query($sql);
8302 8302
 					if ($resql) {
@@ -8315,7 +8315,7 @@  discard block
 block discarded – undo
8315 8315
 							if (count($fields_label) > 1) {
8316 8316
 								$notrans = true;
8317 8317
 								foreach ($fields_label as $field_toshow) {
8318
-									$labeltoshow .= $obj->$field_toshow . ' ';
8318
+									$labeltoshow .= $obj->$field_toshow.' ';
8319 8319
 								}
8320 8320
 							} else {
8321 8321
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8326,9 +8326,9 @@  discard block
 block discarded – undo
8326 8326
 								foreach ($fields_label as $field_toshow) {
8327 8327
 									$translabel = $langs->trans($obj->$field_toshow);
8328 8328
 									if ($translabel != $obj->$field_toshow) {
8329
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
8329
+										$labeltoshow = dol_trunc($translabel, 18).' ';
8330 8330
 									} else {
8331
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
8331
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
8332 8332
 									}
8333 8333
 								}
8334 8334
 
@@ -8351,7 +8351,7 @@  discard block
 block discarded – undo
8351 8351
 								}
8352 8352
 
8353 8353
 								if (!empty($InfoFieldList[3]) && $parentField) {
8354
-									$parent = $parentName . ':' . $obj->{$parentField};
8354
+									$parent = $parentName.':'.$obj->{$parentField};
8355 8355
 									$isDependList = 1;
8356 8356
 								}
8357 8357
 
@@ -8362,9 +8362,9 @@  discard block
 block discarded – undo
8362 8362
 						}
8363 8363
 						$this->db->free($resql);
8364 8364
 
8365
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8365
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8366 8366
 					} else {
8367
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8367
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8368 8368
 					}
8369 8369
 				} else {
8370 8370
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8376,7 +8376,7 @@  discard block
 block discarded – undo
8376 8376
 					}
8377 8377
 
8378 8378
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8379
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8379
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8380 8380
 				}
8381 8381
 			}
8382 8382
 		} elseif ($type == 'link') {
@@ -8411,7 +8411,7 @@  discard block
 block discarded – undo
8411 8411
 			// $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.
8412 8412
 
8413 8413
 			//$objectfield = $valparent;
8414
-			$objectfield = $val;			// Is better than using old method $valparent
8414
+			$objectfield = $val; // Is better than using old method $valparent
8415 8415
 
8416 8416
 			// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
8417 8417
 			$out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield);
@@ -8624,7 +8624,7 @@  discard block
 block discarded – undo
8624 8624
 			$value = $this->getLibStatut(3);
8625 8625
 		} elseif ($type == 'date') {
8626 8626
 			if (!empty($value)) {
8627
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8627
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8628 8628
 			} else {
8629 8629
 				$value = '';
8630 8630
 			}
@@ -8725,7 +8725,7 @@  discard block
 block discarded – undo
8725 8725
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8726 8726
 			if (strpos($value, "|") !== false) {
8727 8727
 				$value = $langs->trans(explode('|', $value)[0]);
8728
-			} elseif (! is_numeric($value)) {
8728
+			} elseif (!is_numeric($value)) {
8729 8729
 				$value = $langs->trans($value);
8730 8730
 			}
8731 8731
 		} elseif ($type == 'sellist') {
@@ -8787,9 +8787,9 @@  discard block
 block discarded – undo
8787 8787
 									$translabel = $langs->trans($obj->$field_toshow);
8788 8788
 								}
8789 8789
 								if ($translabel != $field_toshow) {
8790
-									$value .= dol_trunc($translabel, 18) . ' ';
8790
+									$value .= dol_trunc($translabel, 18).' ';
8791 8791
 								} else {
8792
-									$value .= $obj->$field_toshow . ' ';
8792
+									$value .= $obj->$field_toshow.' ';
8793 8793
 								}
8794 8794
 							}
8795 8795
 						} else {
@@ -8805,7 +8805,7 @@  discard block
 block discarded – undo
8805 8805
 						}
8806 8806
 					}
8807 8807
 				} else {
8808
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8808
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8809 8809
 
8810 8810
 					$toprint = array();
8811 8811
 					$obj = $this->db->fetch_object($resql);
@@ -8813,7 +8813,7 @@  discard block
 block discarded – undo
8813 8813
 					$c->fetch($obj->rowid);
8814 8814
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8815 8815
 					foreach ($ways as $way) {
8816
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8816
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8817 8817
 					}
8818 8818
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8819 8819
 				}
@@ -8829,11 +8829,11 @@  discard block
 block discarded – undo
8829 8829
 				$toprint = array();
8830 8830
 				foreach ($value_arr as $keyval => $valueval) {
8831 8831
 					if (!empty($valueval)) {
8832
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8832
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8833 8833
 					}
8834 8834
 				}
8835 8835
 				if (!empty($toprint)) {
8836
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8836
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8837 8837
 				}
8838 8838
 			}
8839 8839
 		} elseif ($type == 'chkbxlst') {
@@ -8888,9 +8888,9 @@  discard block
 block discarded – undo
8888 8888
 										$translabel = $langs->trans($obj->$field_toshow);
8889 8889
 									}
8890 8890
 									if ($translabel != $field_toshow) {
8891
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8891
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8892 8892
 									} else {
8893
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8893
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8894 8894
 									}
8895 8895
 								}
8896 8896
 							} else {
@@ -8899,15 +8899,15 @@  discard block
 block discarded – undo
8899 8899
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8900 8900
 								}
8901 8901
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8902
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8902
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8903 8903
 								} else {
8904
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8904
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8905 8905
 								}
8906 8906
 							}
8907 8907
 						}
8908 8908
 					}
8909 8909
 				} else {
8910
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8910
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8911 8911
 
8912 8912
 					$toprint = array();
8913 8913
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8916,7 +8916,7 @@  discard block
 block discarded – undo
8916 8916
 							$c->fetch($obj->rowid);
8917 8917
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8918 8918
 							foreach ($ways as $way) {
8919
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8919
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8920 8920
 							}
8921 8921
 						}
8922 8922
 					}
@@ -9086,7 +9086,7 @@  discard block
 block discarded – undo
9086 9086
 		global $langs;
9087 9087
 
9088 9088
 		if (!class_exists('Validate')) {
9089
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
9089
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
9090 9090
 		}
9091 9091
 
9092 9092
 		$this->clearFieldError($fieldKey);
@@ -9325,7 +9325,7 @@  discard block
 block discarded – undo
9325 9325
 				$out .= "\n";
9326 9326
 
9327 9327
 				$nbofextrafieldsshown = 0;
9328
-				$e = 0;	// var to manage the modulo (odd/even)
9328
+				$e = 0; // var to manage the modulo (odd/even)
9329 9329
 
9330 9330
 				$lastseparatorkeyfound = '';
9331 9331
 				$extrafields_collapse_num = '';
@@ -9363,9 +9363,9 @@  discard block
 block discarded – undo
9363 9363
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
9364 9364
 					} elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) {
9365 9365
 						// 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
9366
-						$ef_name = 'options_' . $key;
9366
+						$ef_name = 'options_'.$key;
9367 9367
 						$ef_value = $this->array_options[$ef_name];
9368
-						$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
9368
+						$out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n";
9369 9369
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
9370 9370
 					} elseif ($mode == 'view' && empty($visibility)) {
9371 9371
 						continue;
@@ -10455,7 +10455,7 @@  discard block
 block discarded – undo
10455 10455
 						continue;
10456 10456
 					}
10457 10457
 				}
10458
-				$keys_with_alias[] = $alias . '.' . $fieldname;
10458
+				$keys_with_alias[] = $alias.'.'.$fieldname;
10459 10459
 			}
10460 10460
 			return implode(', ', $keys_with_alias);
10461 10461
 		} else {
@@ -10599,7 +10599,7 @@  discard block
 block discarded – undo
10599 10599
 		if (!$error) {
10600 10600
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10601 10601
 			$sql .= " (".implode(", ", $keys).')';
10602
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10602
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10603 10603
 
10604 10604
 			$res = $this->db->query($sql);
10605 10605
 			if (!$res) {
@@ -10913,7 +10913,7 @@  discard block
 block discarded – undo
10913 10913
 
10914 10914
 		// Update extrafield
10915 10915
 		if (!$error) {
10916
-			$result = $this->insertExtraFields();	// This update extrafields
10916
+			$result = $this->insertExtraFields(); // This update extrafields
10917 10917
 			if ($result < 0) {
10918 10918
 				$error++;
10919 10919
 			}
@@ -11137,12 +11137,12 @@  discard block
 block discarded – undo
11137 11137
 				$error++;
11138 11138
 			} else {
11139 11139
 				while ($obj = $this->db->fetch_object($resql)) {
11140
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
11140
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
11141 11141
 					if ($result < 0) {
11142 11142
 						$error++;
11143 11143
 						$this->errors[] = $this->error;
11144 11144
 					} else {
11145
-						$result = $this->delete($user);	// @phpstan-ignore-line
11145
+						$result = $this->delete($user); // @phpstan-ignore-line
11146 11146
 						if ($result < 0) {
11147 11147
 							$error++;
11148 11148
 							$this->errors[] = $this->error;
@@ -11309,7 +11309,7 @@  discard block
 block discarded – undo
11309 11309
 		);
11310 11310
 		foreach ($fields as $key => $value) {
11311 11311
 			if (array_key_exists($key, $this->fields)) {
11312
-				$this->{$key} = $value;		// @phpstan-ignore-line
11312
+				$this->{$key} = $value; // @phpstan-ignore-line
11313 11313
 			}
11314 11314
 		}
11315 11315
 
Please login to merge, or discard this patch.
htdocs/accountancy/class/bookkeeping.class.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			$this->credit = 0.0;
299 299
 		}
300 300
 
301
-		$result = $this->validBookkeepingDate($this->doc_date);	// Check date according to ACCOUNTANCY_FISCAL_PERIOD_MODE.
301
+		$result = $this->validBookkeepingDate($this->doc_date); // Check date according to ACCOUNTANCY_FISCAL_PERIOD_MODE.
302 302
 		if ($result < 0) {
303 303
 			return -1;
304 304
 		} elseif ($result == 0) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				if (empty($this->piece_num)) {
388 388
 					$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
389 389
 					$sqlnum .= " FROM ".$this->db->prefix().$this->table_element;
390
-					$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
390
+					$sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
391 391
 
392 392
 					$resqlnum = $this->db->query($sqlnum);
393 393
 					if ($resqlnum) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		}
488 488
 
489 489
 		// Call triggers
490
-		if (! $error && ! $notrigger) {
490
+		if (!$error && !$notrigger) {
491 491
 			$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
492 492
 			if ($result < 0) {
493 493
 				$error++;
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
636 636
 
637 637
 		global $action;
638
-		$hookmanager->initHooks(array($this->element . 'dao'));
638
+		$hookmanager->initHooks(array($this->element.'dao'));
639 639
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
640 640
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
641 641
 		if ($reshook > 0) {
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 		if (!$error) {
805 805
 			$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element.$mode);
806 806
 			// Call triggers
807
-			if (! $notrigger) {
807
+			if (!$notrigger) {
808 808
 				$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
809 809
 				if ($result < 0) {
810 810
 					$error++;
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		$sql .= " t.date_validated as date_validation";
871 871
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.$mode.' as t';
872 872
 		$sql .= ' WHERE 1 = 1';
873
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
873
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
874 874
 		if (null !== $ref) {
875 875
 			$sql .= " AND t.rowid = ".((int) $ref);
876 876
 		} else {
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			}
1047 1047
 		}
1048 1048
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1049
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1049
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1050 1050
 		if (count($sqlwhere) > 0) {
1051 1051
 			$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
1052 1052
 		}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		$sql .= " t.date_export,";
1182 1182
 		$sql .= " t.date_validated as date_validation";
1183 1183
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1184
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1184
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1185 1185
 		if ($showAlreadyExportMovements == 0) {
1186 1186
 			$sql .= " AND t.date_export IS NULL";
1187 1187
 		}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 		$sql .= " SUM(t.debit) as debit,";
1352 1352
 		$sql .= " SUM(t.credit) as credit";
1353 1353
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1354
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1354
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1355 1355
 
1356 1356
 		// Manage filter
1357 1357
 		if (is_array($filter)) {
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 		}
1579 1579
 
1580 1580
 		// Call triggers
1581
-		if (! $error && ! $notrigger) {
1581
+		if (!$error && !$notrigger) {
1582 1582
 			$result = $this->call_trigger('BOOKKEEPING_MODIFY', $user);
1583 1583
 			if ($result < 0) {
1584 1584
 				$error++;
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element.$mode;
1622 1622
 		$sql .= " SET ".$this->db->sanitize($field)." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'");
1623 1623
 		$sql .= " WHERE piece_num = ".((int) $piece_num);
1624
-		$sql .= " AND entity = " . ((int) $conf->entity);
1624
+		$sql .= " AND entity = ".((int) $conf->entity);
1625 1625
 		$sql .= $sql_filter;
1626 1626
 
1627 1627
 		$resql = $this->db->query($sql);
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 		if (!empty($journal)) {
1777 1777
 			$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
1778 1778
 		}
1779
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1779
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1780 1780
 		// Exclusion of validated entries at the time of deletion
1781 1781
 		$sql .= " AND date_validated IS NULL";
1782 1782
 		$sql .= $sql_filter;
@@ -1834,8 +1834,8 @@  discard block
 block discarded – undo
1834 1834
 			$sql = "DELETE";
1835 1835
 			$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1836 1836
 			$sql .= " WHERE piece_num = ".(int) $piecenum;
1837
-			$sql .= " AND date_validated IS NULL";		// For security, exclusion of validated entries at the time of deletion
1838
-			$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1837
+			$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
1838
+			$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1839 1839
 			$sql .= $sql_filter;
1840 1840
 
1841 1841
 			$resql = $this->db->query($sql);
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 		}
1970 1970
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1971 1971
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1972
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1972
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1973 1973
 
1974 1974
 		dol_syslog(__METHOD__, LOG_DEBUG);
1975 1975
 		$result = $this->db->query($sql);
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 		global $conf;
2012 2012
 
2013 2013
 		$sql = "SELECT MAX(piece_num) + 1 as max FROM ".$this->db->prefix().$this->table_element.$mode;
2014
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2014
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2015 2015
 
2016 2016
 		dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG);
2017 2017
 
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
 		if (getDolGlobalString('BOOKKEEPING_ADDON')) {
2048 2048
 			$mybool = false;
2049 2049
 
2050
-			$file = getDolGlobalString('BOOKKEEPING_ADDON') . ".php";
2050
+			$file = getDolGlobalString('BOOKKEEPING_ADDON').".php";
2051 2051
 			$classname = getDolGlobalString('BOOKKEEPING_ADDON');
2052 2052
 
2053 2053
 			// Include file with class
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 		}
2108 2108
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
2109 2109
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
2110
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2110
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2111 2111
 
2112 2112
 		dol_syslog(__METHOD__, LOG_DEBUG);
2113 2113
 		$result = $this->db->query($sql);
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
 		$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
2173 2173
 		$sql .= " date_validated as date_validation";
2174 2174
 		$sql .= " FROM ".$this->db->prefix().$this->table_element;
2175
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2175
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2176 2176
 
2177 2177
 		dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
2178 2178
 
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 
2258 2258
 			if (!$error) {
2259 2259
 				// Delete if there is an empty line
2260
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2260
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2261 2261
 				$resql = $this->db->query($sql);
2262 2262
 				if (!$resql) {
2263 2263
 					$error++;
@@ -2271,11 +2271,11 @@  discard block
 block discarded – undo
2271 2271
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2272 2272
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2273 2273
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
2274
-				$sql .= ' SELECT doc_date, doc_type,' . "'{$ref}',";
2274
+				$sql .= ' SELECT doc_date, doc_type,'."'{$ref}',";
2275 2275
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2276 2276
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2277 2277
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
2278
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
2278
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity);
2279 2279
 				$sql .= $sql_filter;
2280 2280
 				$resql = $this->db->query($sql);
2281 2281
 				if (!$resql) {
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
 			}
2287 2287
 
2288 2288
 			if (!$error) {
2289
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2289
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2290 2290
 				$resql = $this->db->query($sql);
2291 2291
 				if (!$resql) {
2292 2292
 					$error++;
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 				}
2296 2296
 			}
2297 2297
 		} elseif ($direction == 1) {
2298
-			$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2298
+			$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2299 2299
 			$resql = $this->db->query($sql);
2300 2300
 			if (!$resql) {
2301 2301
 				$error++;
@@ -2308,11 +2308,11 @@  discard block
 block discarded – undo
2308 2308
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2309 2309
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2310 2310
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
2311
-				$sql .= ' SELECT doc_date, doc_type,' . "'{$ref}',";
2311
+				$sql .= ' SELECT doc_date, doc_type,'."'{$ref}',";
2312 2312
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2313 2313
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2314 2314
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
2315
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2315
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2316 2316
 				$sql .= $sql_filter;
2317 2317
 				$resql = $this->db->query($sql);
2318 2318
 				if (!$resql) {
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 			}
2324 2324
 
2325 2325
 			if (!$error) {
2326
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2326
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2327 2327
 				$sql .= $sql_filter;
2328 2328
 				$resql = $this->db->query($sql);
2329 2329
 				if (!$resql) {
@@ -2380,7 +2380,7 @@  discard block
 block discarded – undo
2380 2380
 		$sql .= " AND aa.active = 1";
2381 2381
 		$sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
2382 2382
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2383
-		$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2383
+		$sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2384 2384
 		$sql .= " ORDER BY account_number ASC";
2385 2385
 
2386 2386
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
2445 2445
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
2446 2446
 		$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
2447
-		$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2447
+		$sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2448 2448
 
2449 2449
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2450 2450
 		$resql = $this->db->query($sql);
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2485 2485
 		$sql .= " AND aa.active = 1";
2486 2486
 		$sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
2487
-		$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2487
+		$sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2488 2488
 
2489 2489
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2490 2490
 		$resql = $this->db->query($sql);
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 		global $conf;
2518 2518
 
2519 2519
 		$alias = trim($alias);
2520
-		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias;
2520
+		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias;
2521 2521
 
2522 2522
 		if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) {
2523 2523
 			$result = $this->loadFiscalPeriods($force, 'active');
@@ -2530,10 +2530,10 @@  discard block
 block discarded – undo
2530 2530
 				$i = 0;
2531 2531
 				foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) {
2532 2532
 					$sql_list[$i] = "(";
2533
-					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date";
2533
+					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date";
2534 2534
 					if (!empty($fiscal_period['date_end'])) {
2535 2535
 						$sql_list[$i] .= " AND ";
2536
-						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'";
2536
+						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'";
2537 2537
 					}
2538 2538
 					$sql_list[$i] .= ")";
2539 2539
 					$i++;
@@ -2628,10 +2628,10 @@  discard block
 block discarded – undo
2628 2628
 				$accountingLabelOperation = $thirdpartyname;
2629 2629
 			}
2630 2630
 			if (!empty($reference)) {
2631
-				$accountingLabelOperation .= ' - '. $reference;
2631
+				$accountingLabelOperation .= ' - '.$reference;
2632 2632
 			}
2633 2633
 			if (!empty($labelaccount)) {
2634
-				$accountingLabelOperation .= ' - '. $labelaccount;
2634
+				$accountingLabelOperation .= ' - '.$labelaccount;
2635 2635
 			}
2636 2636
 		} elseif (getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) {
2637 2637
 			$truncThirdpartyName = 32;
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
 				$accountingLabelOperation = $thirdpartyname;
2643 2643
 			}
2644 2644
 			if (!empty($reference)) {
2645
-				$accountingLabelOperation .= ' - '. $reference;
2645
+				$accountingLabelOperation .= ' - '.$reference;
2646 2646
 			}
2647 2647
 		} elseif (getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) {
2648 2648
 			$truncThirdpartyName = 64;
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 		if ($mode == 'active') {
2716 2716
 			if (!isset($conf->cache['active_fiscal_period_cached']) || $force) {
2717 2717
 				$sql = "SELECT date_start, date_end";
2718
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2719
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2718
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2719
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2720 2720
 				$sql .= " AND statut = 0";
2721 2721
 
2722 2722
 				$resql = $this->db->query($sql);
@@ -2738,8 +2738,8 @@  discard block
 block discarded – undo
2738 2738
 		if ($mode == 'closed') {
2739 2739
 			if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) {
2740 2740
 				$sql = "SELECT date_start, date_end";
2741
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2742
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2741
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2742
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2743 2743
 				$sql .= " AND statut = 1";
2744 2744
 
2745 2745
 				$resql = $this->db->query($sql);
@@ -2773,8 +2773,8 @@  discard block
 block discarded – undo
2773 2773
 		$list = array();
2774 2774
 
2775 2775
 		$sql = "SELECT rowid, label, date_start, date_end, statut";
2776
-		$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2777
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2776
+		$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2777
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2778 2778
 		$sql .= $this->db->order('date_start', 'ASC');
2779 2779
 
2780 2780
 		$resql = $this->db->query($sql);
@@ -2813,13 +2813,13 @@  discard block
 block discarded – undo
2813 2813
 
2814 2814
 		$sql = "SELECT YEAR(b.doc_date) as year";
2815 2815
 		for ($i = 1; $i <= 12; $i++) {
2816
-			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i);
2816
+			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i);
2817 2817
 		}
2818 2818
 		$sql .= ", COUNT(b.rowid) as total";
2819
-		$sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b";
2820
-		$sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'";
2821
-		$sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'";
2822
-		$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
2819
+		$sql .= " FROM ".$this->db->prefix().$this->table_element." as b";
2820
+		$sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'";
2821
+		$sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'";
2822
+		$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
2823 2823
 
2824 2824
 		// Get count for each month into the fiscal period
2825 2825
 		if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
 			$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.'accounting_fiscalyear as af WHERE b.doc_date >= af.date_start AND b.doc_date <= af.date_end AND af.entity = '.((int) $conf->entity)." AND af.statut = 1)";
2828 2828
 		} else {
2829 2829
 			// Filter on the unitary flag/date lock on each record
2830
-			$sql .= " AND date_validated IS NULL";	// not locked
2830
+			$sql .= " AND date_validated IS NULL"; // not locked
2831 2831
 		}
2832 2832
 
2833 2833
 		$sql .= " GROUP BY YEAR(b.doc_date)";
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
 				'total' => (int) $obj->total,
2849 2849
 			);
2850 2850
 			for ($i = 1; $i <= 12; $i++) {
2851
-				$year_list['count'][$i] = (int) $obj->{'month' . $i};
2851
+				$year_list['count'][$i] = (int) $obj->{'month'.$i};
2852 2852
 			}
2853 2853
 
2854 2854
 			$list[] = $year_list;
@@ -2876,11 +2876,11 @@  discard block
 block discarded – undo
2876 2876
 		$now = dol_now();
2877 2877
 
2878 2878
 		// Specify as export : update field date_validated on selected month/year
2879
-		$sql = " UPDATE " . $this->db->prefix() . $this->table_element;
2880
-		$sql .= " SET date_validated = '" . $this->db->idate($now) . "'";
2881
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2882
-		$sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'";
2883
-		$sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'";
2879
+		$sql = " UPDATE ".$this->db->prefix().$this->table_element;
2880
+		$sql .= " SET date_validated = '".$this->db->idate($now)."'";
2881
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2882
+		$sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'";
2883
+		$sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'";
2884 2884
 		$sql .= " AND date_validated IS NULL";
2885 2885
 
2886 2886
 		dol_syslog(__METHOD__, LOG_DEBUG);
@@ -2913,27 +2913,27 @@  discard block
 block discarded – undo
2913 2913
 
2914 2914
 			$pcg_type_filter = array();
2915 2915
 			foreach ($accounting_groups_used_for_income_statement as $item) {
2916
-				$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2916
+				$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2917 2917
 			}
2918 2918
 
2919 2919
 			$sql = 'SELECT';
2920 2920
 			$sql .= " t.numero_compte,";
2921 2921
 			$sql .= " aa.pcg_type,";
2922 2922
 			$sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result";
2923
-			$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2924
-			$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2925
-			$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2926
-			$sql .= " AND aa.entity = " . ((int) $conf->entity);
2927
-			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')';
2928
-			$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2929
-			$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
2930
-			$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
2923
+			$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2924
+			$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2925
+			$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2926
+			$sql .= " AND aa.entity = ".((int) $conf->entity);
2927
+			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2928
+			$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2929
+			$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
2930
+			$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
2931 2931
 			$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2932 2932
 
2933 2933
 			$resql = $this->db->query($sql);
2934 2934
 			if (!$resql) {
2935
-				$this->errors[] = 'Error ' . $this->db->lasterror();
2936
-				dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2935
+				$this->errors[] = 'Error '.$this->db->lasterror();
2936
+				dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2937 2937
 			} else {
2938 2938
 				while ($obj = $this->db->fetch_object($resql)) {
2939 2939
 					$income_statement_amount += $obj->accounting_result;
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 			return -1;
2973 2973
 		} elseif (empty($fiscal_period->id)) {
2974 2974
 			$langs->loadLangs(array('errors', 'compta'));
2975
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
2975
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
2976 2976
 			return -1;
2977 2977
 		}
2978 2978
 
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 			return -1;
2992 2992
 		} elseif (empty($new_fiscal_period->id)) {
2993 2993
 			$langs->loadLangs(array('errors', 'compta'));
2994
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
2994
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
2995 2995
 			return -1;
2996 2996
 		}
2997 2997
 
@@ -3011,7 +3011,7 @@  discard block
 block discarded – undo
3011 3011
 			$journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL'));
3012 3012
 			if (empty($journal_id)) {
3013 3013
 				$langs->loadLangs(array('errors', 'accountancy'));
3014
-				$this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
3014
+				$this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
3015 3015
 				$error++;
3016 3016
 			}
3017 3017
 
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
 					$error++;
3026 3026
 				} elseif ($result == 0) {
3027 3027
 					$langs->loadLangs(array('errors', 'accountancy'));
3028
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
3028
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
3029 3029
 					$error++;
3030 3030
 				}
3031 3031
 			} else {
@@ -3039,7 +3039,7 @@  discard block
 block discarded – undo
3039 3039
 				$pcg_type_filter = array();
3040 3040
 				$tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement);
3041 3041
 				foreach ($tmp as $item) {
3042
-					$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
3042
+					$pcg_type_filter[] = "'".$this->db->escape($item)."'";
3043 3043
 				}
3044 3044
 
3045 3045
 				$sql = 'SELECT';
@@ -3049,14 +3049,14 @@  discard block
 block discarded – undo
3049 3049
 				}
3050 3050
 				$sql .= " aa.pcg_type,";
3051 3051
 				$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
3052
-				$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3053
-				$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
3054
-				$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3055
-				$sql .= " AND aa.entity = ". ((int) $conf->entity);
3052
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3053
+				$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
3054
+				$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3055
+				$sql .= " AND aa.entity = ".((int) $conf->entity);
3056 3056
 				$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
3057
-				$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
3058
-				$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3059
-				$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3057
+				$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
3058
+				$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3059
+				$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3060 3060
 				$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
3061 3061
 				if ($separate_auxiliary_account) {
3062 3062
 					$sql .= " , NULLIF(t.subledger_account, '')";
@@ -3066,8 +3066,8 @@  discard block
 block discarded – undo
3066 3066
 
3067 3067
 				$resql = $this->db->query($sql);
3068 3068
 				if (!$resql) {
3069
-					$this->errors[] = 'Error ' . $this->db->lasterror();
3070
-					dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3069
+					$this->errors[] = 'Error '.$this->db->lasterror();
3070
+					dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3071 3071
 
3072 3072
 					$error++;
3073 3073
 				} else {
@@ -3096,14 +3096,14 @@  discard block
 block discarded – undo
3096 3096
 								$bookkeeping->subledger_account = $obj->subledger_account;
3097 3097
 								$sql = 'SELECT';
3098 3098
 								$sql .= " subledger_label";
3099
-								$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
3100
-								$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
3099
+								$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
3100
+								$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
3101 3101
 								$sql .= " ORDER BY doc_date DESC";
3102 3102
 								$sql .= " LIMIT 1";
3103 3103
 								$result = $this->db->query($sql);
3104 3104
 								if (!$result) {
3105
-									$this->errors[] = 'Error: ' . $this->db->lasterror();
3106
-									dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3105
+									$this->errors[] = 'Error: '.$this->db->lasterror();
3106
+									dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3107 3107
 									$error++;
3108 3108
 								}
3109 3109
 								$objtmp = $this->db->fetch_object($result);
@@ -3159,14 +3159,14 @@  discard block
 block discarded – undo
3159 3159
 							$bookkeeping->subledger_account = $obj->subledger_account;
3160 3160
 							$sql = 'SELECT';
3161 3161
 							$sql .= " subledger_label";
3162
-							$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
3163
-							$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
3162
+							$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
3163
+							$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
3164 3164
 							$sql .= " ORDER BY doc_date DESC";
3165 3165
 							$sql .= " LIMIT 1";
3166 3166
 							$result = $this->db->query($sql);
3167 3167
 							if (!$result) {
3168
-								$this->errors[] = 'Error: ' . $this->db->lasterror();
3169
-								dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3168
+								$this->errors[] = 'Error: '.$this->db->lasterror();
3169
+								dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3170 3170
 								$error++;
3171 3171
 							}
3172 3172
 							$objtmp = $this->db->fetch_object($result);
@@ -3238,7 +3238,7 @@  discard block
 block discarded – undo
3238 3238
 			return -1;
3239 3239
 		} elseif (empty($fiscal_period->id)) {
3240 3240
 			$langs->loadLangs(array('errors', 'compta'));
3241
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
3241
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
3242 3242
 			return -1;
3243 3243
 		}
3244 3244
 
@@ -3257,7 +3257,7 @@  discard block
 block discarded – undo
3257 3257
 			return -1;
3258 3258
 		} elseif (empty($new_fiscal_period->id)) {
3259 3259
 			$langs->loadLangs(array('errors', 'compta'));
3260
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
3260
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
3261 3261
 			return -1;
3262 3262
 		}
3263 3263
 
@@ -3277,7 +3277,7 @@  discard block
 block discarded – undo
3277 3277
 			return -1;
3278 3278
 		} elseif ($result == 0) {
3279 3279
 			$langs->loadLangs(array('errors', 'accountancy'));
3280
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal');
3280
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal');
3281 3281
 			return -1;
3282 3282
 		}
3283 3283
 
@@ -3285,18 +3285,18 @@  discard block
 block discarded – undo
3285 3285
 		$this->db->begin();
3286 3286
 
3287 3287
 		$sql = 'SELECT t.rowid';
3288
-		$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3289
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3290
-		$sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'";
3291
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
3292
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
3293
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3294
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3288
+		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3289
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3290
+		$sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'";
3291
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
3292
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
3293
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3294
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3295 3295
 
3296 3296
 		$resql = $this->db->query($sql);
3297 3297
 		if (!$resql) {
3298
-			$this->errors[] = 'Error ' . $this->db->lasterror();
3299
-			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3298
+			$this->errors[] = 'Error '.$this->db->lasterror();
3299
+			dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3300 3300
 
3301 3301
 			$error++;
3302 3302
 		} else {
@@ -3311,7 +3311,7 @@  discard block
 block discarded – undo
3311 3311
 					break;
3312 3312
 				} elseif ($result == 0) {
3313 3313
 					$langs->loadLangs(array('errors', 'accountancy'));
3314
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid;
3314
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid;
3315 3315
 					$error++;
3316 3316
 					break;
3317 3317
 				}
@@ -3377,16 +3377,16 @@  discard block
 block discarded – undo
3377 3377
 			$echecT = [];
3378 3378
 			foreach ($toselect as $id) {
3379 3379
 				if ($bookkeeping->fetch($id)) {
3380
-					if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) {
3380
+					if (!getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')) {
3381 3381
 						$accountcustcode = '411';
3382 3382
 					} else $accountcustcode = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
3383 3383
 
3384
-					if ( !getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) {
3384
+					if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) {
3385 3385
 						$accountsuppcode = '401';
3386 3386
 					} else $accountsuppcode = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
3387 3387
 
3388 3388
 					if (strpos($bookkeeping->numero_compte, $accountcustcode) === 0 || strpos($bookkeeping->numero_compte, $accountsuppcode) === 0) {
3389
-						$echecT[]=$bookkeeping->numero_compte;
3389
+						$echecT[] = $bookkeeping->numero_compte;
3390 3390
 						continue;
3391 3391
 					}
3392 3392
 
@@ -3413,9 +3413,9 @@  discard block
 block discarded – undo
3413 3413
 		}
3414 3414
 
3415 3415
 		if ($nb > 1) {
3416
-			setEventMessages($nb ." " . $langs->trans('AssignAccountsSuccess'), null, 'mesgs');
3416
+			setEventMessages($nb." ".$langs->trans('AssignAccountsSuccess'), null, 'mesgs');
3417 3417
 		} elseif ($nb > 0) {
3418
-			setEventMessages($nb ." " . $langs->trans('AssignAccountSuccess'), null, 'mesgs');
3418
+			setEventMessages($nb." ".$langs->trans('AssignAccountSuccess'), null, 'mesgs');
3419 3419
 		} else {
3420 3420
 			setEventMessages($langs->trans('AssignAccountError'), null, 'errors');
3421 3421
 			$error++;
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
 
3424 3424
 		if (!empty($echecImplode)) {
3425 3425
 			$nbEchec = count(explode(',', $echecImplode));
3426
-			setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber') . ' ' . $echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber') . ' ' . $echecImplode, null, 'errors'
3426
+			setEventMessages($nbEchec == 1 ? $langs->trans('NoAccountChangedWithAccountNumber').' '.$echecImplode : $langs->trans('NoAccountsChangedWithAccountNumber').' '.$echecImplode, null, 'errors'
3427 3427
 			);
3428 3428
 		}
3429 3429
 
@@ -3464,7 +3464,7 @@  discard block
 block discarded – undo
3464 3464
 				setEventMessages($langs->trans('ErrorBookkeepingDocDateIsOnAClosedFiscalPeriod'), null, 'errors');
3465 3465
 			} else {
3466 3466
 				setEventMessages($langs->trans('ErrorBookkeepingDocDateNotOnActiveFiscalPeriod'), null, 'errors');
3467
-				header("Location: " . $_SERVER['HTTP_REFERER']);
3467
+				header("Location: ".$_SERVER['HTTP_REFERER']);
3468 3468
 			}
3469 3469
 			$error++;
3470 3470
 			return -1;
@@ -3475,7 +3475,7 @@  discard block
 block discarded – undo
3475 3475
 		$pieceNumNext = $bookKeepingInstance->getNextNumMvt();
3476 3476
 
3477 3477
 		$cloneId = [];
3478
-		$sqlRowidClone = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = ".((int) $piecenum);
3478
+		$sqlRowidClone = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = ".((int) $piecenum);
3479 3479
 		$resqlRowidClone = $this->db->query($sqlRowidClone);
3480 3480
 
3481 3481
 		if ($resqlRowidClone) {
@@ -3491,27 +3491,27 @@  discard block
 block discarded – undo
3491 3491
 
3492 3492
 					$sql = "SELECT piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, fk_user_author, doc_ref,";
3493 3493
 					$sql .= " fk_doc, fk_docdet, debit, credit, journal_label, sens, montant";
3494
-					$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
3495
-					$sql .= " WHERE rowid = " . ((int) $toselectid);
3494
+					$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
3495
+					$sql .= " WHERE rowid = ".((int) $toselectid);
3496 3496
 					$resql = $this->db->query($sql);
3497 3497
 
3498 3498
 					if ($resql) {
3499 3499
 						while ($obj = $this->db->fetch_object($resql)) {
3500 3500
 							$docRef = $langs->trans('CloneOf', $obj->doc_ref);
3501 3501
 
3502
-							$sql_insert = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping";
3502
+							$sql_insert = "INSERT INTO ".MAIN_DB_PREFIX."accounting_bookkeeping";
3503 3503
 							$sql_insert .= " (piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, doc_date, fk_user_author, doc_ref,";
3504 3504
 							$sql_insert .= " fk_doc, fk_docdet, debit, credit, date_creation, journal_label, sens, montant)";
3505 3505
 							$sql_insert .= " VALUES";
3506
-							$sql_insert .= " (" . ((int) $pieceNumNext) . ", '" . $this->db->escape($obj->label_operation) . "', '" . $this->db->escape($obj->numero_compte) . "', '" . $this->db->escape($obj->label_compte) . "', '" . $this->db->escape($obj->doc_type) . "', '" . $this->db->escape($code_journal) . "', '" . $this->db->idate($docdate) . "', '" . $this->db->escape($obj->fk_user_author) . "', '" . $this->db->escape($docRef) . "', ";
3507
-							$sql_insert .= " ". ((int) $obj->fk_doc) . ", " . ((int) $obj->fk_docdet) . ", " . (float) $obj->debit . ", " . (float) $obj->credit . ", '" . $this->db->idate($docdate) . "', '" . $this->db->escape($journal_label) . "', '" . $this->db->escape($obj->sens) . "', " . (float) $obj->montant . ")";
3506
+							$sql_insert .= " (".((int) $pieceNumNext).", '".$this->db->escape($obj->label_operation)."', '".$this->db->escape($obj->numero_compte)."', '".$this->db->escape($obj->label_compte)."', '".$this->db->escape($obj->doc_type)."', '".$this->db->escape($code_journal)."', '".$this->db->idate($docdate)."', '".$this->db->escape($obj->fk_user_author)."', '".$this->db->escape($docRef)."', ";
3507
+							$sql_insert .= " ".((int) $obj->fk_doc).", ".((int) $obj->fk_docdet).", ".(float) $obj->debit.", ".(float) $obj->credit.", '".$this->db->idate($docdate)."', '".$this->db->escape($journal_label)."', '".$this->db->escape($obj->sens)."', ".(float) $obj->montant.")";
3508 3508
 
3509 3509
 							$resqlInsert = $this->db->query($sql_insert);
3510 3510
 
3511 3511
 							if ($resqlInsert) {
3512 3512
 								setEventMessages($langs->trans('CloningSuccess', $pieceNumNext), null, 'mesgs');
3513 3513
 							} else {
3514
-								setEventMessages($langs->trans('CloningFailed') . $this->db->lasterror(), null, 'errors');
3514
+								setEventMessages($langs->trans('CloningFailed').$this->db->lasterror(), null, 'errors');
3515 3515
 								$error++;
3516 3516
 							}
3517 3517
 						}
@@ -3552,7 +3552,7 @@  discard block
 block discarded – undo
3552 3552
 		$idImplodeSelect = implode(',', $toselect);
3553 3553
 		$pieceNumT = [];
3554 3554
 
3555
-		$sqlPieceNum = "SELECT DISTINCT(piece_num) FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplodeSelect).")";
3555
+		$sqlPieceNum = "SELECT DISTINCT(piece_num) FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplodeSelect).")";
3556 3556
 		$resqlPieceNum = $this->db->query($sqlPieceNum);
3557 3557
 
3558 3558
 		if ($resqlPieceNum) {
@@ -3572,7 +3572,7 @@  discard block
 block discarded – undo
3572 3572
 						setEventMessages($langs->trans('ErrorBookkeepingDocDateIsOnAClosedFiscalPeriod'), null, 'errors');
3573 3573
 					} else {
3574 3574
 						setEventMessages($langs->trans('ErrorBookkeepingDocDateNotOnActiveFiscalPeriod'), null, 'errors');
3575
-						header("Location: " . $_SERVER['HTTP_REFERER']);
3575
+						header("Location: ".$_SERVER['HTTP_REFERER']);
3576 3576
 					}
3577 3577
 					$error++;
3578 3578
 				}
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
 				$bookKeepingInstance = new BookKeeping($this->db);
3581 3581
 				$pieceNumNext = $bookKeepingInstance->getNextNumMvt();
3582 3582
 				$cloneId = [];
3583
-				$sqlRowidClone = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = $pieceNum";
3583
+				$sqlRowidClone = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = $pieceNum";
3584 3584
 				$resqlRowidClone = $this->db->query($sqlRowidClone);
3585 3585
 
3586 3586
 				if ($resqlRowidClone) {
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 							$code_journal = getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL') ? $code_journal : $bookKeeping->code_journal;
3595 3595
 							$journal_label = getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL') ? $accountingJournal->label : $bookKeeping->journal_label;
3596 3596
 							$sql = "SELECT piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, fk_user_author, doc_ref, fk_doc, fk_docdet, debit, credit, journal_label, sens, montant ";
3597
-							$sql .= "FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid = " . ((int) $toselectid);
3597
+							$sql .= "FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid = ".((int) $toselectid);
3598 3598
 
3599 3599
 							$resql = $this->db->query($sql);
3600 3600
 							if ($resql) {
@@ -3605,10 +3605,10 @@  discard block
 block discarded – undo
3605 3605
 									$sql_insert .= " (piece_num, label_operation, numero_compte, label_compte, doc_type, code_journal, doc_date,";
3606 3606
 									$sql_insert .= " fk_user_author, doc_ref, fk_doc, fk_docdet, debit, credit, journal_label, sens, montant";
3607 3607
 									$sql_insert .= ")";
3608
-									$sql_insert .= " VALUES (" . ((int) $pieceNumNext) . ", '" . $this->db->escape($obj->label_operation) . "', '" . $this->db->escape($obj->numero_compte) . "',";
3609
-									$sql_insert .= " '" . $this->db->escape($obj->label_compte) . "', '" . $this->db->escape($obj->doc_type) . "', '" . $this->db->escape($code_journal) . "', '" . $this->db->idate($docdate)."',";
3610
-									$sql_insert .= " '" . $this->db->escape($obj->fk_user_author) . "', '" . $this->db->escape($docRef) . "', " . ((int) $obj->fk_doc) . ", " . ((int) $obj->fk_docdet) . ",";
3611
-									$sql_insert .= " " . (float) $obj->debit . ", " . (float) $obj->credit . ", '" . $this->db->escape($journal_label) . "', '" . $this->db->escape($obj->sens) . "', " . (float) $obj->montant;
3608
+									$sql_insert .= " VALUES (".((int) $pieceNumNext).", '".$this->db->escape($obj->label_operation)."', '".$this->db->escape($obj->numero_compte)."',";
3609
+									$sql_insert .= " '".$this->db->escape($obj->label_compte)."', '".$this->db->escape($obj->doc_type)."', '".$this->db->escape($code_journal)."', '".$this->db->idate($docdate)."',";
3610
+									$sql_insert .= " '".$this->db->escape($obj->fk_user_author)."', '".$this->db->escape($docRef)."', ".((int) $obj->fk_doc).", ".((int) $obj->fk_docdet).",";
3611
+									$sql_insert .= " ".(float) $obj->debit.", ".(float) $obj->credit.", '".$this->db->escape($journal_label)."', '".$this->db->escape($obj->sens)."', ".(float) $obj->montant;
3612 3612
 									$sql_insert .= ")";
3613 3613
 
3614 3614
 									$resqlInsert = $this->db->query($sql_insert);
@@ -3660,17 +3660,17 @@  discard block
 block discarded – undo
3660 3660
 		$accountingJournal->fetch(0, $code_journal);
3661 3661
 
3662 3662
 		$this->db->begin();
3663
-		$sqlAlreadyExtourne = "SELECT DISTINCT(piece_num) FROM " .MAIN_DB_PREFIX. "accounting_bookkeeping WHERE label_operation LIKE '%Extourne%'";
3663
+		$sqlAlreadyExtourne = "SELECT DISTINCT(piece_num) FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE label_operation LIKE '%Extourne%'";
3664 3664
 		$resqlAlreadyExtourne = $this->db->query($sqlAlreadyExtourne);
3665 3665
 		$alreadyExtourneT = array();
3666 3666
 		if ($resqlAlreadyExtourne) {
3667 3667
 			while ($obj4 = $this->db->fetch_object($resqlAlreadyExtourne)) {
3668
-				$alreadyExtourneT []= $obj4->piece_num;
3668
+				$alreadyExtourneT [] = $obj4->piece_num;
3669 3669
 			}
3670 3670
 		}
3671 3671
 
3672 3672
 		$idImplode = implode(',', $toselect);
3673
-		$sql1 = "SELECT DISTINCT(piece_num) from " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplode).")";
3673
+		$sql1 = "SELECT DISTINCT(piece_num) from ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE rowid IN (".$this->db->sanitize($idImplode).")";
3674 3674
 		$resql1 = $this->db->query($sql1);
3675 3675
 		$pieceNumT = [];
3676 3676
 
@@ -3684,7 +3684,7 @@  discard block
 block discarded – undo
3684 3684
 				$newBookKeepingInstance = new BookKeeping($this->db);
3685 3685
 				$pieceNumNext = $newBookKeepingInstance->getNextNumMvt();
3686 3686
 				$extourneIds = [];
3687
-				$sql2 = "SELECT rowid FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE piece_num = ".((int) $pieceNum);
3687
+				$sql2 = "SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE piece_num = ".((int) $pieceNum);
3688 3688
 				$resql2 = $this->db->query($sql2);
3689 3689
 
3690 3690
 				if ($resql2) {
@@ -3708,7 +3708,7 @@  discard block
 block discarded – undo
3708 3708
 									$newBookKeeping->sens = 'D';
3709 3709
 								}
3710 3710
 
3711
-								$newBookKeeping->label_operation = "Extourne " . $bookKeeping->piece_num . " - " . $bookKeeping->numero_compte . " - " . date('d/m/Y', dol_now()) . " - " . $i;
3711
+								$newBookKeeping->label_operation = "Extourne ".$bookKeeping->piece_num." - ".$bookKeeping->numero_compte." - ".date('d/m/Y', dol_now())." - ".$i;
3712 3712
 
3713 3713
 								$newBookKeeping->numero_compte = $bookKeeping->numero_compte;
3714 3714
 								$newBookKeeping->label_compte = $bookKeeping->label_compte;
Please login to merge, or discard this patch.
htdocs/public/webportal/tpl/header_login.tpl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 // Return HTML header
20 20
 ?>
21 21
 <!DOCTYPE html>
22
-<?php print '<html lang="'.substr($langs->defaultlang, 0, 2) . '">'."\n"; ?>
22
+<?php print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n"; ?>
23 23
 <head>
24 24
 	<meta charset="UTF-8">
25 25
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
Please login to merge, or discard this patch.
htdocs/public/webportal/tpl/header.tpl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@
 block discarded – undo
37 37
 // Return HTML header
38 38
 ?>
39 39
 <!DOCTYPE html>
40
-<?php print '<html lang="'.substr($langs->defaultlang, 0, 2) . '">'."\n"; ?>
40
+<?php print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n"; ?>
41 41
 <head>
42 42
 	<meta charset="UTF-8">
43 43
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
44 44
 	<meta http-equiv="X-UA-Compatible" content="ie=edge">
45 45
 	<title>
46
-		<?php print $title;	?>
46
+		<?php print $title; ?>
47 47
 	</title>
48 48
 	<?php
49 49
 
Please login to merge, or discard this patch.