Passed
Push — master ( 65bdac...4e88da )
by Alxarafe
32:38
created
Base/AlixarController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -307,8 +307,9 @@
 block discarded – undo
307 307
                         Globals::$hookManager->initHooks(array('login'));
308 308
                         $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
309 309
                         $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action);    // Note that $action and $object may have been modified by some hooks
310
-                        if ($reshook < 0)
311
-                            $error++;
310
+                        if ($reshook < 0) {
311
+                                                    $error++;
312
+                        }
312 313
 
313 314
 // Note: exit is done later
314 315
                     }
Please login to merge, or discard this patch.
Base/FormOther.php 1 patch
Braces   +149 added lines, -87 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
         $sql = "SELECT rowid, label";
75 75
         $sql.= " FROM ".MAIN_DB_PREFIX."export_model";
76 76
         $sql.= " WHERE type = '".$type."'";
77
-		if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user;
77
+		if (!empty($fk_user)) {
78
+		    $sql.=" AND fk_user=".$fk_user;
79
+		}
78 80
         $sql.= " ORDER BY rowid";
79 81
         $result = $this->db->query($sql);
80 82
         if ($result)
@@ -93,8 +95,7 @@  discard block
 block discarded – undo
93 95
                 if ($selected == $obj->rowid)
94 96
                 {
95 97
                     print '<option value="'.$obj->rowid.'" selected>';
96
-                }
97
-                else
98
+                } else
98 99
                 {
99 100
                     print '<option value="'.$obj->rowid.'">';
100 101
                 }
@@ -103,8 +104,7 @@  discard block
 block discarded – undo
103 104
                 $i++;
104 105
             }
105 106
             print "</select>";
106
-        }
107
-        else {
107
+        } else {
108 108
             dol_print_error($this->db);
109 109
         }
110 110
     }
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
                 if ($selected == $obj->rowid)
145 145
                 {
146 146
                     print '<option value="'.$obj->rowid.'" selected>';
147
-                }
148
-                else
147
+                } else
149 148
                 {
150 149
                     print '<option value="'.$obj->rowid.'">';
151 150
                 }
@@ -154,8 +153,7 @@  discard block
 block discarded – undo
154 153
                 $i++;
155 154
             }
156 155
             print "</select>";
157
-        }
158
-        else {
156
+        } else {
159 157
             dol_print_error($this->db);
160 158
         }
161 159
     }
@@ -196,8 +194,7 @@  discard block
 block discarded – undo
196 194
                     if ($selected && $selected == $obj->rowid)
197 195
                     {
198 196
                         print '<option value="'.$obj->rowid.'" selected>';
199
-                    }
200
-                    else
197
+                    } else
201 198
                     {
202 199
                         print '<option value="'.$obj->rowid.'">';
203 200
                         //print '<option onmouseover="showtip(\''.$obj->label.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
@@ -210,8 +207,7 @@  discard block
 block discarded – undo
210 207
             }
211 208
             print '</select>';
212 209
             return 0;
213
-        }
214
-        else
210
+        } else
215 211
         {
216 212
             dol_print_error($this->db);
217 213
             return 1;
@@ -256,8 +252,7 @@  discard block
 block discarded – undo
256 252
     				if (($selected && $selected == $obj->taux) || $num == 1)
257 253
     				{
258 254
     					$out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>';
259
-    				}
260
-    				else
255
+    				} else
261 256
     				{
262 257
     					$out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>';
263 258
     					//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
@@ -269,8 +264,7 @@  discard block
 block discarded – undo
269 264
     		}
270 265
     		$out.='</select>';
271 266
     		return $out;
272
-    	}
273
-    	else
267
+    	} else
274 268
     	{
275 269
     		dol_print_error($this->db);
276 270
     		return '';
@@ -295,15 +289,16 @@  discard block
 block discarded – undo
295 289
     {
296 290
         // phpcs:enable
297 291
         $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>';
298
-        if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'>&nbsp;</option>';
292
+        if ($showempty) {
293
+            $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'>&nbsp;</option>';
294
+        }
299 295
 
300 296
         for ($i = $start ; $i <= $end ; $i += $increment)
301 297
         {
302 298
             if ($selected != '' && (int) $selected == $i)
303 299
             {
304 300
                 $return.= '<option value="'.$i.'" selected>';
305
-            }
306
-            else
301
+            } else
307 302
             {
308 303
                 $return.= '<option value="'.$i.'">';
309 304
             }
@@ -356,14 +351,19 @@  discard block
 block discarded – undo
356 351
 
357 352
         // Print a select with each of them
358 353
         $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
354
+        if ($showempty) {
355
+            $moreforfilter.='<option value="0">&nbsp;</option>';
356
+        }
357
+        // Should use -1 to say nothing
360 358
 
361 359
         if (is_array($tab_categs))
362 360
         {
363 361
             foreach ($tab_categs as $categ)
364 362
             {
365 363
                 $moreforfilter.='<option value="'.$categ['id'].'"';
366
-                if ($categ['id'] == $selected) $moreforfilter.=' selected';
364
+                if ($categ['id'] == $selected) {
365
+                    $moreforfilter.=' selected';
366
+                }
367 367
                 $moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>';
368 368
             }
369 369
         }
@@ -410,14 +410,20 @@  discard block
 block discarded – undo
410 410
         }
411 411
         // Select each sales and print them in a select input
412 412
         $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
413
-        if ($showempty) $out.='<option value="0">&nbsp;</option>';
413
+        if ($showempty) {
414
+            $out.='<option value="0">&nbsp;</option>';
415
+        }
414 416
 
415 417
         // Get list of users allowed to be viewed
416 418
         $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
417 419
         $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
418 420
         $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
+        if (empty($user->rights->user->user->lire)) {
422
+            $sql_usr.=" AND u.rowid = ".$user->id;
423
+        }
424
+        if (! empty($user->societe_id)) {
425
+            $sql_usr.=" AND u.fk_soc = ".$user->societe_id;
426
+        }
421 427
         // Add existing sales representatives of thirdparty of external user
422 428
         if (empty($user->rights->user->user->lire) && $user->societe_id)
423 429
         {
@@ -438,7 +444,9 @@  discard block
 block discarded – undo
438 444
 
439 445
                 $out.='<option value="'.$obj_usr->rowid.'"';
440 446
 
441
-                if ($obj_usr->rowid == $selected) $out.=' selected';
447
+                if ($obj_usr->rowid == $selected) {
448
+                    $out.=' selected';
449
+                }
442 450
 
443 451
                 $out.='>';
444 452
                 $out.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname);
@@ -466,8 +474,7 @@  discard block
 block discarded – undo
466 474
                 $out.='</option>';
467 475
             }
468 476
             $this->db->free($resql_usr);
469
-        }
470
-        else
477
+        } else
471 478
         {
472 479
             dol_print_error($this->db);
473 480
         }
@@ -503,15 +510,16 @@  discard block
 block discarded – undo
503 510
         if ($tasksarray)
504 511
         {
505 512
         	print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
506
-            if ($useempty) print '<option value="0">&nbsp;</option>';
513
+            if ($useempty) {
514
+                print '<option value="0">&nbsp;</option>';
515
+            }
507 516
             $j=0;
508 517
             $level=0;
509 518
             $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid);
510 519
             print '</select>';
511 520
 
512 521
             print ajax_combobox($htmlname);
513
-        }
514
-        else
522
+        } else
515 523
         {
516 524
             print '<div class="warning">'.$langs->trans("NoProject").'</div>';
517 525
         }
@@ -545,20 +553,23 @@  discard block
 block discarded – undo
545 553
 				//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id);		// $lines[$i]->id may be empty if project has no lines
546 554
 
547 555
                 // Break on a new project
548
-                if ($parent == 0)	// We are on a task at first level
556
+                if ($parent == 0) {
557
+                    // We are on a task at first level
549 558
                 {
550 559
                     if ($lines[$i]->fk_project != $lastprojectid)	// Break found on project
551 560
                     {
552
-                        if ($i > 0) print '<option value="0" disabled>----------</option>';
561
+                        if ($i > 0) print '<option value="0" disabled>----------</option>';
562
+                }
553 563
                         print '<option value="'.$lines[$i]->fk_project.'_0"';
554
-                        if ($selectedproject == $lines[$i]->fk_project) print ' selected';
564
+                        if ($selectedproject == $lines[$i]->fk_project) {
565
+                            print ' selected';
566
+                        }
555 567
                         print '>';	// Project -> Task
556 568
                         print $langs->trans("Project").' '.$lines[$i]->projectref;
557 569
                         if (empty($lines[$i]->public))
558 570
                         {
559 571
                             print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
560
-                        }
561
-                        else
572
+                        } else
562 573
                         {
563 574
                             print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
564 575
                         }
@@ -573,31 +584,41 @@  discard block
 block discarded – undo
573 584
                 $newdisablechildoftaskid=$disablechildoftaskid;
574 585
 
575 586
                 // Print task
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
587
+                if (isset($lines[$i]->id)) {
588
+                    // 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 589
                 {
578 590
                 	// Check if we must disable entry
579
-                	$disabled=0;
591
+                	$disabled=0;
592
+                }
580 593
                 	if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid)))
581 594
                 	{
582 595
                			$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
596
+               			if ($lines[$i]->fk_parent == $disablechildoftaskid) {
597
+               			    $newdisablechildoftaskid=$lines[$i]->id;
598
+               			}
599
+               			// If task is child of a disabled parent, we will propagate id to disable next child too
584 600
                 	}
585 601
 
586 602
                     print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
587
-                    if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected';
588
-                    if ($disabled) print ' disabled';
603
+                    if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) {
604
+                        print ' selected';
605
+                    }
606
+                    if ($disabled) {
607
+                        print ' disabled';
608
+                    }
589 609
                     print '>';
590 610
                     print $langs->trans("Project").' '.$lines[$i]->projectref;
591 611
                     print ' '.$lines[$i]->projectlabel;
592 612
                     if (empty($lines[$i]->public))
593 613
                     {
594 614
                         print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
595
-                    }
596
-                    else
615
+                    } else
597 616
                     {
598 617
                         print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
599 618
                     }
600
-                    if ($lines[$i]->id) print ' > ';
619
+                    if ($lines[$i]->id) {
620
+                        print ' > ';
621
+                    }
601 622
                     for ($k = 0 ; $k < $level ; $k++)
602 623
                     {
603 624
                         print "&nbsp;&nbsp;&nbsp;";
@@ -607,7 +628,9 @@  discard block
 block discarded – undo
607 628
                 }
608 629
 
609 630
                 $level++;
610
-                if ($lines[$i]->id) $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid);
631
+                if ($lines[$i]->id) {
632
+                    $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid);
633
+                }
611 634
                 $level--;
612 635
             }
613 636
         }
@@ -626,12 +649,17 @@  discard block
 block discarded – undo
626 649
     {
627 650
     	$textcolor='FFF';
628 651
     	include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
629
-    	if(colorIsLight($color)) $textcolor='000';
652
+    	if(colorIsLight($color)) {
653
+    	    $textcolor='000';
654
+    	}
630 655
 
631 656
     	$color = colorArrayToHex(colorStringToArray($color,array()),'');
632 657
 
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
-		else print $textifnotdefined;
658
+		if ($color) {
659
+		    print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
660
+		} else {
661
+		    print $textifnotdefined;
662
+		}
635 663
     }
636 664
 
637 665
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -722,8 +750,7 @@  discard block
 block discarded – undo
722 750
 	             </script>';
723 751
             }
724 752
             $out.= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss?' '.$morecss:'').'" type="text" value="'.$set_color.'" />';
725
-        }
726
-        else  // In most cases, this is not used. We used instead function with no specific list of colors
753
+        } else  // In most cases, this is not used. We used instead function with no specific list of colors
727 754
         {
728 755
             if (empty($conf->dol_use_jmobile))
729 756
             {
@@ -744,7 +771,9 @@  discard block
 block discarded – undo
744 771
             foreach ($arrayofcolors as $val)
745 772
             {
746 773
                 $out.= '<option value="'.$val.'"';
747
-                if ($set_color == $val) $out.= ' selected';
774
+                if ($set_color == $val) {
775
+                    $out.= ' selected';
776
+                }
748 777
                 $out.= '>'.$val.'</option>';
749 778
             }
750 779
             $out.= '</select>';
@@ -828,8 +857,7 @@  discard block
 block discarded – undo
828 857
             if ($selected == $key)
829 858
             {
830 859
                 $select_week .= '<option value="'.$key.'" selected>';
831
-            }
832
-            else
860
+            } else
833 861
             {
834 862
                 $select_week .= '<option value="'.$key.'">';
835 863
             }
@@ -858,8 +886,13 @@  discard block
 block discarded – undo
858 886
 
859 887
         require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
860 888
 
861
-        if ($longlabel) $montharray = monthArray($langs, 0);	// Get array
862
-        else $montharray = monthArray($langs, 1);
889
+        if ($longlabel) {
890
+            $montharray = monthArray($langs, 0);
891
+        }
892
+        // Get array
893
+        else {
894
+            $montharray = monthArray($langs, 1);
895
+        }
863 896
 
864 897
         $select_month = '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
865 898
         if ($useempty)
@@ -871,8 +904,7 @@  discard block
 block discarded – undo
871 904
             if ($selected == $key)
872 905
             {
873 906
                 $select_month .= '<option value="'.$key.'" selected>';
874
-            }
875
-            else
907
+            } else
876 908
             {
877 909
                 $select_month .= '<option value="'.$key.'">';
878 910
             }
@@ -925,13 +957,17 @@  discard block
 block discarded – undo
925 957
         $currentyear = date("Y")+$offset;
926 958
         $max_year = $currentyear+$max_year;
927 959
         $min_year = $currentyear-$min_year;
928
-        if(empty($selected) && empty($useempty)) $selected = $currentyear;
960
+        if(empty($selected) && empty($useempty)) {
961
+            $selected = $currentyear;
962
+        }
929 963
 
930 964
         $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
931 965
         if($useempty)
932 966
         {
933 967
         	$selected_html='';
934
-            if ($selected == '') $selected_html = ' selected';
968
+            if ($selected == '') {
969
+                $selected_html = ' selected';
970
+            }
935 971
             $out.= '<option value=""' . $selected_html . '>&nbsp;</option>';
936 972
         }
937 973
         if (! $invert)
@@ -939,16 +975,19 @@  discard block
 block discarded – undo
939 975
             for ($y = $max_year; $y >= $min_year; $y--)
940 976
             {
941 977
                 $selected_html='';
942
-                if ($selected > 0 && $y == $selected) $selected_html = ' selected';
978
+                if ($selected > 0 && $y == $selected) {
979
+                    $selected_html = ' selected';
980
+                }
943 981
                 $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
944 982
             }
945
-        }
946
-        else
983
+        } else
947 984
         {
948 985
             for ($y = $min_year; $y <= $max_year; $y++)
949 986
             {
950 987
                 $selected_html='';
951
-                if ($selected > 0 && $y == $selected) $selected_html = ' selected';
988
+                if ($selected > 0 && $y == $selected) {
989
+                    $selected_html = ' selected';
990
+                }
952 991
                 $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
953 992
             }
954 993
         }
@@ -985,8 +1024,7 @@  discard block
 block discarded – undo
985 1024
             $langs->load("companies");
986 1025
             print ' &nbsp; <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>';
987 1026
             print '</form>';
988
-        }
989
-        else
1027
+        } else
990 1028
         {
991 1029
             if ($selected)
992 1030
             {
@@ -994,8 +1032,7 @@  discard block
 block discarded – undo
994 1032
                 $address=new Address($this->db);
995 1033
                 $result=$address->fetch_address($selected);
996 1034
                 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
-            }
998
-            else
1035
+            } else
999 1036
             {
1000 1037
                 print "&nbsp;";
1001 1038
             }
@@ -1029,7 +1066,10 @@  discard block
 block discarded – undo
1029 1066
         $boxidactivatedforuser=array();
1030 1067
         foreach($boxactivated as $box)
1031 1068
         {
1032
-        	if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id;	// We keep only boxes to show for user
1069
+        	if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) {
1070
+        	    $boxidactivatedforuser[$box->id]=$box->id;
1071
+        	}
1072
+        	// We keep only boxes to show for user
1033 1073
         }
1034 1074
 
1035 1075
         // Define selectboxlist
@@ -1040,7 +1080,10 @@  discard block
 block discarded – undo
1040 1080
         	$langs->load("boxes");	// Load label of boxes
1041 1081
         	foreach($boxactivated as $box)
1042 1082
         	{
1043
-        		if (! empty($boxidactivatedforuser[$box->id])) continue;	// Already visible for user
1083
+        		if (! empty($boxidactivatedforuser[$box->id])) {
1084
+        		    continue;
1085
+        		}
1086
+        		// Already visible for user
1044 1087
         		$label=$langs->transnoentitiesnoconv($box->boxlabel);
1045 1088
         		//if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
1046 1089
         		if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone')
@@ -1051,7 +1094,9 @@  discard block
 block discarded – undo
1051 1094
         	}
1052 1095
             foreach($boxidactivatedforuser as $boxid)
1053 1096
         	{
1054
-       			if (empty($boxorder)) $boxorder.='A:';
1097
+       			if (empty($boxorder)) {
1098
+       			    $boxorder.='A:';
1099
+       			}
1055 1100
   				$boxorder.=$boxid.',';
1056 1101
         	}
1057 1102
 
@@ -1065,7 +1110,9 @@  discard block
 block discarded – undo
1065 1110
 			$selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">';
1066 1111
 			$selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">';
1067 1112
 			$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").'">';
1113
+            if (empty($conf->use_javascript_ajax)) {
1114
+                $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
1115
+            }
1069 1116
             $selectboxlist.='</form>';
1070 1117
             if (! empty($conf->use_javascript_ajax))
1071 1118
             {
@@ -1116,7 +1163,9 @@  discard block
 block discarded – undo
1116 1163
 	        			window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid;
1117 1164
 	                }
1118 1165
 	        	});';
1119
-	        	if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();';
1166
+	        	if (! count($arrayboxtoactivatelabel)) {
1167
+	        	    $selectboxlist.='jQuery("#boxcombo").hide();';
1168
+	        	}
1120 1169
 	        	$selectboxlist.='
1121 1170
 
1122 1171
 	        	jQuery("#boxhalfleft, #boxhalfright").sortable({
@@ -1159,16 +1208,25 @@  discard block
 block discarded – undo
1159 1208
 
1160 1209
             // Define $box_max_lines
1161 1210
             $box_max_lines=5;
1162
-            if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
1211
+            if (! empty($conf->global->MAIN_BOXES_MAXLINES)) {
1212
+                $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
1213
+            }
1163 1214
 
1164 1215
             $ii=0;
1165 1216
             foreach ($boxactivated as $key => $box)
1166 1217
             {
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
1218
+            	if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) {
1219
+            	    continue;
1220
+            	}
1221
+				if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) {
1222
+				    $box->box_order='A'.sprintf("%02d",($ii+1));
1223
+				}
1224
+				// When box_order was not yet set to Axx or Bxx and is still 0
1225
+            	if (preg_match('/^A/i',$box->box_order)) {
1226
+            	    // column A
1170 1227
                 {
1171
-                    $ii++;
1228
+                    $ii++;
1229
+            	}
1172 1230
                     //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1173 1231
                     //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1174 1232
                     // Show box
@@ -1191,11 +1249,18 @@  discard block
 block discarded – undo
1191 1249
             $ii=0;
1192 1250
             foreach ($boxactivated as $key => $box)
1193 1251
             {
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
1252
+            	if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) {
1253
+            	    continue;
1254
+            	}
1255
+            	if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) {
1256
+            	    $box->box_order='B'.sprintf("%02d",($ii+1));
1257
+            	}
1258
+            	// When box_order was not yet set to Axx or Bxx and is still 0
1259
+            	if (preg_match('/^B/i',$box->box_order)) {
1260
+            	    // colonne B
1197 1261
                 {
1198
-                    $ii++;
1262
+                    $ii++;
1263
+            	}
1199 1264
                     //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1200 1265
                     //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1201 1266
                     // Show box
@@ -1263,8 +1328,7 @@  discard block
 block discarded – undo
1263 1328
                     if ($selected == $obj->rowid || $selected == $obj->$keyfield)
1264 1329
                     {
1265 1330
                         print '<option value="'.$obj->$keyfield.'" selected>';
1266
-                    }
1267
-                    else
1331
+                    } else
1268 1332
                     {
1269 1333
                         print '<option value="'.$obj->$keyfield.'">';
1270 1334
                     }
@@ -1273,13 +1337,11 @@  discard block
 block discarded – undo
1273 1337
                     $i++;
1274 1338
                 }
1275 1339
                 print "</select>";
1276
-            }
1277
-            else
1340
+            } else
1278 1341
 			{
1279 1342
                 print $langs->trans("DictionaryEmpty");
1280 1343
             }
1281
-        }
1282
-        else {
1344
+        } else {
1283 1345
             dol_print_error($this->db);
1284 1346
         }
1285 1347
     }
Please login to merge, or discard this patch.
Base/AlixarView.php 1 patch
Braces   +124 added lines, -81 removed lines patch added patch discarded remove patch
@@ -189,15 +189,20 @@  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
194
-                } else
195
-                    $appli .= " " . DOL_VERSION;
196
-            } else
197
-                $appli .= " " . DOL_VERSION;
192
+                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
193
+                                            $appli .= " (" . DOL_VERSION . ")";
194
+                    }
195
+                    // If new title contains a version that is different than core
196
+                } else {
197
+                                    $appli .= " " . DOL_VERSION;
198
+                }
199
+            } else {
200
+                            $appli .= " " . DOL_VERSION;
201
+            }
198 202
 
199
-            if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL))
200
-                $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
203
+            if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) {
204
+                            $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
205
+            }
201 206
 
202 207
 $logouttext = '';
203 208
             if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -235,12 +240,15 @@  discard block
 block discarded – undo
235 240
             $parameters = array();
236 241
             $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
237 242
             if (is_numeric($result)) {
238
-                if ($result == 0)
239
-                    $toprightmenu .= Globals::$hookManager->resPrint;  // add
240
-                else
241
-                    $toprightmenu = Globals::$hookManager->resPrint;      // replace
242
-            }
243
-            else {
243
+                if ($result == 0) {
244
+                                    $toprightmenu .= Globals::$hookManager->resPrint;
245
+                }
246
+                // add
247
+                else {
248
+                                    $toprightmenu = Globals::$hookManager->resPrint;
249
+                }
250
+                // replace
251
+            } else {
244 252
                 $toprightmenu .= $result; // For backward compatibility
245 253
             }
246 254
 
@@ -334,8 +342,9 @@  discard block
 block discarded – undo
334 342
             print "<!-- End top horizontal menu -->\n\n";
335 343
         }
336 344
 
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 : '') . '">';
345
+        if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) {
346
+                    print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
347
+        }
339 348
     }
340 349
 
341 350
     /**
@@ -360,8 +369,9 @@  discard block
 block discarded – undo
360 369
         $searchform = '';
361 370
         $bookmarks = '';
362 371
 
363
-        if (!empty($menu_array_before))
364
-            dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
372
+        if (!empty($menu_array_before)) {
373
+                    dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
374
+        }
365 375
 
366 376
         if (empty(Globals::$conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
367 377
 // Instantiate hooks of thirdparty module
@@ -369,8 +379,10 @@  discard block
 block discarded – undo
369 379
 
370 380
             print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
371 381
 
372
-            if (Globals::$conf->browser->layout == 'phone')
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 ?
382
+            if (Globals::$conf->browser->layout == 'phone') {
383
+                            Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
384
+            }
385
+            // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
374 386
 
375 387
 print "\n";
376 388
 
@@ -397,8 +409,9 @@  discard block
 block discarded – undo
397 409
             $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
398 410
             if (empty($reshook)) {
399 411
                 $searchform .= Globals::$hookManager->resPrint;
400
-            } else
401
-                $searchform = Globals::$hookManager->resPrint;
412
+            } else {
413
+                            $searchform = Globals::$hookManager->resPrint;
414
+            }
402 415
 
403 416
 // Force special value for $searchform
404 417
             if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) {
@@ -442,38 +455,49 @@  discard block
 block discarded – undo
442 455
             if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
443 456
                 $doliurl = 'https://www.dolibarr.org';
444 457
 //local communities
445
-                if (preg_match('/fr/i', Globals::$langs->defaultlang))
446
-                    $doliurl = 'https://www.dolibarr.fr';
447
-                if (preg_match('/es/i', Globals::$langs->defaultlang))
448
-                    $doliurl = 'https://www.dolibarr.es';
449
-                if (preg_match('/de/i', Globals::$langs->defaultlang))
450
-                    $doliurl = 'https://www.dolibarr.de';
451
-                if (preg_match('/it/i', Globals::$langs->defaultlang))
452
-                    $doliurl = 'https://www.dolibarr.it';
453
-                if (preg_match('/gr/i', Globals::$langs->defaultlang))
454
-                    $doliurl = 'https://www.dolibarr.gr';
458
+                if (preg_match('/fr/i', Globals::$langs->defaultlang)) {
459
+                                    $doliurl = 'https://www.dolibarr.fr';
460
+                }
461
+                if (preg_match('/es/i', Globals::$langs->defaultlang)) {
462
+                                    $doliurl = 'https://www.dolibarr.es';
463
+                }
464
+                if (preg_match('/de/i', Globals::$langs->defaultlang)) {
465
+                                    $doliurl = 'https://www.dolibarr.de';
466
+                }
467
+                if (preg_match('/it/i', Globals::$langs->defaultlang)) {
468
+                                    $doliurl = 'https://www.dolibarr.it';
469
+                }
470
+                if (preg_match('/gr/i', Globals::$langs->defaultlang)) {
471
+                                    $doliurl = 'https://www.dolibarr.gr';
472
+                }
455 473
 
456 474
                 $appli = constant('DOL_APPLICATION_TITLE');
457 475
                 if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) {
458 476
                     $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
459 477
 $doliurl = '';
460 478
                     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
463
-                    } else
464
-                        $appli .= " " . DOL_VERSION;
465
-                } else
466
-                    $appli .= " " . DOL_VERSION;
479
+                        if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
480
+                                                    $appli .= " (" . DOL_VERSION . ")";
481
+                        }
482
+                        // If new title contains a version that is different than core
483
+                    } else {
484
+                                            $appli .= " " . DOL_VERSION;
485
+                    }
486
+                } else {
487
+                                    $appli .= " " . DOL_VERSION;
488
+                }
467 489
                 print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
468
-                if ($doliurl)
469
-                    print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
470
-                else
471
-                    print '<span class="help">';
490
+                if ($doliurl) {
491
+                                    print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
492
+                } else {
493
+                                    print '<span class="help">';
494
+                }
472 495
                 print $appli;
473
-                if ($doliurl)
474
-                    print '</a>';
475
-                else
476
-                    print '</span>';
496
+                if ($doliurl) {
497
+                                    print '</a>';
498
+                } else {
499
+                                    print '</span>';
500
+                }
477 501
                 print '</div>' . "\n";
478 502
             }
479 503
 
@@ -520,8 +544,9 @@  discard block
 block discarded – undo
520 544
         print "\n";
521 545
         print '<!-- Begin right area -->' . "\n";
522 546
 
523
-        if (empty($leftmenuwithoutmainarea))
524
-            main_area($title);
547
+        if (empty($leftmenuwithoutmainarea)) {
548
+                    main_area($title);
549
+        }
525 550
     }
526 551
 
527 552
     /**
@@ -534,16 +559,18 @@  discard block
 block discarded – undo
534 559
     {
535 560
 // global Globals::$conf, Globals::$langs;
536 561
 
537
-        if (empty(Globals::$conf->dol_hide_leftmenu))
538
-    print '<div id="id-right">';
562
+        if (empty(Globals::$conf->dol_hide_leftmenu)) {
563
+            print '<div id="id-right">';
564
+        }
539 565
 
540 566
         print "\n";
541 567
 
542 568
         print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
543 569
 
544
-        if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED))
545
-            print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
546
-}
570
+        if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
571
+                    print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
572
+        }
573
+        }
547 574
 
548 575
     /**
549 576
      *  Return helpbaseurl, helppage and mode
@@ -567,18 +594,21 @@  discard block
 block discarded – undo
567 594
 // If WIKI URL
568 595
             if (preg_match('/^es/i', Globals::$langs->defaultlang)) {
569 596
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
570
-                if (preg_match('/ES:([^|]+)/i', $helppagename, $reg))
571
-                    $helppage = $reg[1];
597
+                if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) {
598
+                                    $helppage = $reg[1];
599
+                }
572 600
             }
573 601
             if (preg_match('/^fr/i', Globals::$langs->defaultlang)) {
574 602
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
575
-                if (preg_match('/FR:([^|]+)/i', $helppagename, $reg))
576
-                    $helppage = $reg[1];
603
+                if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) {
604
+                                    $helppage = $reg[1];
605
+                }
577 606
             }
578 607
             if (empty($helppage)) { // If help page not already found
579 608
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
580
-                if (preg_match('/EN:([^|]+)/i', $helppagename, $reg))
581
-                    $helppage = $reg[1];
609
+                if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) {
610
+                                    $helppage = $reg[1];
611
+                }
582 612
             }
583 613
             $mode = 'wiki';
584 614
         }
@@ -609,8 +639,9 @@  discard block
 block discarded – undo
609 639
         $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
610 640
         $ret .= '<input type="hidden" name="mode" value="search">';
611 641
         $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag(Globals::$user->login) . '">';
612
-        if ($showtitlebefore)
613
-            $ret .= $title . ' ';
642
+        if ($showtitlebefore) {
643
+                    $ret .= $title . ' ';
644
+        }
614 645
         $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
615 646
         $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
616 647
         $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
@@ -652,10 +683,12 @@  discard block
 block discarded – undo
652 683
             foreach (Globals::$user->lastsearch_values_tmp as $key => $val) {
653 684
                 unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
654 685
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
655
-                    if (empty($val['sortfield']))
656
-                        unset($val['sortfield']);
657
-                    if (empty($val['sortorder']))
658
-                        unset($val['sortorder']);
686
+                    if (empty($val['sortfield'])) {
687
+                                            unset($val['sortfield']);
688
+                    }
689
+                    if (empty($val['sortorder'])) {
690
+                                            unset($val['sortorder']);
691
+                    }
659 692
                     dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
660 693
                     $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
661 694
                     unset($_SESSION['lastsearch_values_' . $key]);
@@ -666,8 +699,9 @@  discard block
 block discarded – undo
666 699
 
667 700
         $relativepathstring = $_SERVER["PHP_SELF"];
668 701
 // Clean $relativepathstring
669
-        if (constant('DOL_BASE_URI'))
670
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
702
+        if (constant('DOL_BASE_URI')) {
703
+                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
704
+        }
671 705
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
672 706
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
673 707
         if (preg_match('/list\.php$/', $relativepathstring)) {
@@ -675,12 +709,15 @@  discard block
 block discarded – undo
675 709
             unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
676 710
             unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
677 711
 
678
-            if (!empty($contextpage))
679
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
680
-            if (!empty($page) && $page > 1)
681
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
682
-            if (!empty($limit) && $limit != Globals::$conf->limit)
683
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
712
+            if (!empty($contextpage)) {
713
+                            $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
714
+            }
715
+            if (!empty($page) && $page > 1) {
716
+                            $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
717
+            }
718
+            if (!empty($limit) && $limit != Globals::$conf->limit) {
719
+                            $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
720
+            }
684 721
 
685 722
             unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
686 723
             unset($_SESSION['lastsearch_page_' . $relativepathstring]);
@@ -707,20 +744,26 @@  discard block
 block discarded – undo
707 744
 
708 745
         print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
709 746
 
710
-        if (empty(Globals::$conf->dol_hide_leftmenu))
711
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
747
+        if (empty(Globals::$conf->dol_hide_leftmenu)) {
748
+                    print '</div> <!-- End div id-right -->' . "\n";
749
+        }
750
+        // End div id-right
712 751
 
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
752
+        if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) {
753
+                    print '</div> <!-- End div id-container -->' . "\n";
754
+        }
755
+        // End div container
715 756
 
716 757
         print "\n";
717
-        if ($comment)
718
-            print '<!-- ' . $comment . ' -->' . "\n";
758
+        if ($comment) {
759
+                    print '<!-- ' . $comment . ' -->' . "\n";
760
+        }
719 761
 
720 762
         printCommonFooter($zone);
721 763
 
722
-        if (!empty($delayedhtmlcontent))
723
-            print $delayedhtmlcontent;
764
+        if (!empty($delayedhtmlcontent)) {
765
+                    print $delayedhtmlcontent;
766
+        }
724 767
 
725 768
         if (!empty(Globals::$conf->use_javascript_ajax)) {
726 769
             print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
Please login to merge, or discard this patch.