Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/core/modules/printing/printgcp.modules.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,9 @@
 block discarded – undo
216 216
 			if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id'])
217 217
 			{
218 218
 				$html .= img_picto($langs->trans("Default"), 'on');
219
-			} else $html .= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&amp;token='.newToken().'&amp;mode=test&amp;varname=PRINTING_GCP_DEFAULT&amp;driver=printgcp&amp;value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
219
+			} else {
220
+				$html .= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&amp;token='.newToken().'&amp;mode=test&amp;varname=PRINTING_GCP_DEFAULT&amp;driver=printgcp&amp;value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
221
+			}
220 222
 			$html .= '</td>';
221 223
 			$html .= '</tr>'."\n";
222 224
 		}
Please login to merge, or discard this patch.
htdocs/core/modules/modCommande.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -247,7 +247,9 @@  discard block
 block discarded – undo
247 247
 		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
248 248
 		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
249 249
 		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'societe as s';
250
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
250
+		if (empty($user->rights->societe->client->voir)) {
251
+			$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
252
+		}
251 253
 		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object';
252 254
 		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
253 255
 		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
@@ -262,7 +264,9 @@  discard block
 block discarded – undo
262 264
 		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
263 265
 		$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande';
264 266
 		$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('commande').')';
265
-		if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
267
+		if (empty($user->rights->societe->client->voir)) {
268
+			$this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
269
+		}
266 270
 		// Imports
267 271
 		//--------
268 272
 		$r = 0;
Please login to merge, or discard this patch.
htdocs/core/modules/modMrp.class.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -317,7 +317,10 @@
 block discarded – undo
317 317
 		global $conf, $langs;
318 318
 
319 319
 		$result = $this->_load_tables('/mrp/sql/');
320
-		if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
320
+		if ($result < 0) {
321
+			return -1;
322
+		}
323
+		// Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
321 324
 
322 325
 		// Create extrafields during init
323 326
 		//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
Please login to merge, or discard this patch.
htdocs/core/class/commondocgenerator.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1288,7 +1288,7 @@
 block discarded – undo
1288 1288
 		if (!empty($fields))
1289 1289
 		{
1290 1290
 			// Sort extrafields by rank
1291
-			uasort($fields, function ($a, $b) {
1291
+			uasort($fields, function($a, $b) {
1292 1292
 				return  ($a->rank > $b->rank) ? 1 : -1;
1293 1293
 			});
1294 1294
 
Please login to merge, or discard this patch.
Braces   +48 added lines, -17 removed lines patch added patch discarded remove patch
@@ -325,8 +325,11 @@  discard block
 block discarded – undo
325 325
 
326 326
 		foreach ($conf->global as $key => $val)
327 327
 		{
328
-			if (isASecretKey($key)) $newval = '*****forbidden*****';
329
-			else $newval = $val;
328
+			if (isASecretKey($key)) {
329
+				$newval = '*****forbidden*****';
330
+			} else {
331
+				$newval = $val;
332
+			}
330 333
 			$array_other['__['.$key.']__'] = $newval;
331 334
 		}
332 335
 
@@ -473,12 +476,16 @@  discard block
 block discarded – undo
473 476
 			foreach ($object->lines as $line)
474 477
 			{
475 478
 				// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward compatibility
476
-				if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx] = 0;
479
+				if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) {
480
+					$resarray[$array_key.'_total_vat_'.$line->tva_tx] = 0;
481
+				}
477 482
 				$resarray[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
478 483
 				$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx] = price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
479 484
 				// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
480 485
 				$vatformated = vatrate($line->tva_tx);
481
-				if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated] = 0;
486
+				if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) {
487
+					$resarray[$array_key.'_total_vat_'.$vatformated] = 0;
488
+				}
482 489
 				$resarray[$array_key.'_total_vat_'.$vatformated] += $line->total_tva;
483 490
 				$resarray[$array_key.'_total_vat_locale_'.$vatformated] = price($resarray[$array_key.'_total_vat_'.$vatformated]);
484 491
 
@@ -626,8 +633,9 @@  discard block
 block discarded – undo
626 633
 		{
627 634
 			$tmpproduct = new Product($this->db);
628 635
 			$result = $tmpproduct->fetch($line->fk_product);
629
-			foreach ($tmpproduct->array_options as $key=>$label)
630
-				$resarray["line_product_".$key] = $label;
636
+			foreach ($tmpproduct->array_options as $key=>$label) {
637
+							$resarray["line_product_".$key] = $label;
638
+			}
631 639
 		}
632 640
 
633 641
 		return $resarray;
@@ -677,7 +685,9 @@  discard block
 block discarded – undo
677 685
 		// Add vat by rates
678 686
 		foreach ($object->lines as $line)
679 687
 		{
680
-			if (empty($array_shipment[$array_key.'_total_vat_'.$line->tva_tx])) $array_shipment[$array_key.'_total_vat_'.$line->tva_tx] = 0;
688
+			if (empty($array_shipment[$array_key.'_total_vat_'.$line->tva_tx])) {
689
+				$array_shipment[$array_key.'_total_vat_'.$line->tva_tx] = 0;
690
+			}
681 691
 			$array_shipment[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
682 692
 		}
683 693
 
@@ -877,9 +887,13 @@  discard block
 block discarded – undo
877 887
 	 */
878 888
 	public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
879 889
 	{
880
-		if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y);
890
+		if (empty($hidetop) || $hidetop == -1) {
891
+			$pdf->line($x, $y, $x + $l, $y);
892
+		}
881 893
 		$pdf->line($x + $l, $y, $x + $l, $y + $h);
882
-		if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h);
894
+		if (empty($hidebottom)) {
895
+			$pdf->line($x + $l, $y + $h, $x, $y + $h);
896
+		}
883 897
 		$pdf->line($x, $y + $h, $x, $y);
884 898
 	}
885 899
 
@@ -932,7 +946,10 @@  discard block
 block discarded – undo
932 946
 		$countFlexCol = 0;
933 947
 		foreach ($this->cols as $colKey =>& $colDef)
934 948
 		{
935
-			if (!$this->getColumnStatus($colKey)) continue; // continue if disabled
949
+			if (!$this->getColumnStatus($colKey)) {
950
+				continue;
951
+			}
952
+			// continue if disabled
936 953
 
937 954
 			if (!empty($colDef['scale'])) {
938 955
 				// In case of column width is defined by percentage
@@ -1011,7 +1028,9 @@  discard block
 block discarded – undo
1011 1028
 	 */
1012 1029
 	public function getColumnRank($colKey)
1013 1030
 	{
1014
-		if (!isset($this->cols[$colKey]['rank'])) return -1;
1031
+		if (!isset($this->cols[$colKey]['rank'])) {
1032
+			return -1;
1033
+		}
1015 1034
 		return  $this->cols[$colKey]['rank'];
1016 1035
 	}
1017 1036
 
@@ -1078,10 +1097,14 @@  discard block
 block discarded – undo
1078 1097
 			'pdf' => &$pdf,
1079 1098
 		);
1080 1099
 		$reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook
1081
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1100
+		if ($reshook < 0) {
1101
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1102
+		}
1082 1103
 		if (!$reshook)
1083 1104
 		{
1084
-			if (empty($columnText)) return;
1105
+			if (empty($columnText)) {
1106
+				return;
1107
+			}
1085 1108
 			$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
1086 1109
 			$colDef = $this->cols[$colKey];
1087 1110
 			// save curent cell padding
@@ -1183,7 +1206,9 @@  discard block
 block discarded – undo
1183 1206
 			'extrafieldOutputContent' =>& $extrafieldOutputContent
1184 1207
 		);
1185 1208
 		$reshook = $hookmanager->executeHooks('getPDFExtrafieldContent', $parameters, $this); // Note that $action and $object may have been modified by hook
1186
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1209
+		if ($reshook < 0) {
1210
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1211
+		}
1187 1212
 		if ($reshook)
1188 1213
 		{
1189 1214
 			$extrafieldOutputContent = $hookmanager->resPrint;
@@ -1380,7 +1405,9 @@  discard block
 block discarded – undo
1380 1405
 	{
1381 1406
 		if (!empty($this->cols[$colKey]['status'])) {
1382 1407
 			return true;
1383
-		} else return  false;
1408
+		} else {
1409
+			return  false;
1410
+		}
1384 1411
 	}
1385 1412
 
1386 1413
 	/**
@@ -1411,7 +1438,9 @@  discard block
 block discarded – undo
1411 1438
 			if ($reshook < 0) {
1412 1439
 				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1413 1440
 			} elseif (empty($reshook)) {
1414
-				if (!$this->getColumnStatus($colKey)) continue;
1441
+				if (!$this->getColumnStatus($colKey)) {
1442
+					continue;
1443
+				}
1415 1444
 
1416 1445
 				// get title label
1417 1446
 				$colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']);
@@ -1508,7 +1537,9 @@  discard block
 block discarded – undo
1508 1537
 				if (!$enabled) { continue; } // don't wast resourses if we don't need them...
1509 1538
 
1510 1539
 				// Load language if required
1511
-				if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
1540
+				if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) {
1541
+					$outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
1542
+				}
1512 1543
 
1513 1544
 				// TODO : add more extrafield customisation capacities for PDF like width, rank...
1514 1545
 
Please login to merge, or discard this patch.
htdocs/core/class/menubase.class.php 1 patch
Braces   +61 added lines, -21 removed lines patch added patch discarded remove patch
@@ -173,7 +173,9 @@  discard block
 block discarded – undo
173 173
 		global $conf, $langs;
174 174
 
175 175
 		// Clean parameters
176
-		if (!isset($this->enabled)) $this->enabled = '1';
176
+		if (!isset($this->enabled)) {
177
+			$this->enabled = '1';
178
+		}
177 179
 		$this->menu_handler = trim($this->menu_handler);
178 180
 		$this->module = trim($this->module);
179 181
 		$this->type = trim($this->type);
@@ -190,11 +192,17 @@  discard block
 block discarded – undo
190 192
 		$this->perms = trim($this->perms);
191 193
 		$this->enabled = trim($this->enabled);
192 194
 		$this->user = (int) $this->user;
193
-		if (empty($this->position)) $this->position = 0;
194
-		if (!$this->level) $this->level = 0;
195
+		if (empty($this->position)) {
196
+			$this->position = 0;
197
+		}
198
+		if (!$this->level) {
199
+			$this->level = 0;
200
+		}
195 201
 
196 202
 		// Check parameters
197
-		if (empty($this->menu_handler)) return -1;
203
+		if (empty($this->menu_handler)) {
204
+			return -1;
205
+		}
198 206
 
199 207
 		// For PGSQL, we must first found the max rowid and use it as rowid in insert because postgresql
200 208
 		// may use an already used value because its internal cursor does not increase when we do
@@ -208,13 +216,19 @@  discard block
 block discarded – undo
208 216
 				$maxrowid = $obj->maxrowid;
209 217
 
210 218
 				// Max rowid can be empty if there is no record yet
211
-				if (empty($maxrowid)) $maxrowid = 1;
219
+				if (empty($maxrowid)) {
220
+					$maxrowid = 1;
221
+				}
212 222
 
213 223
 				$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
214 224
 				//print $sql; exit;
215 225
 				$resqlrowidset = $this->db->query($sql);
216
-				if (!$resqlrowidset) dol_print_error($this->db);
217
-			} else dol_print_error($this->db);
226
+				if (!$resqlrowidset) {
227
+					dol_print_error($this->db);
228
+				}
229
+			} else {
230
+				dol_print_error($this->db);
231
+			}
218 232
 		}
219 233
 
220 234
 		// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
@@ -231,10 +245,12 @@  discard block
 block discarded – undo
231 245
 		{
232 246
 			$row = $this->db->fetch_row($result);
233 247
 
234
-			if ($row[0] == 0)   // If not found
248
+			if ($row[0] == 0) {
249
+				// If not found
235 250
 			{
236 251
 				// Insert request
237 252
 				$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
253
+			}
238 254
 				$sql .= "menu_handler,";
239 255
 				$sql .= "entity,";
240 256
 				$sql .= "module,";
@@ -507,7 +523,9 @@  discard block
 block discarded – undo
507 523
 		$newTabMenu = array();
508 524
 		foreach ($tabMenu as $val)
509 525
 		{
510
-			if ($val['type'] == 'top') $newTabMenu[] = $val;
526
+			if ($val['type'] == 'top') {
527
+				$newTabMenu[] = $val;
528
+			}
511 529
 		}
512 530
 
513 531
 		return $newTabMenu;
@@ -555,7 +573,8 @@  discard block
 block discarded – undo
555 573
 		foreach ($tabMenu as $key => $val)
556 574
 		{
557 575
 			//var_dump($tabMenu);
558
-			if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu)    // We found a menu entry not linked to parent with good mainmenu
576
+			if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) {
577
+				// We found a menu entry not linked to parent with good mainmenu
559 578
 			{
560 579
 				//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
561 580
 				//var_dump($this->newmenu->liste);exit;
@@ -563,6 +582,7 @@  discard block
 block discarded – undo
563 582
 				if (empty($val['fk_leftmenu']))
564 583
 				{
565 584
 					$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
585
+			}
566 586
 					//var_dump($this->newmenu->liste);
567 587
 				} else {
568 588
 					// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
@@ -570,9 +590,11 @@  discard block
 block discarded – undo
570 590
 					foreach ($this->newmenu->liste as $keyparent => $valparent)
571 591
 					{
572 592
 						//var_dump($valparent);
573
-						if ($searchlastsub)    // If we started to search for last submenu
593
+						if ($searchlastsub) {
594
+							// If we started to search for last submenu
574 595
 						{
575 596
 							if ($valparent['level'] >= $searchlastsub) $lastid = $keyparent;
597
+						}
576 598
 							if ($valparent['level'] < $searchlastsub)
577 599
 							{
578 600
 								$nextid = $keyparent;
@@ -589,8 +611,9 @@  discard block
 block discarded – undo
589 611
 						}
590 612
 					}
591 613
 					//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
592
-					if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
593
-					else {
614
+					if ($found) {
615
+						$this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
616
+					} else {
594 617
 						dol_syslog("Error. Modules ".$val['module']." has defined a menu entry with a parent='fk_mainmenu=".$val['fk_leftmenu'].",fk_leftmenu=".$val['fk_leftmenu']."' and position=".$val['position'].'. The parent was not found. May be you forget it into your definition of menu, or may be the parent has a "position" that is after the child (fix field "position" of parent or child in this case).', LOG_WARNING);
595 618
 						//print "Parent menu not found !!<br>";
596 619
 					}
@@ -624,8 +647,12 @@  discard block
 block discarded – undo
624 647
 		$sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
625 648
 		$sql .= " WHERE m.entity IN (0,".$conf->entity.")";
626 649
 		$sql .= " AND m.menu_handler IN ('".$this->db->escape($menu_handler)."','all')";
627
-		if ($type_user == 0) $sql .= " AND m.usertype IN (0,2)";
628
-		if ($type_user == 1) $sql .= " AND m.usertype IN (1,2)";
650
+		if ($type_user == 0) {
651
+			$sql .= " AND m.usertype IN (0,2)";
652
+		}
653
+		if ($type_user == 1) {
654
+			$sql .= " AND m.usertype IN (1,2)";
655
+		}
629 656
 		$sql .= " ORDER BY m.position, m.rowid";
630 657
 		//print $sql;
631 658
 
@@ -647,7 +674,10 @@  discard block
 block discarded – undo
647 674
 				if (isset($menu['perms']))
648 675
 				{
649 676
 					$tmpcond = $menu['perms'];
650
-					if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
677
+					if ($leftmenu == 'all') {
678
+						$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond);
679
+					}
680
+					// Force part of condition to true
651 681
 					$perms = verifCond($tmpcond);
652 682
 					//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
653 683
 				}
@@ -657,7 +687,10 @@  discard block
 block discarded – undo
657 687
 				if (isset($menu['enabled']))
658 688
 				{
659 689
 					$tmpcond = $menu['enabled'];
660
-					if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
690
+					if ($leftmenu == 'all') {
691
+						$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond);
692
+					}
693
+					// Force part of condition to true
661 694
 					$enabled = verifCond($tmpcond);
662 695
 				}
663 696
 
@@ -666,20 +699,24 @@  discard block
 block discarded – undo
666 699
 				{
667 700
 					$title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
668 701
 					//var_dump($title.'-'.$menu['titre']);
669
-					if ($title == $menu['titre'])   // Translation not found
702
+					if ($title == $menu['titre']) {
703
+						// Translation not found
670 704
 					{
671 705
 						if (!empty($menu['langs']))    // If there is a dedicated translation file
672 706
 						{
673 707
 							//print 'Load file '.$menu['langs'].'<br>';
674 708
 							$langs->load($menu['langs']);
709
+					}
675 710
 						}
676 711
 
677 712
 						$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
678 713
 						$menu['titre'] = make_substitutions($menu['titre'], $substitarray);
679 714
 
680
-						if (preg_match("/\//", $menu['titre'])) // To manage translation when title is string1/string2
715
+						if (preg_match("/\//", $menu['titre'])) {
716
+							// To manage translation when title is string1/string2
681 717
 						{
682 718
 							$tab_titre = explode("/", $menu['titre']);
719
+						}
683 720
 							$title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
684 721
 						} elseif (preg_match('/\|\|/', $menu['titre']))
685 722
 						{
@@ -702,8 +739,11 @@  discard block
 block discarded – undo
702 739
 					$tabMenu[$b]['url']         = $menu['url'];
703 740
 					if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url']))
704 741
 					{
705
-						if (preg_match('/\?/', $tabMenu[$b]['url'])) $tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
706
-						else $tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
742
+						if (preg_match('/\?/', $tabMenu[$b]['url'])) {
743
+							$tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
744
+						} else {
745
+							$tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
746
+						}
707 747
 					}
708 748
 					$tabMenu[$b]['titre']       = $title;
709 749
 					$tabMenu[$b]['target']      = $menu['target'];
Please login to merge, or discard this patch.
htdocs/core/boxes/box_activity.php 1 patch
Braces   +33 added lines, -12 removed lines patch added patch discarded remove patch
@@ -88,7 +88,9 @@  discard block
 block discarded – undo
88 88
 		$now = dol_now();
89 89
 		$nbofperiod = 3;
90 90
 
91
-		if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
91
+		if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) {
92
+			$nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
93
+		}
92 94
 		$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
93 95
 		$this->info_box_head = array(
94 96
 			'text' => $textHead,
@@ -113,12 +115,18 @@  discard block
 block discarded – undo
113 115
 			{
114 116
 				$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
115 117
 				$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
116
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
118
+				if (!$user->rights->societe->client->voir && !$user->socid) {
119
+					$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
120
+				}
117 121
 				$sql .= ")";
118 122
 				$sql .= " WHERE p.entity IN (".getEntity('propal').")";
119 123
 				$sql .= " AND p.fk_soc = s.rowid";
120
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
121
-				if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
124
+				if (!$user->rights->societe->client->voir && !$user->socid) {
125
+					$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
126
+				}
127
+				if ($user->socid) {
128
+					$sql .= " AND s.rowid = ".$user->socid;
129
+				}
122 130
 				$sql .= " AND p.datep >= '".$this->db->idate($tmpdate)."'";
123 131
 				$sql .= " AND p.date_cloture IS NULL"; // just unclosed
124 132
 				$sql .= " GROUP BY p.fk_statut";
@@ -200,12 +208,18 @@  discard block
 block discarded – undo
200 208
 			if ($refresh) {
201 209
 				$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
202 210
 				$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
203
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
211
+				if (!$user->rights->societe->client->voir && !$user->socid) {
212
+					$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
213
+				}
204 214
 				$sql .= ")";
205 215
 				$sql .= " WHERE c.entity IN (".getEntity('commande').")";
206 216
 				$sql .= " AND c.fk_soc = s.rowid";
207
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
208
-				if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
217
+				if (!$user->rights->societe->client->voir && !$user->socid) {
218
+					$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
219
+				}
220
+				if ($user->socid) {
221
+					$sql .= " AND s.rowid = ".$user->socid;
222
+				}
209 223
 				$sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'";
210 224
 				$sql .= " GROUP BY c.fk_statut";
211 225
 				$sql .= " ORDER BY c.fk_statut DESC";
@@ -284,11 +298,17 @@  discard block
 block discarded – undo
284 298
 			{
285 299
 				$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
286 300
 				$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
287
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
301
+				if (!$user->rights->societe->client->voir && !$user->socid) {
302
+					$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
303
+				}
288 304
 				$sql .= ")";
289 305
 				$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
290
-				if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
291
-				if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
306
+				if (!$user->rights->societe->client->voir && !$user->socid) {
307
+					$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
308
+				}
309
+				if ($user->socid) {
310
+					$sql .= " AND s.rowid = ".$user->socid;
311
+				}
292 312
 				$sql .= " AND f.fk_soc = s.rowid";
293 313
 				$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1";
294 314
 				$sql .= " GROUP BY f.fk_statut";
@@ -351,11 +371,12 @@  discard block
 block discarded – undo
351 371
 					$line++;
352 372
 					$j++;
353 373
 				}
354
-				if (count($data) == 0)
355
-					$this->info_box_contents[$line][0] = array(
374
+				if (count($data) == 0) {
375
+									$this->info_box_contents[$line][0] = array(
356 376
 						'td' => 'class="center"',
357 377
 						'text'=>$langs->trans("NoRecordedInvoices"),
358 378
 					);
379
+				}
359 380
 			}
360 381
 
361 382
 			// part 2
Please login to merge, or discard this patch.
htdocs/admin/ecm_directories_extrafields.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
34 34
 
35 35
 
36
-if (!$user->admin)
36
+if (!$user->admin) {
37 37
 	accessforbidden();
38
+}
38 39
 
39 40
 // Load translation files required by the page
40 41
 $langs->loadLangs(array('admin', 'other', 'ecm'));
Please login to merge, or discard this patch.
htdocs/admin/defaultvalues.php 1 patch
Braces   +70 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 // Load translation files required by the page
35 35
 $langs->loadLangs(array('companies', 'products', 'admin', 'sms', 'other', 'errors'));
36 36
 
37
-if (!$user->admin) accessforbidden();
37
+if (!$user->admin) {
38
+	accessforbidden();
39
+}
38 40
 
39 41
 $id = GETPOST('rowid', 'int');
40 42
 $action = GETPOST('action', 'aZ09');
@@ -50,8 +52,12 @@  discard block
 block discarded – undo
50 52
 $offset = $limit * $page;
51 53
 $pageprev = $page - 1;
52 54
 $pagenext = $page + 1;
53
-if (!$sortfield) $sortfield = 'page,param';
54
-if (!$sortorder) $sortorder = 'ASC';
55
+if (!$sortfield) {
56
+	$sortfield = 'page,param';
57
+}
58
+if (!$sortorder) {
59
+	$sortorder = 'ASC';
60
+}
55 61
 
56 62
 $defaulturl = GETPOST('defaulturl', 'alphanohtml');
57 63
 $defaultkey = GETPOST('defaultkey', 'alphanohtml');
@@ -76,14 +82,18 @@  discard block
 block discarded – undo
76 82
 
77 83
 $parameters = array('socid'=>$socid);
78 84
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
79
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
85
+if ($reshook < 0) {
86
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
87
+}
80 88
 
81 89
 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
82 90
 
83 91
 // Purge search criteria
84
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
92
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
93
+	// All tests are required to be compatible with all browsers
85 94
 {
86 95
 	$defaulturl = '';
96
+}
87 97
 	$defaultkey = '';
88 98
 	$defaultvalue = '';
89 99
 	$toselect = '';
@@ -92,9 +102,12 @@  discard block
 block discarded – undo
92 102
 
93 103
 if ($action == 'setMAIN_ENABLE_DEFAULT_VALUES')
94 104
 {
95
-	if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
96
-	else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
97
-}
105
+	if (GETPOST('value')) {
106
+		dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
107
+	} else {
108
+		dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
109
+	}
110
+	}
98 111
 
99 112
 if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('actionmodify'))
100 113
 {
@@ -205,16 +218,30 @@  discard block
 block discarded – undo
205 218
 print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n";
206 219
 print "<br>\n";
207 220
 
208
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
209
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
210
-if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
211
-if ($defaulturl)      $param .= '&defaulturl='.urlencode($defaulturl);
212
-if ($defaultkey)      $param .= '&defaultkey='.urlencode($defaultkey);
213
-if ($defaultvalue)    $param .= '&defaultvalue='.urlencode($defaultvalue);
221
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
222
+	$param .= '&contextpage='.urlencode($contextpage);
223
+}
224
+if ($limit > 0 && $limit != $conf->liste_limit) {
225
+	$param .= '&limit='.urlencode($limit);
226
+}
227
+if ($optioncss != '') {
228
+	$param .= '&optioncss='.urlencode($optioncss);
229
+}
230
+if ($defaulturl) {
231
+	$param .= '&defaulturl='.urlencode($defaulturl);
232
+}
233
+if ($defaultkey) {
234
+	$param .= '&defaultkey='.urlencode($defaultkey);
235
+}
236
+if ($defaultvalue) {
237
+	$param .= '&defaultvalue='.urlencode($defaultvalue);
238
+}
214 239
 
215 240
 
216 241
 print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
217
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
242
+if ($optioncss != '') {
243
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
244
+}
218 245
 print '<input type="hidden" name="token" value="'.newToken().'">';
219 246
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
220 247
 print '<input type="hidden" name="action" value="list">';
@@ -244,8 +271,11 @@  discard block
 block discarded – undo
244 271
 print '<tr class="liste_titre">';
245 272
 // Page
246 273
 $texthelp = $langs->trans("PageUrlForDefaultValues");
247
-if ($mode == 'createform') $texthelp .= $langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
248
-else $texthelp .= $langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
274
+if ($mode == 'createform') {
275
+	$texthelp .= $langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
276
+} else {
277
+	$texthelp .= $langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
278
+}
249 279
 $texthelp .= '<br><br>'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
250 280
 $texturl = $form->textwithpicto($langs->trans("RelativeURL"), $texthelp);
251 281
 print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
@@ -279,8 +309,11 @@  discard block
 block discarded – undo
279 309
 	print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
280 310
 }
281 311
 // Entity
282
-if (!empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder);
283
-else print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
312
+if (!empty($conf->multicompany->enabled) && !$user->entity) {
313
+	print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder);
314
+} else {
315
+	print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
316
+}
284 317
 // Actions
285 318
 print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
286 319
 print "</tr>\n";
@@ -318,7 +351,9 @@  discard block
 block discarded – undo
318 351
 }
319 352
 print '<td class="center">';
320 353
 $disabled = '';
321
-if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $disabled = ' disabled="disabled"';
354
+if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
355
+	$disabled = ' disabled="disabled"';
356
+}
322 357
 print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
323 358
 print "</td>\n";
324 359
 print '</tr>';
@@ -348,14 +383,20 @@  discard block
 block discarded – undo
348 383
 
349 384
 		// Page
350 385
 		print '<td>';
351
-		if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) print $obj->page;
352
-		else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
386
+		if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) {
387
+			print $obj->page;
388
+		} else {
389
+			print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
390
+		}
353 391
 		print '</td>'."\n";
354 392
 
355 393
 		// Field
356 394
 		print '<td>';
357
-		if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->param;
358
-		else print '<input type="text" name="key" value="'.dol_escape_htmltag($obj->param).'">';
395
+		if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) {
396
+			print $obj->param;
397
+		} else {
398
+			print '<input type="text" name="key" value="'.dol_escape_htmltag($obj->param).'">';
399
+		}
359 400
 		print '</td>'."\n";
360 401
 
361 402
 		// Value
@@ -367,8 +408,11 @@  discard block
 block discarded – undo
367 408
     		print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
368 409
     		print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
369 410
     		*/
370
-			if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
371
-			else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
411
+			if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) {
412
+				print dol_escape_htmltag($obj->value);
413
+			} else {
414
+				print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
415
+			}
372 416
 			print '</td>';
373 417
 		}
374 418
 
Please login to merge, or discard this patch.
htdocs/admin/oauthlogintokens.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 // Load translation files required by the page
33 33
 $langs->loadLangs(array('admin', 'printing', 'oauth'));
34 34
 
35
-if (!$user->admin) accessforbidden();
35
+if (!$user->admin) {
36
+	accessforbidden();
37
+}
36 38
 
37 39
 $action = GETPOST('action', 'aZ09');
38 40
 $mode = GETPOST('mode', 'alpha');
@@ -40,9 +42,13 @@  discard block
 block discarded – undo
40 42
 $varname = GETPOST('varname', 'alpha');
41 43
 $driver = GETPOST('driver', 'alpha');
42 44
 
43
-if (!empty($driver)) $langs->load($driver);
45
+if (!empty($driver)) {
46
+	$langs->load($driver);
47
+}
44 48
 
45
-if (!$mode) $mode = 'setup';
49
+if (!$mode) {
50
+	$mode = 'setup';
51
+}
46 52
 
47 53
 
48 54
 /*
@@ -72,7 +78,9 @@  discard block
 block discarded – undo
72 78
 		$constnote = dol_escape_htmltag($setupconst['note']);
73 79
 
74 80
 		$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
75
-		if (!$result > 0) $error++;
81
+		if (!$result > 0) {
82
+			$error++;
83
+		}
76 84
 	}
77 85
 
78 86
 	if (!$error)
@@ -91,7 +99,9 @@  discard block
 block discarded – undo
91 99
 	$db->begin();
92 100
 
93 101
 	$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
94
-	if (!$result > 0) $error++;
102
+	if (!$result > 0) {
103
+		$error++;
104
+	}
95 105
 
96 106
 	if (!$error)
97 107
 	{
@@ -136,8 +146,13 @@  discard block
 block discarded – undo
136 146
 	foreach ($list as $key)
137 147
 	{
138 148
 		$supported = 0;
139
-		if (in_array($key[0], array_keys($supportedoauth2array))) $supported = 1;
140
-		if (!$supported) continue; // show only supported
149
+		if (in_array($key[0], array_keys($supportedoauth2array))) {
150
+			$supported = 1;
151
+		}
152
+		if (!$supported) {
153
+			continue;
154
+		}
155
+		// show only supported
141 156
 
142 157
 
143 158
 		$OAUTH_SERVICENAME = 'Unknown';
@@ -255,8 +270,11 @@  discard block
 block discarded – undo
255 270
 		print $langs->trans("IsTokenGenerated");
256 271
 		print '</td>';
257 272
 		print '<td>';
258
-		if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
259
-		else print $langs->trans("NoAccessToken");
273
+		if (is_object($tokenobj)) {
274
+			print $langs->trans("HasAccessToken");
275
+		} else {
276
+			print $langs->trans("NoAccessToken");
277
+		}
260 278
 		print '</td>';
261 279
 		print '<td>';
262 280
 		// Links to delete/checks token
Please login to merge, or discard this patch.