Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/lib/images.lib.php 1 patch
Braces   +68 added lines, -22 removed lines patch added patch discarded remove patch
@@ -47,19 +47,40 @@  discard block
 block discarded – undo
47 47
 
48 48
 	// Case filename is not a format image
49 49
 	$reg = array();
50
-	if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
50
+	if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) {
51
+		return -1;
52
+	}
51 53
 
52 54
 	// Case filename is a format image but not supported by this PHP
53 55
 	$imgfonction = '';
54
-	if (strtolower($reg[1]) == '.gif')  $imgfonction = 'imagecreatefromgif';
55
-	if (strtolower($reg[1]) == '.jpg')  $imgfonction = 'imagecreatefromjpeg';
56
-	if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
57
-	if (strtolower($reg[1]) == '.png')  $imgfonction = 'imagecreatefrompng';
58
-	if (strtolower($reg[1]) == '.bmp')  $imgfonction = 'imagecreatefromwbmp';
59
-	if (strtolower($reg[1]) == '.webp')  $imgfonction = 'imagecreatefromwebp';
60
-	if (strtolower($reg[1]) == '.xpm')  $imgfonction = 'imagecreatefromxpm';
61
-	if (strtolower($reg[1]) == '.xbm')  $imgfonction = 'imagecreatefromxbm';
62
-	if (strtolower($reg[1]) == '.svg')  $imgfonction = 'imagecreatefromsvg'; // Never available
56
+	if (strtolower($reg[1]) == '.gif') {
57
+		$imgfonction = 'imagecreatefromgif';
58
+	}
59
+	if (strtolower($reg[1]) == '.jpg') {
60
+		$imgfonction = 'imagecreatefromjpeg';
61
+	}
62
+	if (strtolower($reg[1]) == '.jpeg') {
63
+		$imgfonction = 'imagecreatefromjpeg';
64
+	}
65
+	if (strtolower($reg[1]) == '.png') {
66
+		$imgfonction = 'imagecreatefrompng';
67
+	}
68
+	if (strtolower($reg[1]) == '.bmp') {
69
+		$imgfonction = 'imagecreatefromwbmp';
70
+	}
71
+	if (strtolower($reg[1]) == '.webp') {
72
+		$imgfonction = 'imagecreatefromwebp';
73
+	}
74
+	if (strtolower($reg[1]) == '.xpm') {
75
+		$imgfonction = 'imagecreatefromxpm';
76
+	}
77
+	if (strtolower($reg[1]) == '.xbm') {
78
+		$imgfonction = 'imagecreatefromxbm';
79
+	}
80
+	if (strtolower($reg[1]) == '.svg') {
81
+		$imgfonction = 'imagecreatefromsvg';
82
+	}
83
+	// Never available
63 84
 	if ($imgfonction)
64 85
 	{
65 86
 		if (!function_exists($imgfonction))
@@ -87,7 +108,9 @@  discard block
 block discarded – undo
87 108
 {
88 109
 	$ret = array();
89 110
 
90
-	if (image_format_supported($file) < 0) return $ret;
111
+	if (image_format_supported($file) < 0) {
112
+		return $ret;
113
+	}
91 114
 
92 115
 	$filetoread = $file;
93 116
 	if (!$url)
@@ -157,11 +180,14 @@  discard block
 block discarded – undo
157 180
 	$imgWidth = $infoImg[0]; // Largeur de l'image
158 181
 	$imgHeight = $infoImg[1]; // Hauteur de l'image
159 182
 
160
-	if ($mode == 0)	// If resize, we check parameters
183
+	if ($mode == 0) {
184
+		// If resize, we check parameters
161 185
 	{
162 186
 		if ($newWidth <= 0)
163 187
 		{
164
-			$newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
188
+			$newWidth = intval(($newHeight / $imgHeight) * $imgWidth);
189
+	}
190
+	// Keep ratio
165 191
 		}
166 192
 		if ($newHeight <= 0)
167 193
 		{
@@ -269,7 +295,9 @@  discard block
 block discarded – undo
269 295
 			$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127);
270 296
 			break;
271 297
 	}
272
-	if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
298
+	if (function_exists("imagefill")) {
299
+		imagefill($imgThumb, 0, 0, $trans_colour);
300
+	}
273 301
 
274 302
 	dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality");
275 303
 	//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
@@ -302,7 +330,9 @@  discard block
 block discarded – undo
302 330
 	}
303 331
 
304 332
 	// Set permissions on file
305
-	if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
333
+	if (!empty($conf->global->MAIN_UMASK)) {
334
+		@chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
335
+	}
306 336
 
307 337
 	// Free memory. This does not delete image.
308 338
 	imagedestroy($img);
@@ -359,9 +389,11 @@  discard block
 block discarded – undo
359 389
 						break;
360 390
 				}
361 391
 				if ($deg) {
362
-					if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
392
+					if ($infoImg[2] === 'IMAGETYPE_PNG') {
393
+						// In fact there is no exif on PNG but just in case
363 394
 					{
364 395
 						imagealphablending($img, false);
396
+					}
365 397
 						imagesavealpha($img, true);
366 398
 						$img = imagerotate($img, $deg, imageColorAllocateAlpha($img, 0, 0, 0, 127));
367 399
 						imagealphablending($img, false);
@@ -471,8 +503,14 @@  discard block
 block discarded – undo
471 503
 		}
472 504
 	}
473 505
 
474
-	if ($maxWidth == -1) $maxWidth = $infoImg[0]; // If size is -1, we keep unchanged
475
-	if ($maxHeight == -1) $maxHeight = $infoImg[1]; // If size is -1, we keep unchanged
506
+	if ($maxWidth == -1) {
507
+		$maxWidth = $infoImg[0];
508
+	}
509
+	// If size is -1, we keep unchanged
510
+	if ($maxHeight == -1) {
511
+		$maxHeight = $infoImg[1];
512
+	}
513
+	// If size is -1, we keep unchanged
476 514
 
477 515
 	// Si l'image est plus petite que la largeur et la hauteur max, on ne cree pas de vignette
478 516
 	if ($infoImg[0] < $maxWidth && $infoImg[1] < $maxHeight)
@@ -572,9 +610,11 @@  discard block
 block discarded – undo
572 610
 	{
573 611
 		$rotated = false;
574 612
 
575
-		if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
613
+		if ($infoImg[2] === 'IMAGETYPE_PNG') {
614
+			// In fact there is no exif on PNG but just in case
576 615
 		{
577 616
 			imagealphablending($img, false);
617
+		}
578 618
 			imagesavealpha($img, true);
579 619
 			$rotated = imagerotate($img, $exifAngle, imageColorAllocateAlpha($img, 0, 0, 0, 127));
580 620
 			imagealphablending($rotated, false);
@@ -613,7 +653,9 @@  discard block
 block discarded – undo
613 653
 	$thumbWidth = round($thumbWidth);
614 654
 
615 655
 	// Define target format
616
-	if (empty($targetformat)) $targetformat = $infoImg[2];
656
+	if (empty($targetformat)) {
657
+		$targetformat = $infoImg[2];
658
+	}
617 659
 
618 660
 	// Create empty image
619 661
 	if ($targetformat == IMAGETYPE_GIF)
@@ -669,7 +711,9 @@  discard block
 block discarded – undo
669 711
 			$newquality = 'NU';
670 712
 			break;
671 713
 	}
672
-	if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
714
+	if (function_exists("imagefill")) {
715
+		imagefill($imgThumb, 0, 0, $trans_colour);
716
+	}
673 717
 
674 718
 	dol_syslog("vignette: convert image from ($imgWidth x $imgHeight) to ($thumbWidth x $thumbHeight) as $extImg, newquality=$newquality");
675 719
 	//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
@@ -706,7 +750,9 @@  discard block
 block discarded – undo
706 750
 	}
707 751
 
708 752
 	// Set permissions on file
709
-	if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
753
+	if (!empty($conf->global->MAIN_UMASK)) {
754
+		@chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
755
+	}
710 756
 
711 757
 	// Free memory. This does not delete image.
712 758
 	imagedestroy($img);
Please login to merge, or discard this patch.
htdocs/core/lib/resource.lib.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 		$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
46 46
 		$head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
47 47
 		$head[$h][1] = $langs->trans('ContactsAddresses');
48
-		if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
48
+		if ($nbContact > 0) {
49
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
50
+		}
49 51
 		$head[$h][2] = 'contact';
50 52
 		$h++;
51 53
 	}
@@ -59,11 +61,17 @@  discard block
 block discarded – undo
59 61
 	if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
60 62
 	{
61 63
 		$nbNote = 0;
62
-		if (!empty($object->note_private)) $nbNote++;
63
-		if (!empty($object->note_public)) $nbNote++;
64
+		if (!empty($object->note_private)) {
65
+			$nbNote++;
66
+		}
67
+		if (!empty($object->note_public)) {
68
+			$nbNote++;
69
+		}
64 70
 		$head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
65 71
 		$head[$h][1] = $langs->trans('Notes');
66
-		if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
72
+		if ($nbNote > 0) {
73
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
74
+		}
67 75
 		$head[$h][2] = 'note';
68 76
 		$h++;
69 77
 	}
@@ -73,7 +81,9 @@  discard block
 block discarded – undo
73 81
 	$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
74 82
 	$head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
75 83
 	$head[$h][1] = $langs->trans("Documents");
76
-	if ($nbFiles > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFiles.'</span>';
84
+	if ($nbFiles > 0) {
85
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbFiles.'</span>';
86
+	}
77 87
 	$head[$h][2] = 'documents';
78 88
 	$h++;
79 89
 
Please login to merge, or discard this patch.
htdocs/core/lib/salaries.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@
 block discarded – undo
50 50
 	$nbLinks = Link::count($db, $object->element, $object->id);
51 51
 	$head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
52 52
 	$head[$h][1] = $langs->trans('Documents');
53
-	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge ">'.($nbFiles + $nbLinks).'</span>';
53
+	if (($nbFiles + $nbLinks) > 0) {
54
+		$head[$h][1] .= '<span class="badge ">'.($nbFiles + $nbLinks).'</span>';
55
+	}
54 56
 	$head[$h][2] = 'documents';
55 57
 	$h++;
56 58
 
Please login to merge, or discard this patch.
htdocs/user/param_ihm.php 1 patch
Braces   +43 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,11 +47,15 @@  discard block
 block discarded – undo
47 47
 
48 48
 // Security check
49 49
 $socid = 0;
50
-if ($user->socid > 0) $socid = $user->socid;
50
+if ($user->socid > 0) {
51
+	$socid = $user->socid;
52
+}
51 53
 $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
52 54
 
53 55
 $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
54
-if ($user->id <> $id && !$canreaduser) accessforbidden();
56
+if ($user->id <> $id && !$canreaduser) {
57
+	accessforbidden();
58
+}
55 59
 
56 60
 $dirtop = "../core/menus/standard";
57 61
 $dirleft = "../core/menus/standard";
@@ -81,7 +85,9 @@  discard block
 block discarded – undo
81 85
 
82 86
 $parameters = array('id'=>$socid);
83 87
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
84
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
88
+if ($reshook < 0) {
89
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
90
+}
85 91
 
86 92
 if (empty($reshook)) {
87 93
 	if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
@@ -174,14 +180,31 @@  discard block
 block discarded – undo
174 180
 
175 181
 // List of possible landing pages
176 182
 $tmparray = array('index.php'=>'Dashboard');
177
-if (!empty($conf->societe->enabled)) $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea';
178
-if (!empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea';
179
-if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus
180
-if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea';
181
-if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
182
-if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
183
-if (!empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
184
-if (!empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
183
+if (!empty($conf->societe->enabled)) {
184
+	$tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea';
185
+}
186
+if (!empty($conf->projet->enabled)) {
187
+	$tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea';
188
+}
189
+if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) {
190
+	$tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea';
191
+}
192
+// TODO Complete list with first level of menus
193
+if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
194
+	$tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea';
195
+}
196
+if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) {
197
+	$tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
198
+}
199
+if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) {
200
+	$tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
201
+}
202
+if (!empty($conf->adherent->enabled)) {
203
+	$tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
204
+}
205
+if (!empty($conf->agenda->enabled)) {
206
+	$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
207
+}
185 208
 
186 209
 $head = user_prepare_head($object);
187 210
 
@@ -360,7 +383,9 @@  discard block
 block discarded – undo
360 383
 	if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE]))
361 384
 	{
362 385
 		print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
363
-	} else print $object->conf->MAIN_LANDING_PAGE;
386
+	} else {
387
+		print $object->conf->MAIN_LANDING_PAGE;
388
+	}
364 389
 	//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
365 390
 	print '</td></tr>';
366 391
 
@@ -371,7 +396,9 @@  discard block
 block discarded – undo
371 396
 	print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
372 397
 	print '<td>'."\n";
373 398
 	$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
374
-	if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
399
+	if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
400
+		print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
401
+	}
375 402
 	print '</td></tr>'."\n";
376 403
 
377 404
 	// Max size for lists
@@ -394,9 +421,11 @@  discard block
 block discarded – undo
394 421
 	{
395 422
 		print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
396 423
 	} else {
397
-		if ($caneditfield || !empty($user->admin))       // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
424
+		if ($caneditfield || !empty($user->admin)) {
425
+			// Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
398 426
 		{
399 427
 			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
428
+		}
400 429
 		} else {
401 430
 			print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
402 431
 		}
Please login to merge, or discard this patch.
htdocs/admin/emailcollector_card.php 1 patch
Braces   +44 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,8 +33,12 @@  discard block
 block discarded – undo
33 33
 include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php';
34 34
 include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
35 35
 
36
-if (!$user->admin) accessforbidden();
37
-if (empty($conf->emailcollector->enabled)) accessforbidden();
36
+if (!$user->admin) {
37
+	accessforbidden();
38
+}
39
+if (empty($conf->emailcollector->enabled)) {
40
+	accessforbidden();
41
+}
38 42
 
39 43
 // Load traductions files required by page
40 44
 $langs->loadLangs(array("admin", "mails", "other"));
@@ -65,11 +69,17 @@  discard block
 block discarded – undo
65 69
 $search_all = GETPOST("search_all", 'alpha');
66 70
 $search = array();
67 71
 foreach ($object->fields as $key => $val) {
68
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
69
-}
72
+	if (GETPOST('search_'.$key, 'alpha')) {
73
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
74
+	}
75
+	}
70 76
 
71
-if (GETPOST('saveoperation2')) $action = 'updateoperation';
72
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
77
+if (GETPOST('saveoperation2')) {
78
+	$action = 'updateoperation';
79
+}
80
+if (empty($action) && empty($id) && empty($ref)) {
81
+	$action = 'view';
82
+}
73 83
 
74 84
 // Load object
75 85
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@@ -93,7 +103,9 @@  discard block
 block discarded – undo
93 103
 
94 104
 $parameters = array();
95 105
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
96
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
106
+if ($reshook < 0) {
107
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
108
+}
97 109
 
98 110
 if (empty($reshook))
99 111
 {
@@ -101,7 +113,9 @@  discard block
 block discarded – undo
101 113
 
102 114
 	$permissiontoadd = 1;
103 115
 	$permissiontodelete = 1;
104
-	if (empty($backtopage)) $backtopage = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.($id > 0 ? $id : '__ID__');
116
+	if (empty($backtopage)) {
117
+		$backtopage = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.($id > 0 ? $id : '__ID__');
118
+	}
105 119
 	$backurlforlist = DOL_URL_ROOT.'/admin/emailcollector_list.php';
106 120
 
107 121
 	// Actions cancel, add, update, delete or clone
@@ -341,8 +355,11 @@  discard block
 block discarded – undo
341 355
 	// Call Hook formConfirm
342 356
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
343 357
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
344
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
345
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
358
+	if (empty($reshook)) {
359
+		$formconfirm .= $hookmanager->resPrint;
360
+	} elseif ($reshook > 0) {
361
+		$formconfirm = $hookmanager->resPrint;
362
+	}
346 363
 
347 364
 	// Print form confirm
348 365
 	print $formconfirm;
@@ -562,18 +579,26 @@  discard block
 block discarded – undo
562 579
 		'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
563 580
 		'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
564 581
 		'recordevent'=>'RecordEvent');
565
-	if ($conf->projet->enabled) $arrayoftypes['project'] = 'CreateLeadAndThirdParty';
566
-	if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
567
-	if ($conf->recruitment->enabled) $arrayoftypes['candidature'] = 'CreateCandidature';
582
+	if ($conf->projet->enabled) {
583
+		$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
584
+	}
585
+	if ($conf->ticket->enabled) {
586
+		$arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
587
+	}
588
+	if ($conf->recruitment->enabled) {
589
+		$arrayoftypes['candidature'] = 'CreateCandidature';
590
+	}
568 591
 
569 592
 	// support hook for add action
570 593
 	$parameters = array('arrayoftypes' => $arrayoftypes);
571 594
 	$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
572 595
 
573
-	if ($res)
574
-		$arrayoftypes = $hookmanager->resArray;
575
-	else foreach ($hookmanager->resArray as $k=>$desc)
596
+	if ($res) {
597
+			$arrayoftypes = $hookmanager->resArray;
598
+	} else {
599
+		foreach ($hookmanager->resArray as $k=>$desc)
576 600
 			$arrayoftypes[$k] = $desc;
601
+	}
577 602
 
578 603
 
579 604
 	print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');
@@ -660,7 +685,9 @@  discard block
 block discarded – undo
660 685
 		print '<div class="tabsAction">'."\n";
661 686
 		$parameters = array();
662 687
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
663
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
688
+		if ($reshook < 0) {
689
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
690
+		}
664 691
 
665 692
 		if (empty($reshook))
666 693
 		{
Please login to merge, or discard this patch.
htdocs/projet/graph_opportunities.inc.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,8 +24,12 @@  discard block
 block discarded – undo
24 24
 	$sql .= " WHERE p.entity IN (".getEntity('project').")";
25 25
 	$sql .= " AND p.fk_opp_status = cls.rowid";
26 26
 	$sql .= " AND p.fk_statut = 1"; // Opend projects only
27
-	if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")";
28
-	if ($socid)	$sql .= "  AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
27
+	if ($mine || empty($user->rights->projet->all->lire)) {
28
+		$sql .= " AND p.rowid IN (".$projectsListId.")";
29
+	}
30
+	if ($socid) {
31
+		$sql .= "  AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
32
+	}
29 33
 	$sql .= " GROUP BY p.fk_opp_status, cls.code";
30 34
 	$resql = $db->query($sql);
31 35
 
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
 				$valsnb[$obj->opp_status] = $obj->nb;
51 55
 				$valsamount[$obj->opp_status] = $obj->opp_amount;
52 56
 				$totalnb += $obj->nb;
53
-				if ($obj->opp_status) $totaloppnb += $obj->nb;
57
+				if ($obj->opp_status) {
58
+					$totaloppnb += $obj->nb;
59
+				}
54 60
 				if (!in_array($obj->code, array('WON', 'LOST'))) {
55 61
 					$totalamount += $obj->opp_amount;
56 62
 					$ponderated_opp_amount += $obj->ponderated_opp_amount;
@@ -72,8 +78,12 @@  discard block
 block discarded – undo
72 78
 			$labelStatus = '';
73 79
 
74 80
 			$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
75
-			if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
76
-			if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
81
+			if ($code) {
82
+				$labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
83
+			}
84
+			if (empty($labelStatus)) {
85
+				$labelStatus = $listofopplabel[$status];
86
+			}
77 87
 
78 88
 			//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
79 89
 			//$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';
Please login to merge, or discard this patch.
htdocs/projet/class/api_tasks.class.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -118,18 +118,33 @@  discard block
 block discarded – undo
118 118
 
119 119
 		// If the internal user must only see his customers, force searching by him
120 120
 		$search_sale = 0;
121
-		if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
121
+		if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) {
122
+			$search_sale = DolibarrApiAccess::$user->id;
123
+		}
122 124
 
123 125
 		$sql = "SELECT t.rowid";
124
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
126
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
127
+			$sql .= ", sc.fk_soc, sc.fk_user";
128
+		}
129
+		// We need these fields in order to filter by sale (including the case where the user can only see his prospects)
125 130
 		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t";
126 131
 
127
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
132
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
133
+			$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
134
+		}
135
+		// We need this table joined to the select in order to filter by sale
128 136
 
129 137
 		$sql .= ' WHERE t.entity IN ('.getEntity('project').')';
130
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
131
-		if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
132
-		if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
138
+		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
139
+			$sql .= " AND t.fk_soc = sc.fk_soc";
140
+		}
141
+		if ($socids) {
142
+			$sql .= " AND t.fk_soc IN (".$socids.")";
143
+		}
144
+		if ($search_sale > 0) {
145
+			$sql .= " AND t.rowid = sc.fk_soc";
146
+		}
147
+		// Join for the needed table to filter by sale
133 148
 		// Insert sale filter
134 149
 		if ($search_sale > 0)
135 150
 		{
@@ -443,7 +458,9 @@  discard block
 block discarded – undo
443 458
 			throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
444 459
 		}
445 460
 		foreach ($request_data as $field => $value) {
446
-			if ($field == 'id') continue;
461
+			if ($field == 'id') {
462
+				continue;
463
+			}
447 464
 			$this->task->$field = $value;
448 465
 		}
449 466
 
@@ -519,7 +536,9 @@  discard block
 block discarded – undo
519 536
 		}
520 537
 
521 538
 		$uid = $user_id;
522
-		if (empty($uid)) $uid = DolibarrApiAccess::$user->id;
539
+		if (empty($uid)) {
540
+			$uid = DolibarrApiAccess::$user->id;
541
+		}
523 542
 
524 543
 		$newdate = dol_stringtotime($date, 1);
525 544
 		$this->task->timespent_date = $newdate;
@@ -607,8 +626,9 @@  discard block
 block discarded – undo
607 626
 	{
608 627
 		$object = array();
609 628
 		foreach (self::$FIELDS as $field) {
610
-			if (!isset($data[$field]))
611
-				throw new RestException(400, "$field field missing");
629
+			if (!isset($data[$field])) {
630
+							throw new RestException(400, "$field field missing");
631
+			}
612 632
 			$object[$field] = $data[$field];
613 633
 		}
614 634
 		return $object;
Please login to merge, or discard this patch.
htdocs/bom/bom_card.php 1 patch
Braces   +38 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,10 +61,14 @@  discard block
 block discarded – undo
61 61
 $search = array();
62 62
 foreach ($object->fields as $key => $val)
63 63
 {
64
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
65
-}
64
+	if (GETPOST('search_'.$key, 'alpha')) {
65
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
66
+	}
67
+	}
66 68
 
67
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
69
+if (empty($action) && empty($id) && empty($ref)) {
70
+	$action = 'view';
71
+}
68 72
 
69 73
 // Load object
70 74
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@@ -88,7 +92,9 @@  discard block
 block discarded – undo
88 92
 
89 93
 $parameters = array();
90 94
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
91
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
95
+if ($reshook < 0) {
96
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
97
+}
92 98
 
93 99
 if (empty($reshook))
94 100
 {
@@ -98,8 +104,11 @@  discard block
 block discarded – undo
98 104
 
99 105
 	if (empty($backtopage) || ($cancel && empty($id))) {
100 106
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
101
-			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
102
-			else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
107
+			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
108
+				$backtopage = $backurlforlist;
109
+			} else {
110
+				$backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
111
+			}
103 112
 		}
104 113
 	}
105 114
 
@@ -367,7 +376,10 @@  discard block
 block discarded – undo
367 376
 			require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
368 377
 			$formproduct = new FormProduct($db);
369 378
 			$forcecombo = 0;
370
-			if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
379
+			if ($conf->browser->name == 'ie') {
380
+				$forcecombo = 1;
381
+			}
382
+			// There is a bug in IE10 that make combo inside popup crazy
371 383
 			$formquestion = array(
372 384
 				// 'text' => $langs->trans("ConfirmClone"),
373 385
 				// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
@@ -397,7 +409,10 @@  discard block
 block discarded – undo
397 409
 			require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
398 410
 			$formproduct = new FormProduct($db);
399 411
 			$forcecombo = 0;
400
-			if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
412
+			if ($conf->browser->name == 'ie') {
413
+				$forcecombo = 1;
414
+			}
415
+			// There is a bug in IE10 that make combo inside popup crazy
401 416
 			$formquestion = array(
402 417
 				// 'text' => $langs->trans("ConfirmClone"),
403 418
 				// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
@@ -427,7 +442,10 @@  discard block
 block discarded – undo
427 442
 			require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
428 443
 			$formproduct = new FormProduct($db);
429 444
 			$forcecombo = 0;
430
-			if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
445
+			if ($conf->browser->name == 'ie') {
446
+				$forcecombo = 1;
447
+			}
448
+			// There is a bug in IE10 that make combo inside popup crazy
431 449
 			$formquestion = array(
432 450
 				// 'text' => $langs->trans("ConfirmClone"),
433 451
 				// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
@@ -457,8 +475,11 @@  discard block
 block discarded – undo
457 475
 	// Call Hook formConfirm
458 476
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
459 477
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
460
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
461
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
478
+	if (empty($reshook)) {
479
+		$formconfirm .= $hookmanager->resPrint;
480
+	} elseif ($reshook > 0) {
481
+		$formconfirm = $hookmanager->resPrint;
482
+	}
462 483
 
463 484
 	// Print form confirm
464 485
 	print $formconfirm;
@@ -594,7 +615,9 @@  discard block
 block discarded – undo
594 615
 		print '<div class="tabsAction">'."\n";
595 616
 		$parameters = array();
596 617
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
597
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
618
+		if ($reshook < 0) {
619
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
620
+		}
598 621
 
599 622
 		if (empty($reshook))
600 623
 		{
@@ -731,7 +754,9 @@  discard block
 block discarded – undo
731 754
 	}
732 755
 
733 756
 	//Select mail models is same action as presend
734
-	if (GETPOST('modelselected')) $action = 'presend';
757
+	if (GETPOST('modelselected')) {
758
+		$action = 'presend';
759
+	}
735 760
 
736 761
 	// Presend form
737 762
 	$modelmail = 'bom';
Please login to merge, or discard this patch.
htdocs/takepos/admin/bar.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php";
31 31
 
32 32
 // Security check
33
-if (!$user->admin) accessforbidden();
33
+if (!$user->admin) {
34
+	accessforbidden();
35
+}
34 36
 
35 37
 $langs->loadLangs(array("admin", "cashdesk", "printing"));
36 38
 
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 	dol_syslog("admin/bar");
49 51
 
50 52
 	$suplement_category = GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha');
51
-	if ($suplement_category < 0) $suplement_category = 0;
53
+	if ($suplement_category < 0) {
54
+		$suplement_category = 0;
55
+	}
52 56
 
53 57
 	$res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", $suplement_category, 'chaine', 0, '', $conf->entity);
54 58
 	if ($res <= 0) {
Please login to merge, or discard this patch.