Passed
Push — master ( 65bdac...4e88da )
by Alxarafe
32:38
created
Base/FormOther.php 1 patch
Spacing   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
      *    @param    int		$fk_user          Utilisateur créant le modèle
69 69
      *    @return	void
70 70
      */
71
-    function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null)
71
+    function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
72 72
     {
73 73
         // phpcs:enable
74 74
         $sql = "SELECT rowid, label";
75
-        $sql.= " FROM ".MAIN_DB_PREFIX."export_model";
76
-        $sql.= " WHERE type = '".$type."'";
77
-		if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user;
78
-        $sql.= " ORDER BY rowid";
75
+        $sql .= " FROM ".MAIN_DB_PREFIX."export_model";
76
+        $sql .= " WHERE type = '".$type."'";
77
+		if (!empty($fk_user)) $sql .= " AND fk_user=".$fk_user;
78
+        $sql .= " ORDER BY rowid";
79 79
         $result = $this->db->query($sql);
80 80
         if ($result)
81 81
         {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
      *    @param    int		$useempty          Affiche valeur vide dans liste
121 121
      *    @return	void
122 122
      */
123
-    function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0)
123
+    function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0)
124 124
     {
125 125
         // phpcs:enable
126 126
         $sql = "SELECT rowid, label";
127
-        $sql.= " FROM ".MAIN_DB_PREFIX."import_model";
128
-        $sql.= " WHERE type = '".$type."'";
129
-        $sql.= " ORDER BY rowid";
127
+        $sql .= " FROM ".MAIN_DB_PREFIX."import_model";
128
+        $sql .= " WHERE type = '".$type."'";
129
+        $sql .= " ORDER BY rowid";
130 130
         $result = $this->db->query($sql);
131 131
         if ($result)
132 132
         {
@@ -169,19 +169,19 @@  discard block
 block discarded – undo
169 169
      *    @param    string	$htmlname	Name of combo list
170 170
      *    @return	integer
171 171
      */
172
-    function select_ecotaxes($selected='', $htmlname='ecotaxe_id')
172
+    function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id')
173 173
     {
174 174
         // phpcs:enable
175 175
         global $langs;
176 176
 
177 177
         $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,";
178
-        $sql.= " c.label as country";
179
-        $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c";
180
-        $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid";
181
-        $sql.= " ORDER BY country, e.organization ASC, e.code ASC";
178
+        $sql .= " c.label as country";
179
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c";
180
+        $sql .= " WHERE e.active = 1 AND e.fk_pays = c.rowid";
181
+        $sql .= " ORDER BY country, e.organization ASC, e.code ASC";
182 182
 
183 183
     	dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG);
184
-        $resql=$this->db->query($sql);
184
+        $resql = $this->db->query($sql);
185 185
         if ($resql)
186 186
         {
187 187
             print '<select class="flat" name="'.$htmlname.'">';
@@ -228,26 +228,26 @@  discard block
 block discarded – undo
228 228
      *    @param    string	$country_code   Country Code
229 229
      *    @return	string					HTML select list
230 230
      */
231
-    function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='')
231
+    function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '')
232 232
     {
233 233
         // phpcs:enable
234 234
     	global $langs;
235 235
 
236
-    	$out='';
236
+    	$out = '';
237 237
 
238 238
     	$sql = "SELECT r.taux, r.revenuestamp_type";
239
-    	$sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c";
240
-    	$sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid";
241
-    	$sql.= " AND c.code = '".$country_code."'";
239
+    	$sql .= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c";
240
+    	$sql .= " WHERE r.active = 1 AND r.fk_pays = c.rowid";
241
+    	$sql .= " AND c.code = '".$country_code."'";
242 242
 
243 243
     	dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG);
244
-    	$resql=$this->db->query($sql);
244
+    	$resql = $this->db->query($sql);
245 245
     	if ($resql)
246 246
     	{
247
-    		$out.='<select class="flat" name="'.$htmlname.'">';
247
+    		$out .= '<select class="flat" name="'.$htmlname.'">';
248 248
     		$num = $this->db->num_rows($resql);
249 249
     		$i = 0;
250
-    		$out.='<option value="0">&nbsp;</option>'."\n";
250
+    		$out .= '<option value="0">&nbsp;</option>'."\n";
251 251
     		if ($num)
252 252
     		{
253 253
     			while ($i < $num)
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
     				$obj = $this->db->fetch_object($resql);
256 256
     				if (($selected && $selected == $obj->taux) || $num == 1)
257 257
     				{
258
-    					$out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>';
258
+    					$out .= '<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>';
259 259
     				}
260 260
     				else
261 261
     				{
262
-    					$out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>';
262
+    					$out .= '<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>';
263 263
     					//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
264 264
     				}
265
-    				$out.=$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '');
266
-    				$out.='</option>';
265
+    				$out .= $obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '');
266
+    				$out .= '</option>';
267 267
     				$i++;
268 268
     			}
269 269
     		}
270
-    		$out.='</select>';
270
+    		$out .= '</select>';
271 271
     		return $out;
272 272
     	}
273 273
     	else
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
      *    @param    int     $showempty      Add also an empty line
292 292
      *    @return   string					HTML select string
293 293
      */
294
-    function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0)
294
+    function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
295 295
     {
296 296
         // phpcs:enable
297
-        $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>';
298
-        if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'>&nbsp;</option>';
297
+        $return = '<select class="flat" name="'.$htmlname.'" '.($disabled ? 'disabled' : '').'>';
298
+        if ($showempty) $return .= '<option value="-1"'.(($selected == -1 || $selected == '') ? ' selected' : '').'>&nbsp;</option>';
299 299
 
300
-        for ($i = $start ; $i <= $end ; $i += $increment)
300
+        for ($i = $start; $i <= $end; $i += $increment)
301 301
         {
302 302
             if ($selected != '' && (int) $selected == $i)
303 303
             {
304
-                $return.= '<option value="'.$i.'" selected>';
304
+                $return .= '<option value="'.$i.'" selected>';
305 305
             }
306 306
             else
307 307
             {
308
-                $return.= '<option value="'.$i.'">';
308
+                $return .= '<option value="'.$i.'">';
309 309
             }
310
-            $return.= $i.' % ';
311
-            $return.= '</option>';
310
+            $return .= $i.' % ';
311
+            $return .= '</option>';
312 312
         }
313 313
 
314
-        $return.= '</select>';
314
+        $return .= '</select>';
315 315
 
316 316
         return $return;
317 317
     }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @return  string		        	Html combo list code
330 330
      * @see	select_all_categories
331 331
      */
332
-    function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='')
332
+    function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
333 333
     {
334 334
         // phpcs:enable
335 335
         global $conf, $langs;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         // For backward compatibility
339 339
         if (is_numeric($type))
340 340
         {
341
-            dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
341
+            dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
342 342
         }
343 343
 
344 344
         // Load list of "categories"
@@ -349,30 +349,30 @@  discard block
 block discarded – undo
349 349
         // Enhance with select2
350 350
         if ($conf->use_javascript_ajax)
351 351
         {
352
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
352
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
353 353
             $comboenhancement = ajax_combobox('select_categ_'.$htmlname);
354
-            $moreforfilter.=$comboenhancement;
354
+            $moreforfilter .= $comboenhancement;
355 355
         }
356 356
 
357 357
         // Print a select with each of them
358
-        $moreforfilter.='<select class="flat minwidth100'.($morecss?' '.$morecss:'').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
359
-        if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>';	// Should use -1 to say nothing
358
+        $moreforfilter .= '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
359
+        if ($showempty) $moreforfilter .= '<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
360 360
 
361 361
         if (is_array($tab_categs))
362 362
         {
363 363
             foreach ($tab_categs as $categ)
364 364
             {
365
-                $moreforfilter.='<option value="'.$categ['id'].'"';
366
-                if ($categ['id'] == $selected) $moreforfilter.=' selected';
367
-                $moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>';
365
+                $moreforfilter .= '<option value="'.$categ['id'].'"';
366
+                if ($categ['id'] == $selected) $moreforfilter .= ' selected';
367
+                $moreforfilter .= '>'.dol_trunc($categ['fulllabel'], 50, 'middle').'</option>';
368 368
             }
369 369
         }
370 370
         if ($nocateg)
371 371
         {
372 372
         	$langs->load("categories");
373
-        	$moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NotCategorized").' -</option>';
373
+        	$moreforfilter .= '<option value="-2"'.($selected == -2 ? ' selected' : '').'>- '.$langs->trans("NotCategorized").' -</option>';
374 374
         }
375
-        $moreforfilter.='</select>';
375
+        $moreforfilter .= '</select>';
376 376
 
377 377
         return $moreforfilter;
378 378
     }
@@ -390,44 +390,44 @@  discard block
 block discarded – undo
390 390
      *  @param	string	$morecss		More CSS
391 391
      *  @return string					Html combo list code
392 392
      */
393
-    function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1,$morecss='')
393
+    function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '')
394 394
     {
395 395
         // phpcs:enable
396
-        global $conf,$langs;
396
+        global $conf, $langs;
397 397
         $langs->load('users');
398 398
 
399 399
         $out = '';
400 400
         // Enhance with select2
401 401
         if ($conf->use_javascript_ajax)
402 402
         {
403
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
403
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
404 404
 
405 405
             $comboenhancement = ajax_combobox($htmlname);
406 406
             if ($comboenhancement)
407 407
             {
408
-            	$out.=$comboenhancement;
408
+            	$out .= $comboenhancement;
409 409
             }
410 410
         }
411 411
         // Select each sales and print them in a select input
412
-        $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
413
-        if ($showempty) $out.='<option value="0">&nbsp;</option>';
412
+        $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
413
+        if ($showempty) $out .= '<option value="0">&nbsp;</option>';
414 414
 
415 415
         // Get list of users allowed to be viewed
416 416
         $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
417
-        $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
418
-        $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
419
-        if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
420
-        if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id;
417
+        $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
418
+        $sql_usr .= " WHERE u.entity IN (0,".$conf->entity.")";
419
+        if (empty($user->rights->user->user->lire)) $sql_usr .= " AND u.rowid = ".$user->id;
420
+        if (!empty($user->societe_id)) $sql_usr .= " AND u.fk_soc = ".$user->societe_id;
421 421
         // Add existing sales representatives of thirdparty of external user
422 422
         if (empty($user->rights->user->user->lire) && $user->societe_id)
423 423
         {
424
-            $sql_usr.=" UNION ";
425
-            $sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
426
-            $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
427
-            $sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
428
-            $sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
424
+            $sql_usr .= " UNION ";
425
+            $sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
426
+            $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
427
+            $sql_usr .= " WHERE u2.entity IN (0,".$conf->entity.")";
428
+            $sql_usr .= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
429 429
         }
430
-	    $sql_usr.= " ORDER BY statut DESC, lastname ASC";  // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
430
+	    $sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
431 431
         //print $sql_usr;exit;
432 432
 
433 433
         $resql_usr = $this->db->query($sql_usr);
@@ -436,34 +436,34 @@  discard block
 block discarded – undo
436 436
             while ($obj_usr = $this->db->fetch_object($resql_usr))
437 437
             {
438 438
 
439
-                $out.='<option value="'.$obj_usr->rowid.'"';
439
+                $out .= '<option value="'.$obj_usr->rowid.'"';
440 440
 
441
-                if ($obj_usr->rowid == $selected) $out.=' selected';
441
+                if ($obj_usr->rowid == $selected) $out .= ' selected';
442 442
 
443
-                $out.='>';
444
-                $out.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname);
443
+                $out .= '>';
444
+                $out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
445 445
                 // Complete name with more info
446
-                $moreinfo=0;
447
-                if (! empty($conf->global->MAIN_SHOW_LOGIN))
446
+                $moreinfo = 0;
447
+                if (!empty($conf->global->MAIN_SHOW_LOGIN))
448 448
                 {
449
-                    $out.=($moreinfo?' - ':' (').$obj_usr->login;
449
+                    $out .= ($moreinfo ? ' - ' : ' (').$obj_usr->login;
450 450
                     $moreinfo++;
451 451
                 }
452 452
                 if ($showstatus >= 0)
453 453
                 {
454 454
 					if ($obj_usr->statut == 1 && $showstatus == 1)
455 455
 					{
456
-						$out.=($moreinfo?' - ':' (').$langs->trans('Enabled');
456
+						$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
457 457
 	                	$moreinfo++;
458 458
 					}
459 459
 					if ($obj_usr->statut == 0)
460 460
 					{
461
-						$out.=($moreinfo?' - ':' (').$langs->trans('Disabled');
461
+						$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
462 462
                 		$moreinfo++;
463 463
 					}
464 464
 				}
465
-				$out.=($moreinfo?')':'');
466
-                $out.='</option>';
465
+				$out .= ($moreinfo ? ')' : '');
466
+                $out .= '</option>';
467 467
             }
468 468
             $this->db->free($resql_usr);
469 469
         }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
         {
472 472
             dol_print_error($this->db);
473 473
         }
474
-        $out.='</select>';
474
+        $out .= '</select>';
475 475
 
476 476
         return $out;
477 477
     }
@@ -491,21 +491,21 @@  discard block
 block discarded – undo
491 491
      *  @param	string	$morecss				More css
492 492
      *  @return	void
493 493
      */
494
-    function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='')
494
+    function selectProjectTasks($selectedtask = '', $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '')
495 495
     {
496 496
         global $user, $langs;
497 497
 
498 498
         require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
499 499
 
500 500
         //print $modeproject.'-'.$modetask;
501
-        $task=new Task($this->db);
502
-        $tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus);
501
+        $task = new Task($this->db);
502
+        $tasksarray = $task->getTasksArray($modetask ? $user : 0, $modeproject ? $user : 0, $projectid, 0, $mode, '', $filteronprojstatus);
503 503
         if ($tasksarray)
504 504
         {
505
-        	print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
505
+        	print '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
506 506
             if ($useempty) print '<option value="0">&nbsp;</option>';
507
-            $j=0;
508
-            $level=0;
507
+            $j = 0;
508
+            $level = 0;
509 509
             $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid);
510 510
             print '</select>';
511 511
 
@@ -529,14 +529,14 @@  discard block
 block discarded – undo
529 529
      * @param	int		$disablechildoftaskid	1=Disable task that are child of the provided task id
530 530
      * @return	void
531 531
      */
532
-    private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0)
532
+    private function _pLineSelect(&$inc, $parent, $lines, $level = 0, $selectedtask = 0, $selectedproject = 0, $disablechildoftaskid = 0)
533 533
     {
534 534
         global $langs, $user, $conf;
535 535
 
536
-        $lastprojectid=0;
536
+        $lastprojectid = 0;
537 537
 
538
-        $numlines=count($lines);
539
-        for ($i = 0 ; $i < $numlines ; $i++)
538
+        $numlines = count($lines);
539
+        for ($i = 0; $i < $numlines; $i++)
540 540
         {
541 541
         	if ($lines[$i]->fk_parent == $parent)
542 542
             {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                         if ($i > 0) print '<option value="0" disabled>----------</option>';
553 553
                         print '<option value="'.$lines[$i]->fk_project.'_0"';
554 554
                         if ($selectedproject == $lines[$i]->fk_project) print ' selected';
555
-                        print '>';	// Project -> Task
555
+                        print '>'; // Project -> Task
556 556
                         print $langs->trans("Project").' '.$lines[$i]->projectref;
557 557
                         if (empty($lines[$i]->public))
558 558
                         {
@@ -565,22 +565,22 @@  discard block
 block discarded – undo
565 565
                         //print '-'.$parent.'-'.$lines[$i]->fk_project.'-'.$lastprojectid;
566 566
                         print "</option>\n";
567 567
 
568
-                        $lastprojectid=$lines[$i]->fk_project;
568
+                        $lastprojectid = $lines[$i]->fk_project;
569 569
                         $inc++;
570 570
                     }
571 571
                 }
572 572
 
573
-                $newdisablechildoftaskid=$disablechildoftaskid;
573
+                $newdisablechildoftaskid = $disablechildoftaskid;
574 574
 
575 575
                 // Print task
576 576
                 if (isset($lines[$i]->id))		// We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0
577 577
                 {
578 578
                 	// Check if we must disable entry
579
-                	$disabled=0;
579
+                	$disabled = 0;
580 580
                 	if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid)))
581 581
                 	{
582 582
                			$disabled++;
583
-               			if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id;	// If task is child of a disabled parent, we will propagate id to disable next child too
583
+               			if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid = $lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too
584 584
                 	}
585 585
 
586 586
                     print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                         print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
599 599
                     }
600 600
                     if ($lines[$i]->id) print ' > ';
601
-                    for ($k = 0 ; $k < $level ; $k++)
601
+                    for ($k = 0; $k < $level; $k++)
602 602
                     {
603 603
                         print "&nbsp;&nbsp;&nbsp;";
604 604
                     }
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
      * 		@return	string							HTML code for color thumb
623 623
      *		@see selectColor
624 624
      */
625
-    static function showColor($color, $textifnotdefined='')
625
+    static function showColor($color, $textifnotdefined = '')
626 626
     {
627
-    	$textcolor='FFF';
627
+    	$textcolor = 'FFF';
628 628
     	include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
629
-    	if(colorIsLight($color)) $textcolor='000';
629
+    	if (colorIsLight($color)) $textcolor = '000';
630 630
 
631
-    	$color = colorArrayToHex(colorStringToArray($color,array()),'');
631
+    	$color = colorArrayToHex(colorStringToArray($color, array()), '');
632 632
 
633 633
 		if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
634 634
 		else print $textifnotdefined;
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
      * 		@deprecated Use instead selectColor
648 648
      *      @see selectColor()
649 649
      */
650
-    function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
650
+    function select_color($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '')
651 651
     {
652 652
         // phpcs:enable
653 653
     	print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors);
@@ -665,25 +665,25 @@  discard block
 block discarded – undo
665 665
      * 		@return	string
666 666
      *		@see showColor
667 667
      */
668
-    static function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
668
+    static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '')
669 669
     {
670 670
 	    // Deprecation warning
671 671
 	    if ($form_name) {
672
-		    dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
672
+		    dol_syslog(__METHOD__.": form_name parameter is deprecated", LOG_WARNING);
673 673
 	    }
674 674
 
675
-        global $langs,$conf;
675
+        global $langs, $conf;
676 676
 
677
-        $out='';
677
+        $out = '';
678 678
 
679
-        if (! is_array($arrayofcolors) || count($arrayofcolors) < 1)
679
+        if (!is_array($arrayofcolors) || count($arrayofcolors) < 1)
680 680
         {
681 681
             $langs->load("other");
682 682
             if (empty($conf->dol_use_jmobile))
683 683
             {
684
-	            $out.= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
685
-	            $out.= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
686
-	            $out.= '<script type="text/javascript">
684
+	            $out .= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
685
+	            $out .= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
686
+	            $out .= '<script type="text/javascript">
687 687
 	             jQuery(document).ready(function(){
688 688
 	                $(\'#colorpicker'.$prefix.'\').jPicker( {
689 689
 	                window: {
@@ -721,15 +721,15 @@  discard block
 block discarded – undo
721 721
 			        } ); });
722 722
 	             </script>';
723 723
             }
724
-            $out.= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss?' '.$morecss:'').'" type="text" value="'.$set_color.'" />';
724
+            $out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.$set_color.'" />';
725 725
         }
726 726
         else  // In most cases, this is not used. We used instead function with no specific list of colors
727 727
         {
728 728
             if (empty($conf->dol_use_jmobile))
729 729
             {
730
-	        	$out.= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
731
-	            $out.= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';
732
-	            $out.= '<script type="text/javascript">
730
+	        	$out .= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
731
+	            $out .= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';
732
+	            $out .= '<script type="text/javascript">
733 733
 	             jQuery(document).ready(function(){
734 734
 	                 jQuery(\'#colorpicker'.$prefix.'\').colorpicker({
735 735
 	                     size: 14,
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 	             });
740 740
 	             </script>';
741 741
             }
742
-            $out.= '<select id="colorpicker'.$prefix.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$prefix.'">';
742
+            $out .= '<select id="colorpicker'.$prefix.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$prefix.'">';
743 743
             //print '<option value="-1">&nbsp;</option>';
744 744
             foreach ($arrayofcolors as $val)
745 745
             {
746
-                $out.= '<option value="'.$val.'"';
747
-                if ($set_color == $val) $out.= ' selected';
748
-                $out.= '>'.$val.'</option>';
746
+                $out .= '<option value="'.$val.'"';
747
+                if ($set_color == $val) $out .= ' selected';
748
+                $out .= '>'.$val.'</option>';
749 749
             }
750
-            $out.= '</select>';
750
+            $out .= '</select>';
751 751
         }
752 752
 
753 753
         return $out;
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
      *	@param	int		$y      	Hauteur de l'image en pixels
765 765
      *	@return	void
766 766
      */
767
-    function CreateColorIcon($color,$module,$name,$x='12',$y='12')
767
+    function CreateColorIcon($color, $module, $name, $x = '12', $y = '12')
768 768
     {
769 769
         // phpcs:enable
770 770
         global $conf;
@@ -772,25 +772,25 @@  discard block
 block discarded – undo
772 772
         $file = $conf->$module->dir_temp.'/'.$name.'.png';
773 773
 
774 774
         // On cree le repertoire contenant les icones
775
-        if (! file_exists($conf->$module->dir_temp))
775
+        if (!file_exists($conf->$module->dir_temp))
776 776
         {
777 777
             dol_mkdir($conf->$module->dir_temp);
778 778
         }
779 779
 
780 780
         // On cree l'image en vraies couleurs
781
-        $image = imagecreatetruecolor($x,$y);
781
+        $image = imagecreatetruecolor($x, $y);
782 782
 
783
-        $color = substr($color,1,6);
783
+        $color = substr($color, 1, 6);
784 784
 
785
-        $rouge = hexdec(substr($color,0,2)); //conversion du canal rouge
786
-        $vert  = hexdec(substr($color,2,2)); //conversion du canal vert
787
-        $bleu  = hexdec(substr($color,4,2)); //conversion du canal bleu
785
+        $rouge = hexdec(substr($color, 0, 2)); //conversion du canal rouge
786
+        $vert  = hexdec(substr($color, 2, 2)); //conversion du canal vert
787
+        $bleu  = hexdec(substr($color, 4, 2)); //conversion du canal bleu
788 788
 
789
-        $couleur = imagecolorallocate($image,$rouge,$vert,$bleu);
789
+        $couleur = imagecolorallocate($image, $rouge, $vert, $bleu);
790 790
         //print $rouge.$vert.$bleu;
791
-        imagefill($image,0,0,$couleur); //on remplit l'image
791
+        imagefill($image, 0, 0, $couleur); //on remplit l'image
792 792
         // On cree la couleur et on l'attribue a une variable pour ne pas la perdre
793
-        ImagePng($image,$file); //renvoie une image sous format png
793
+        ImagePng($image, $file); //renvoie une image sous format png
794 794
         ImageDestroy($image);
795 795
     }
796 796
 
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
      *    	@param  int			$useempty          Affiche valeur vide dans liste
804 804
      *    	@return	string
805 805
      */
806
-    function select_dayofweek($selected='',$htmlname='weekid',$useempty=0)
806
+    function select_dayofweek($selected = '', $htmlname = 'weekid', $useempty = 0)
807 807
     {
808 808
         // phpcs:enable
809 809
         global $langs;
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
      *      @param	string		$morecss			More Css
852 852
      *      @return string
853 853
      */
854
-    function select_month($selected='', $htmlname='monthid', $useempty=0, $longlabel=0, $morecss='')
854
+    function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '')
855 855
     {
856 856
         // phpcs:enable
857 857
         global $langs;
858 858
 
859 859
         require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
860 860
 
861
-        if ($longlabel) $montharray = monthArray($langs, 0);	// Get array
861
+        if ($longlabel) $montharray = monthArray($langs, 0); // Get array
862 862
         else $montharray = monthArray($langs, 1);
863 863
 
864
-        $select_month = '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
864
+        $select_month = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
865 865
         if ($useempty)
866 866
         {
867 867
             $select_month .= '<option value="0">&nbsp;</option>';
@@ -898,10 +898,10 @@  discard block
 block discarded – undo
898 898
      *  @param	string		$morecss		More CSS
899 899
      *  @return	string
900 900
      */
901
-    function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
901
+    function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
902 902
     {
903 903
         // phpcs:enable
904
-        print $this->selectyear($selected,$htmlname,$useempty,$min_year,$max_year,$offset,$invert,$option,$morecss);
904
+        print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss);
905 905
     }
906 906
 
907 907
     /**
@@ -918,41 +918,41 @@  discard block
 block discarded – undo
918 918
      *  @param	string	$morecss		More css
919 919
      *  @return	string
920 920
      */
921
-    function selectyear($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
921
+    function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto')
922 922
     {
923
-        $out='';
923
+        $out = '';
924 924
 
925
-        $currentyear = date("Y")+$offset;
926
-        $max_year = $currentyear+$max_year;
927
-        $min_year = $currentyear-$min_year;
928
-        if(empty($selected) && empty($useempty)) $selected = $currentyear;
925
+        $currentyear = date("Y") + $offset;
926
+        $max_year = $currentyear + $max_year;
927
+        $min_year = $currentyear - $min_year;
928
+        if (empty($selected) && empty($useempty)) $selected = $currentyear;
929 929
 
930
-        $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
931
-        if($useempty)
930
+        $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$option.' >';
931
+        if ($useempty)
932 932
         {
933
-        	$selected_html='';
933
+        	$selected_html = '';
934 934
             if ($selected == '') $selected_html = ' selected';
935
-            $out.= '<option value=""' . $selected_html . '>&nbsp;</option>';
935
+            $out .= '<option value=""'.$selected_html.'>&nbsp;</option>';
936 936
         }
937
-        if (! $invert)
937
+        if (!$invert)
938 938
         {
939 939
             for ($y = $max_year; $y >= $min_year; $y--)
940 940
             {
941
-                $selected_html='';
941
+                $selected_html = '';
942 942
                 if ($selected > 0 && $y == $selected) $selected_html = ' selected';
943
-                $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
943
+                $out .= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
944 944
             }
945 945
         }
946 946
         else
947 947
         {
948 948
             for ($y = $min_year; $y <= $max_year; $y++)
949 949
             {
950
-                $selected_html='';
950
+                $selected_html = '';
951 951
                 if ($selected > 0 && $y == $selected) $selected_html = ' selected';
952
-                $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
952
+                $out .= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
953 953
             }
954 954
         }
955
-        $out.= "</select>\n";
955
+        $out .= "</select>\n";
956 956
 
957 957
         return $out;
958 958
     }
@@ -969,10 +969,10 @@  discard block
 block discarded – undo
969 969
      * @param  	int		$originid      	Id de l'origine
970 970
      * @return	void
971 971
      */
972
-    function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='')
972
+    function form_address($page, $selected, $socid, $htmlname = 'address_id', $origin = '', $originid = '')
973 973
     {
974 974
         // phpcs:enable
975
-        global $langs,$conf;
975
+        global $langs, $conf;
976 976
         global $form;
977 977
 
978 978
         if ($htmlname != "none")
@@ -990,9 +990,9 @@  discard block
 block discarded – undo
990 990
         {
991 991
             if ($selected)
992 992
             {
993
-                require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php';
994
-                $address=new Address($this->db);
995
-                $result=$address->fetch_address($selected);
993
+                require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php';
994
+                $address = new Address($this->db);
995
+                $result = $address->fetch_address($selected);
996 996
                 print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>';
997 997
             }
998 998
             else
@@ -1012,72 +1012,72 @@  discard block
 block discarded – undo
1012 1012
      * 	@param	   String       $areacode    Code of area for pages ('0'=value for Home page)
1013 1013
      * 	@return    array                     array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
1014 1014
      */
1015
-    static function getBoxesArea($user,$areacode)
1015
+    static function getBoxesArea($user, $areacode)
1016 1016
     {
1017
-        global $conf,$langs,$db;
1017
+        global $conf, $langs, $db;
1018 1018
 
1019 1019
         include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
1020 1020
 
1021
-        $confuserzone='MAIN_BOXES_'.$areacode;
1021
+        $confuserzone = 'MAIN_BOXES_'.$areacode;
1022 1022
 
1023 1023
         // $boxactivated will be array of boxes enabled into global setup
1024 1024
         // $boxidactivatedforuser will be array of boxes choosed by user
1025 1025
 
1026
-        $selectboxlist='';
1027
-        $boxactivated=InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone)?null:$user), array(), 0);	// Search boxes of common+user (or common only if user has no specific setup)
1026
+        $selectboxlist = '';
1027
+        $boxactivated = InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone) ?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup)
1028 1028
 
1029
-        $boxidactivatedforuser=array();
1030
-        foreach($boxactivated as $box)
1029
+        $boxidactivatedforuser = array();
1030
+        foreach ($boxactivated as $box)
1031 1031
         {
1032
-        	if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id;	// We keep only boxes to show for user
1032
+        	if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id] = $box->id; // We keep only boxes to show for user
1033 1033
         }
1034 1034
 
1035 1035
         // Define selectboxlist
1036
-        $arrayboxtoactivatelabel=array();
1037
-        if (! empty($user->conf->$confuserzone))
1036
+        $arrayboxtoactivatelabel = array();
1037
+        if (!empty($user->conf->$confuserzone))
1038 1038
         {
1039
-        	$boxorder='';
1040
-        	$langs->load("boxes");	// Load label of boxes
1041
-        	foreach($boxactivated as $box)
1039
+        	$boxorder = '';
1040
+        	$langs->load("boxes"); // Load label of boxes
1041
+        	foreach ($boxactivated as $box)
1042 1042
         	{
1043
-        		if (! empty($boxidactivatedforuser[$box->id])) continue;	// Already visible for user
1044
-        		$label=$langs->transnoentitiesnoconv($box->boxlabel);
1043
+        		if (!empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
1044
+        		$label = $langs->transnoentitiesnoconv($box->boxlabel);
1045 1045
         		//if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
1046
-        		if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone')
1046
+        		if (preg_match('/graph/', $box->class) && $conf->browser->layout != 'phone')
1047 1047
         		{
1048
-        			$label=$label.' <span class="fa fa-bar-chart"></span>';
1048
+        			$label = $label.' <span class="fa fa-bar-chart"></span>';
1049 1049
         		}
1050
-        		$arrayboxtoactivatelabel[$box->id]=$label;			// We keep only boxes not shown for user, to show into combo list
1050
+        		$arrayboxtoactivatelabel[$box->id] = $label; // We keep only boxes not shown for user, to show into combo list
1051 1051
         	}
1052
-            foreach($boxidactivatedforuser as $boxid)
1052
+            foreach ($boxidactivatedforuser as $boxid)
1053 1053
         	{
1054
-       			if (empty($boxorder)) $boxorder.='A:';
1055
-  				$boxorder.=$boxid.',';
1054
+       			if (empty($boxorder)) $boxorder .= 'A:';
1055
+  				$boxorder .= $boxid.',';
1056 1056
         	}
1057 1057
 
1058 1058
         	//var_dump($boxidactivatedforuser);
1059 1059
 
1060 1060
         	// Class Form must have been already loaded
1061
-        	$selectboxlist.='<!-- Form with select box list -->'."\n";
1062
-			$selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
1063
-			$selectboxlist.='<input type="hidden" name="addbox" value="addbox">';
1064
-			$selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">';
1065
-			$selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">';
1066
-			$selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">';
1067
-			$selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1);
1068
-            if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
1069
-            $selectboxlist.='</form>';
1070
-            if (! empty($conf->use_javascript_ajax))
1061
+        	$selectboxlist .= '<!-- Form with select box list -->'."\n";
1062
+			$selectboxlist .= '<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
1063
+			$selectboxlist .= '<input type="hidden" name="addbox" value="addbox">';
1064
+			$selectboxlist .= '<input type="hidden" name="userid" value="'.$user->id.'">';
1065
+			$selectboxlist .= '<input type="hidden" name="areacode" value="'.$areacode.'">';
1066
+			$selectboxlist .= '<input type="hidden" name="boxorder" value="'.$boxorder.'">';
1067
+			$selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1);
1068
+            if (empty($conf->use_javascript_ajax)) $selectboxlist .= ' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
1069
+            $selectboxlist .= '</form>';
1070
+            if (!empty($conf->use_javascript_ajax))
1071 1071
             {
1072
-            	include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1073
-            	$selectboxlist.=ajax_combobox("boxcombo");
1072
+            	include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1073
+            	$selectboxlist .= ajax_combobox("boxcombo");
1074 1074
             }
1075 1075
         }
1076 1076
 
1077 1077
         // Javascript code for dynamic actions
1078
-        if (! empty($conf->use_javascript_ajax))
1078
+        if (!empty($conf->use_javascript_ajax))
1079 1079
         {
1080
-	        $selectboxlist.='<script type="text/javascript" language="javascript">
1080
+	        $selectboxlist .= '<script type="text/javascript" language="javascript">
1081 1081
 
1082 1082
 	        // To update list of activated boxes
1083 1083
 	        function updateBoxOrder(closing) {
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 	        			async: false
1092 1092
 	        		});
1093 1093
 	        		// We force reload to be sure to get all boxes into list
1094
-	        		window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=delbox\';
1094
+	        		window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=delbox\';
1095 1095
 	        	}
1096 1096
 	        	else
1097 1097
 	        	{
@@ -1113,11 +1113,11 @@  discard block
 block discarded – undo
1113 1113
 	    					url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&boxid=\'+boxid+\'&zone='.$areacode.'&userid='.$user->id.'\',
1114 1114
 	    			        async: false
1115 1115
 	    		        });
1116
-	        			window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid;
1116
+	        			window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=addbox&boxid=\'+boxid;
1117 1117
 	                }
1118 1118
 	        	});';
1119
-	        	if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();';
1120
-	        	$selectboxlist.='
1119
+	        	if (!count($arrayboxtoactivatelabel)) $selectboxlist .= 'jQuery("#boxcombo").hide();';
1120
+	        	$selectboxlist .= '
1121 1121
 
1122 1122
 	        	jQuery("#boxhalfleft, #boxhalfright").sortable({
1123 1123
 	    	    	handle: \'.boxhandle\',
@@ -1142,80 +1142,80 @@  discard block
 block discarded – undo
1142 1142
 
1143 1143
         	});'."\n";
1144 1144
 
1145
-	        $selectboxlist.='</script>'."\n";
1145
+	        $selectboxlist .= '</script>'."\n";
1146 1146
         }
1147 1147
 
1148 1148
         // Define boxlista and boxlistb
1149
-        $nbboxactivated=count($boxidactivatedforuser);
1149
+        $nbboxactivated = count($boxidactivatedforuser);
1150 1150
 
1151 1151
         if ($nbboxactivated)
1152 1152
         {
1153 1153
         	// Load translation files required by the page
1154
-            $langs->loadLangs(array("boxes","projects"));
1154
+            $langs->loadLangs(array("boxes", "projects"));
1155 1155
 
1156
-        	$emptybox=new ModeleBoxes($db);
1156
+        	$emptybox = new ModeleBoxes($db);
1157 1157
 
1158
-            $boxlista.="\n<!-- Box left container -->\n";
1158
+            $boxlista .= "\n<!-- Box left container -->\n";
1159 1159
 
1160 1160
             // Define $box_max_lines
1161
-            $box_max_lines=5;
1162
-            if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
1161
+            $box_max_lines = 5;
1162
+            if (!empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines = $conf->global->MAIN_BOXES_MAXLINES;
1163 1163
 
1164
-            $ii=0;
1164
+            $ii = 0;
1165 1165
             foreach ($boxactivated as $key => $box)
1166 1166
             {
1167
-            	if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1168
-				if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1));	// When box_order was not yet set to Axx or Bxx and is still 0
1169
-            	if (preg_match('/^A/i',$box->box_order)) // column A
1167
+            	if ((!empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1168
+				if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order = 'A'.sprintf("%02d", ($ii + 1)); // When box_order was not yet set to Axx or Bxx and is still 0
1169
+            	if (preg_match('/^A/i', $box->box_order)) // column A
1170 1170
                 {
1171 1171
                     $ii++;
1172 1172
                     //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1173 1173
                     //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1174 1174
                     // Show box
1175 1175
                     $box->loadBox($box_max_lines);
1176
-                    $boxlista.= $box->outputBox();
1176
+                    $boxlista .= $box->outputBox();
1177 1177
                 }
1178 1178
             }
1179 1179
 
1180 1180
             if ($conf->browser->layout != 'phone')
1181 1181
             {
1182
-            	$emptybox->box_id='A';
1183
-            	$emptybox->info_box_head=array();
1184
-            	$emptybox->info_box_contents=array();
1185
-            	$boxlista.= $emptybox->outputBox(array(),array());
1182
+            	$emptybox->box_id = 'A';
1183
+            	$emptybox->info_box_head = array();
1184
+            	$emptybox->info_box_contents = array();
1185
+            	$boxlista .= $emptybox->outputBox(array(), array());
1186 1186
             }
1187
-            $boxlista.= "<!-- End box left container -->\n";
1187
+            $boxlista .= "<!-- End box left container -->\n";
1188 1188
 
1189
-            $boxlistb.= "\n<!-- Box right container -->\n";
1189
+            $boxlistb .= "\n<!-- Box right container -->\n";
1190 1190
 
1191
-            $ii=0;
1191
+            $ii = 0;
1192 1192
             foreach ($boxactivated as $key => $box)
1193 1193
             {
1194
-            	if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1195
-            	if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1));	// When box_order was not yet set to Axx or Bxx and is still 0
1196
-            	if (preg_match('/^B/i',$box->box_order)) // colonne B
1194
+            	if ((!empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1195
+            	if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order = 'B'.sprintf("%02d", ($ii + 1)); // When box_order was not yet set to Axx or Bxx and is still 0
1196
+            	if (preg_match('/^B/i', $box->box_order)) // colonne B
1197 1197
                 {
1198 1198
                     $ii++;
1199 1199
                     //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1200 1200
                     //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1201 1201
                     // Show box
1202 1202
                     $box->loadBox($box_max_lines);
1203
-                    $boxlistb.= $box->outputBox();
1203
+                    $boxlistb .= $box->outputBox();
1204 1204
                 }
1205 1205
             }
1206 1206
 
1207 1207
             if ($conf->browser->layout != 'phone')
1208 1208
             {
1209
-            	$emptybox->box_id='B';
1210
-            	$emptybox->info_box_head=array();
1211
-            	$emptybox->info_box_contents=array();
1212
-            	$boxlistb.= $emptybox->outputBox(array(),array());
1209
+            	$emptybox->box_id = 'B';
1210
+            	$emptybox->info_box_head = array();
1211
+            	$emptybox->info_box_contents = array();
1212
+            	$boxlistb .= $emptybox->outputBox(array(), array());
1213 1213
             }
1214 1214
 
1215
-            $boxlistb.= "<!-- End box right container -->\n";
1215
+            $boxlistb .= "<!-- End box right container -->\n";
1216 1216
         }
1217 1217
 
1218
-        return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
1218
+        return array('selectboxlist'=>count($boxactivated) ? $selectboxlist : '', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
1219 1219
     }
1220 1220
 
1221 1221
 
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
      *  @param  string  $moreattrib         More attributes on HTML select tag
1233 1233
      * 	@return	void
1234 1234
      */
1235
-    function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='')
1235
+    function select_dictionary($htmlname, $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '')
1236 1236
     {
1237 1237
         // phpcs:enable
1238 1238
         global $langs, $conf;
@@ -1240,8 +1240,8 @@  discard block
 block discarded – undo
1240 1240
         $langs->load("admin");
1241 1241
 
1242 1242
         $sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
1243
-        $sql.= " FROM ".MAIN_DB_PREFIX.$dictionarytable;
1244
-        $sql.= " ORDER BY ".$labelfield;
1243
+        $sql .= " FROM ".MAIN_DB_PREFIX.$dictionarytable;
1244
+        $sql .= " ORDER BY ".$labelfield;
1245 1245
 
1246 1246
         dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG);
1247 1247
         $result = $this->db->query($sql);
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
             $i = 0;
1252 1252
             if ($num)
1253 1253
             {
1254
-                print '<select id="select'.$htmlname.'" class="flat selectdictionary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
1254
+                print '<select id="select'.$htmlname.'" class="flat selectdictionary" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
1255 1255
                 if ($useempty == 1 || ($useempty == 2 && $num > 1))
1256 1256
                 {
1257 1257
                     print '<option value="-1">&nbsp;</option>';
Please login to merge, or discard this patch.
Base/AlixarView.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 // html header
117 117
         $this->top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
118 118
 
119
-        print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n";
119
+        print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n";
120 120
 
121 121
 // top menu and left menu area
122 122
         if (empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         }
125 125
 
126 126
         if (empty(Globals::$conf->dol_hide_leftmenu)) {
127
-            $this->left_menu('', $help_url, '', '', 1, $title, 1);  // $menumanager is retreived with a global $menumanager inside this function
127
+            $this->left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function
128 128
         }
129 129
 
130 130
 // main area
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
          * Top menu
176 176
          */
177 177
         if ((empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
178
-            print "\n" . '<!-- Start top horizontal -->' . "\n";
178
+            print "\n".'<!-- Start top horizontal -->'."\n";
179 179
 
180
-            print '<div class="side-nav-vert' . (DolUtils::GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">';  // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
180
+            print '<div class="side-nav-vert'.(DolUtils::GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
181 181
 // Show menu entries
182
-            print '<div id="tmenu_tooltip' . (empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n";
182
+            print '<div id="tmenu_tooltip'.(empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n";
183 183
             $this->menumanager->atarget = $target;
184
-            $this->menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks));      // This contains a \n
184
+            $this->menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n
185 185
             print "</div>\n";
186 186
 
187 187
 // Define link to login card
@@ -189,34 +189,34 @@  discard block
 block discarded – undo
189 189
             if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) {
190 190
                 $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
191 191
 if (preg_match('/\d\.\d/', $appli)) {
192
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
193
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
192
+                    if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
193
+                        $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
194 194
                 } else
195
-                    $appli .= " " . DOL_VERSION;
195
+                    $appli .= " ".DOL_VERSION;
196 196
             } else
197
-                $appli .= " " . DOL_VERSION;
197
+                $appli .= " ".DOL_VERSION;
198 198
 
199 199
             if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL))
200
-                $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
200
+                $appli .= "<br>".Globals::$langs->trans("LevelOfFeature").': '.Globals::$conf->global->MAIN_FEATURES_LEVEL;
201 201
 
202 202
 $logouttext = '';
203 203
             if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
204 204
 //$logouthtmltext=$appli.'<br>';
205 205
                 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
206
-                    $logouthtmltext .= Globals::$langs->trans("Logout") . '<br>';
206
+                    $logouthtmltext .= Globals::$langs->trans("Logout").'<br>';
207 207
 
208 208
 //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">';
209
-                    $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">';
209
+                    $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">';
210 210
 //$logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
211 211
                     $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
212 212
                     $logouttext .= '</a>';
213 213
                 } else {
214 214
                     $logouthtmltext .= Globals::$langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
215
-                    $logouttext .= img_picto(Globals::$langs->trans('Logout') . ":" . Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
215
+                    $logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
216 216
 }
217 217
             }
218 218
 
219
-            print '<div class="login_block">' . "\n";
219
+            print '<div class="login_block">'."\n";
220 220
 
221 221
 // Add login user link
222 222
             $toprightmenu .= '<div class="login_block_user">';
@@ -227,18 +227,18 @@  discard block
 block discarded – undo
227 227
             $toprightmenu .= Globals::$user->getNomUrl($mode, '', 1, 0, 11, 0, (Globals::$user->firstname ? 'firstname' : -1), 'atoplogin');
228 228
             $toprightmenu .= '</div></div>';
229 229
 
230
-            $toprightmenu .= '</div>' . "\n";
230
+            $toprightmenu .= '</div>'."\n";
231 231
 
232 232
             $toprightmenu .= '<div class="login_block_other">';
233 233
 
234 234
 // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
235 235
             $parameters = array();
236
-            $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
236
+            $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
237 237
             if (is_numeric($result)) {
238 238
                 if ($result == 0)
239
-                    $toprightmenu .= Globals::$hookManager->resPrint;  // add
239
+                    $toprightmenu .= Globals::$hookManager->resPrint; // add
240 240
                 else
241
-                    $toprightmenu = Globals::$hookManager->resPrint;      // replace
241
+                    $toprightmenu = Globals::$hookManager->resPrint; // replace
242 242
             }
243 243
             else {
244 244
                 $toprightmenu .= $result; // For backward compatibility
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 // Link to module builder
248 248
             if (!empty(Globals::$conf->modulebuilder->enabled)) {
249 249
 //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
250
-                $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
250
+                $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
251 251
 //$text.= img_picto(":".Globals::$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
252 252
                 $text .= '<span class="fa fa-bug atoplogin"></span>';
253 253
                 $text .= '</a>';
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
                 if (is_array($_POST)) {
262 262
                     foreach ($_POST as $key => $value) {
263 263
                         if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
264
-                            $qs .= '&' . $key . '=' . urlencode($value);
264
+                            $qs .= '&'.$key.'='.urlencode($value);
265 265
                         }
266 266
                     }
267 267
                 }
268
-                $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
269
-                $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
268
+                $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring;
269
+                $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">';
270 270
 //$text.= img_picto(":".Globals::$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
271 271
                 $text .= '<span class="fa fa-print atoplogin"></span>';
272 272
                 $text .= '</a>';
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
                     $text = '';
296 296
                     if (!empty(Globals::$conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
297 297
                         Globals::$langs->load('admin');
298
-$appli .= '<br>' . Globals::$langs->trans("Database") . ': ' . $db->database_name;
298
+$appli .= '<br>'.Globals::$langs->trans("Database").': '.$db->database_name;
299 299
 }
300
-                    $title = $appli . '<br>';
300
+                    $title = $appli.'<br>';
301 301
                     $title .= Globals::$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
302 302
                     if ($mode == 'wiki') {
303
-                        $title .= ' - ' . Globals::$langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
303
+                        $title .= ' - '.Globals::$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'&quot;';
304 304
                     }
305 305
                     $text .= '<a class="help" target="_blank" rel="noopener" href="';
306 306
                     if ($mode == 'wiki') {
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
             print $toprightmenu;
328 328
 
329
-            print "</div>\n";  // end div class="login_block"
329
+            print "</div>\n"; // end div class="login_block"
330 330
 
331 331
             print '</div></div>';
332 332
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         }
336 336
 
337 337
         if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile))
338
-            print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
338
+            print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">';
339 339
     }
340 340
 
341 341
     /**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 // Instantiate hooks of thirdparty module
368 368
             Globals::$hookManager->initHooks(array('searchform', 'leftblock'));
369 369
 
370
-            print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
370
+            print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
371 371
 
372 372
             if (Globals::$conf->browser->layout == 'phone')
373 373
                 Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             }
380 380
             $selected = -1;
381 381
             $usedbyinclude = 1;
382
-            include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult
382
+            include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
383 383
 
384 384
             if (Globals::$conf->use_javascript_ajax && empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
385 385
 //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, Globals::$langs->trans("Search"), 1);
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 // Execute hook printSearchForm
395 395
             $parameters = array('searchform' => $searchform);
396 396
 
397
-            $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
397
+            $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
398 398
             if (empty($reshook)) {
399 399
                 $searchform .= Globals::$hookManager->resPrint;
400 400
             } else
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 
403 403
 // Force special value for $searchform
404 404
             if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) {
405
-                $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1';
406
-                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div></div>';
407
-            } elseif (Globals::$conf->use_javascript_ajax &&!empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
408
-$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>';
405
+                $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1';
406
+                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div></div>';
407
+            } elseif (Globals::$conf->use_javascript_ajax && !empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
408
+$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>';
409 409
 $searchform .= '<script type="text/javascript">
410 410
             	jQuery(document).ready(function () {
411 411
             		jQuery("#divsearchforms1").click(function(){
@@ -418,16 +418,16 @@  discard block
 block discarded – undo
418 418
 
419 419
 // Define $bookmarks
420 420
             if (!empty(Globals::$conf->bookmark->enabled) && Globals::$user->rights->bookmark->lire) {
421
-                include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php';
421
+                include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php';
422 422
                 Globals::$langs->load("bookmarks");
423 423
 
424 424
                 $bookmarks = printBookmarksList($db, Globals::$langs);
425 425
 }
426 426
 
427 427
 // Left column
428
-            print '<!-- Begin left menu -->' . "\n";
428
+            print '<!-- Begin left menu -->'."\n";
429 429
 
430
-            print '<div class="vmenu"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n";
430
+            print '<div class="vmenu"'.(empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n";
431 431
 
432 432
 // Show left menu with other forms
433 433
             $this->menumanager->menu_array = $menu_array_before;
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 // Dolibarr version + help + bug report link
437 437
             print "\n";
438 438
             print "<!-- Begin Help Block-->\n";
439
-            print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n";
439
+            print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
440 440
 
441 441
 // Version
442 442
             if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
@@ -458,15 +458,15 @@  discard block
 block discarded – undo
458 458
                     $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
459 459
 $doliurl = '';
460 460
                     if (preg_match('/\d\.\d/', $appli)) {
461
-                        if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
462
-                            $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
461
+                        if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
462
+                            $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
463 463
                     } else
464
-                        $appli .= " " . DOL_VERSION;
464
+                        $appli .= " ".DOL_VERSION;
465 465
                 } else
466
-                    $appli .= " " . DOL_VERSION;
466
+                    $appli .= " ".DOL_VERSION;
467 467
                 print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
468 468
                 if ($doliurl)
469
-                    print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
469
+                    print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
470 470
                 else
471 471
                     print '<span class="help">';
472 472
                 print $appli;
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
                     print '</a>';
475 475
                 else
476 476
                     print '</span>';
477
-                print '</div>' . "\n";
477
+                print '</div>'."\n";
478 478
             }
479 479
 
480 480
 // Link to bugtrack
481 481
             if (!empty(Globals::$conf->global->MAIN_BUGTRACK_ENABLELINK)) {
482
-                require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
482
+                require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
483 483
 
484 484
                 $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
485 485
                 $bugbaseurl .= '?title=';
@@ -488,16 +488,16 @@  discard block
 block discarded – undo
488 488
                 $bugbaseurl .= urlencode("# Bug\n");
489 489
                 $bugbaseurl .= urlencode("\n");
490 490
                 $bugbaseurl .= urlencode("## Environment\n");
491
-                $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
492
-                $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
493
-                $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
494
-                $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
495
-                $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
496
-                $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
491
+                $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n");
492
+                $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n");
493
+                $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n");
494
+                $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n");
495
+                $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n");
496
+                $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n");
497 497
                 $bugbaseurl .= urlencode("\n");
498 498
                 $bugbaseurl .= urlencode("## Report\n");
499 499
                 print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
500
-                print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . Globals::$langs->trans("FindBug") . '</a>';
500
+                print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.Globals::$langs->trans("FindBug").'</a>';
501 501
                 print '</div>';
502 502
             }
503 503
 
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
 
512 512
 // Execute hook printLeftBlock
513 513
             $parameters = array();
514
-            $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters);    // Note that $action and $object may have been modified by some hooks
514
+            $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks
515 515
             print Globals::$hookManager->resPrint;
516 516
 
517 517
             print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
518 518
         }
519 519
 
520 520
         print "\n";
521
-        print '<!-- Begin right area -->' . "\n";
521
+        print '<!-- Begin right area -->'."\n";
522 522
 
523 523
         if (empty($leftmenuwithoutmainarea))
524 524
             main_area($title);
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
         print "\n";
541 541
 
542
-        print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
542
+        print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
543 543
 
544 544
         if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED))
545 545
             print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
@@ -605,17 +605,17 @@  discard block
 block discarded – undo
605 605
         // global Globals::$conf, Globals::$langs, Globals::$user;
606 606
 
607 607
         $ret = '';
608
-        $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">';
609
-        $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
608
+        $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">';
609
+        $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
610 610
         $ret .= '<input type="hidden" name="mode" value="search">';
611
-        $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag(Globals::$user->login) . '">';
611
+        $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag(Globals::$user->login).'">';
612 612
         if ($showtitlebefore)
613
-            $ret .= $title . ' ';
614
-        $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
615
-        $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
616
-        $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
617
-        $ret .= ' placeholder="' . strip_tags($title) . '"';
618
-        $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />';
613
+            $ret .= $title.' ';
614
+        $ret .= '<input type="text" class="flat '.$htmlmorecss.'"';
615
+        $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
616
+        $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : '');
617
+        $ret .= ' placeholder="'.strip_tags($title).'"';
618
+        $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
619 619
 //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.Globals::$langs->trans("Go").'">';
620 620
         $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
621 621
         $ret .= '<span class="fa fa-search"></span>';
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
         // global $delayedhtmlcontent;
641 641
         // global $contextpage, $page, $limit;
642 642
 
643
-        $ext = 'layout=' . Globals::$conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
643
+        $ext = 'layout='.Globals::$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
644 644
 
645 645
 // Global html output events ($mesgs, $errors, $warnings)
646 646
         dol_htmloutput_events($disabledoutputofmessages);
@@ -650,15 +650,15 @@  discard block
 block discarded – undo
650 650
         if (is_object(Globals::$user) && !empty(Globals::$user->lastsearch_values_tmp) && is_array(Globals::$user->lastsearch_values_tmp)) {
651 651
 // Clean and save data
652 652
             foreach (Globals::$user->lastsearch_values_tmp as $key => $val) {
653
-                unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
653
+                unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after
654 654
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
655 655
                     if (empty($val['sortfield']))
656 656
                         unset($val['sortfield']);
657 657
                     if (empty($val['sortorder']))
658 658
                         unset($val['sortorder']);
659
-                    dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
660
-                    $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
661
-                    unset($_SESSION['lastsearch_values_' . $key]);
659
+                    dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)");
660
+                    $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val);
661
+                    unset($_SESSION['lastsearch_values_'.$key]);
662 662
                 }
663 663
             }
664 664
         }
@@ -667,37 +667,37 @@  discard block
 block discarded – undo
667 667
         $relativepathstring = $_SERVER["PHP_SELF"];
668 668
 // Clean $relativepathstring
669 669
         if (constant('DOL_BASE_URI'))
670
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
670
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
671 671
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
672 672
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
673 673
         if (preg_match('/list\.php$/', $relativepathstring)) {
674
-            unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
675
-            unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
676
-            unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
674
+            unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
675
+            unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
676
+            unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
677 677
 
678 678
             if (!empty($contextpage))
679
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
679
+                $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
680 680
             if (!empty($page) && $page > 1)
681
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
681
+                $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
682 682
             if (!empty($limit) && $limit != Globals::$conf->limit)
683
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
683
+                $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
684 684
 
685
-            unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
686
-            unset($_SESSION['lastsearch_page_' . $relativepathstring]);
687
-            unset($_SESSION['lastsearch_limit_' . $relativepathstring]);
685
+            unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
686
+            unset($_SESSION['lastsearch_page_'.$relativepathstring]);
687
+            unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
688 688
         }
689 689
 
690 690
 // Core error message
691 691
         if (!empty(Globals::$conf->global->MAIN_CORE_ERROR)) {
692 692
 // Ajax version
693 693
             if (Globals::$conf->use_javascript_ajax) {
694
-                $title = img_warning() . ' ' . Globals::$langs->trans('CoreErrorTitle');
694
+                $title = img_warning().' '.Globals::$langs->trans('CoreErrorTitle');
695 695
 print ajax_dialog($title, Globals::$langs->trans('CoreErrorMessage'));
696 696
 }
697 697
 // html version
698 698
             else {
699
-                $msg = img_warning() . ' ' . Globals::$langs->trans('CoreErrorMessage');
700
-                print '<div class="error">' . $msg . '</div>';
699
+                $msg = img_warning().' '.Globals::$langs->trans('CoreErrorMessage');
700
+                print '<div class="error">'.$msg.'</div>';
701 701
             }
702 702
 
703 703
 //define("MAIN_CORE_ERROR",0);      // Constant was defined and we can't change value of a constant
@@ -705,17 +705,17 @@  discard block
 block discarded – undo
705 705
 
706 706
         print "\n\n";
707 707
 
708
-        print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
708
+        print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
709 709
 
710 710
         if (empty(Globals::$conf->dol_hide_leftmenu))
711
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
711
+            print '</div> <!-- End div id-right -->'."\n"; // End div id-right
712 712
 
713 713
         if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile))
714
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
714
+            print '</div> <!-- End div id-container -->'."\n"; // End div container
715 715
 
716 716
         print "\n";
717 717
         if ($comment)
718
-            print '<!-- ' . $comment . ' -->' . "\n";
718
+            print '<!-- '.$comment.' -->'."\n";
719 719
 
720 720
         printCommonFooter($zone);
721 721
 
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
             print $delayedhtmlcontent;
724 724
 
725 725
         if (!empty(Globals::$conf->use_javascript_ajax)) {
726
-            print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
727
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . Globals::$langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
726
+            print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
727
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.Globals::$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
728 728
         }
729 729
 
730 730
 // Wrapper to add log when clicking on download or preview
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
                 <script type="text/javascript">
737 737
                     jQuery(document).ready(function () {
738 738
                         $('a.documentpreview').click(function () {
739
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
739
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
740 740
                                     , {
741 741
                                         id:<?php echo $object->id; ?>
742 742
                                         , element: '<?php echo $object->element ?>'
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
                             );
746 746
                         });
747 747
                         $('a.documentdownload').click(function () {
748
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
748
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
749 749
                                     , {
750 750
                                         id:<?php echo $object->id; ?>
751 751
                                         , element: '<?php echo $object->element ?>'
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 
762 762
 // A div for the address popup
763 763
         print "\n<!-- A div to allow dialog popup -->\n";
764
-        print '<div id="dialogforpopup" style="display: none;"></div>' . "\n";
764
+        print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
765 765
 
766 766
         print "</body>\n";
767 767
 
Please login to merge, or discard this patch.