Completed
Branch develop (c23a95)
by
unknown
18:46
created
htdocs/core/class/html.form.class.php 1 patch
Braces   +99 added lines, -37 removed lines patch added patch discarded remove patch
@@ -2555,22 +2555,34 @@  discard block
 block discarded – undo
2555 2555
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2556 2556
 		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2557 2557
 		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2558
-		if (!empty($status)) $sql .= ' AND status = ' . (int) $status;
2559
-		if (!empty($type)) $sql .= ' AND bomtype = ' . (int) $type;
2560
-		if (!empty($TProducts)) $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2561
-		if (!empty($limit)) $sql .= ' LIMIT ' . (int) $limit;
2558
+		if (!empty($status)) {
2559
+			$sql .= ' AND status = ' . (int) $status;
2560
+		}
2561
+		if (!empty($type)) {
2562
+			$sql .= ' AND bomtype = ' . (int) $type;
2563
+		}
2564
+		if (!empty($TProducts)) {
2565
+			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2566
+		}
2567
+		if (!empty($limit)) {
2568
+			$sql .= ' LIMIT ' . (int) $limit;
2569
+		}
2562 2570
 		$resql = $db->query($sql);
2563 2571
 		if ($resql) {
2564 2572
 			if ($showempty) {
2565 2573
 				$out .= '<option value="-1"';
2566
-				if (empty($selected)) $out .= ' selected';
2574
+				if (empty($selected)) {
2575
+					$out .= ' selected';
2576
+				}
2567 2577
 				$out .= '>&nbsp;</option>';
2568 2578
 			}
2569 2579
 			while ($obj = $db->fetch_object($resql)) {
2570 2580
 				$product = new Product($db);
2571 2581
 				$res = $product->fetch($obj->fk_product);
2572 2582
 				$out .= '<option value="' . $obj->rowid . '"';
2573
-				if ($obj->rowid == $selected) $out .= 'selected';
2583
+				if ($obj->rowid == $selected) {
2584
+					$out .= 'selected';
2585
+				}
2574 2586
 				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2575 2587
 			}
2576 2588
 		} else {
@@ -7273,7 +7285,9 @@  discard block
 block discarded – undo
7273 7285
 		$out = '';
7274 7286
 
7275 7287
 		// check parameters
7276
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7288
+		if (is_null($ajaxoptions)) {
7289
+			$ajaxoptions = array();
7290
+		}
7277 7291
 
7278 7292
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7279 7293
 			$placeholder = '';
@@ -7289,8 +7303,9 @@  discard block
 block discarded – undo
7289 7303
 			$urloption = '';
7290 7304
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7291 7305
 
7292
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7293
-			elseif ($hidelabel > 1) {
7306
+			if (empty($hidelabel)) {
7307
+				$out .= $langs->trans("RefOrLabel") . ' : ';
7308
+			} elseif ($hidelabel > 1) {
7294 7309
 				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7295 7310
 				if ($hidelabel == 2) {
7296 7311
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7350,14 +7365,20 @@  discard block
 block discarded – undo
7350 7365
 			// For natural search
7351 7366
 			$scrit = explode(' ', $filterkey);
7352 7367
 			$i = 0;
7353
-			if (count($scrit) > 1) $sql .= "(";
7368
+			if (count($scrit) > 1) {
7369
+				$sql .= "(";
7370
+			}
7354 7371
 			foreach ($scrit as $crit) {
7355
-				if ($i > 0) $sql .= " AND ";
7372
+				if ($i > 0) {
7373
+					$sql .= " AND ";
7374
+				}
7356 7375
 				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7357 7376
 				$sql .= ")";
7358 7377
 				$i++;
7359 7378
 			}
7360
-			if (count($scrit) > 1) $sql .= ")";
7379
+			if (count($scrit) > 1) {
7380
+				$sql .= ")";
7381
+			}
7361 7382
 			$sql .= ')';
7362 7383
 		}
7363 7384
 
@@ -7385,12 +7406,19 @@  discard block
 block discarded – undo
7385 7406
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7386 7407
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7387 7408
 			if (!empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7388
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7389
-				else $textifempty .= $langs->trans("All");
7409
+				if ($showempty && !is_numeric($showempty)) {
7410
+					$textifempty = $langs->trans($showempty);
7411
+				} else {
7412
+					$textifempty .= $langs->trans("All");
7413
+				}
7390 7414
 			} else {
7391
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7415
+				if ($showempty && !is_numeric($showempty)) {
7416
+					$textifempty = $langs->trans($showempty);
7417
+				}
7418
+			}
7419
+			if ($showempty) {
7420
+				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7392 7421
 			}
7393
-			if ($showempty) $out .= '<option value="0" selected>' . $textifempty . '</option>';
7394 7422
 
7395 7423
 			$i = 0;
7396 7424
 			while ($num && $i < $num) {
@@ -7449,7 +7477,9 @@  discard block
 block discarded – undo
7449 7477
 		$opt .= '>';
7450 7478
 		$opt .= $objp->ref;
7451 7479
 		$objRef = $objp->ref;
7452
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7480
+		if (!empty($filterkey) && $filterkey != '') {
7481
+			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7482
+		}
7453 7483
 
7454 7484
 		$opt .= "</option>\n";
7455 7485
 		$optJson = array('key' => $outkey, 'value' => $outref, 'type' => $outtype);
@@ -7481,7 +7511,9 @@  discard block
 block discarded – undo
7481 7511
 		$out = '';
7482 7512
 
7483 7513
 		// check parameters
7484
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7514
+		if (is_null($ajaxoptions)) {
7515
+			$ajaxoptions = array();
7516
+		}
7485 7517
 
7486 7518
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7487 7519
 			$placeholder = '';
@@ -7497,8 +7529,9 @@  discard block
 block discarded – undo
7497 7529
 			$urloption = '';
7498 7530
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7499 7531
 
7500
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7501
-			elseif ($hidelabel > 1) {
7532
+			if (empty($hidelabel)) {
7533
+				$out .= $langs->trans("RefOrLabel") . ' : ';
7534
+			} elseif ($hidelabel > 1) {
7502 7535
 				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7503 7536
 				if ($hidelabel == 2) {
7504 7537
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7557,14 +7590,20 @@  discard block
 block discarded – undo
7557 7590
 			// For natural search
7558 7591
 			$scrit = explode(' ', $filterkey);
7559 7592
 			$i = 0;
7560
-			if (count($scrit) > 1) $sql .= "(";
7593
+			if (count($scrit) > 1) {
7594
+				$sql .= "(";
7595
+			}
7561 7596
 			foreach ($scrit as $crit) {
7562
-				if ($i > 0) $sql .= " AND ";
7597
+				if ($i > 0) {
7598
+					$sql .= " AND ";
7599
+				}
7563 7600
 				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7564 7601
 				$sql .= "";
7565 7602
 				$i++;
7566 7603
 			}
7567
-			if (count($scrit) > 1) $sql .= ")";
7604
+			if (count($scrit) > 1) {
7605
+				$sql .= ")";
7606
+			}
7568 7607
 			$sql .= ')';
7569 7608
 		}
7570 7609
 
@@ -7592,12 +7631,19 @@  discard block
 block discarded – undo
7592 7631
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7593 7632
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7594 7633
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7595
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7596
-				else $textifempty .= $langs->trans("All");
7634
+				if ($showempty && !is_numeric($showempty)) {
7635
+					$textifempty = $langs->trans($showempty);
7636
+				} else {
7637
+					$textifempty .= $langs->trans("All");
7638
+				}
7597 7639
 			} else {
7598
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7640
+				if ($showempty && !is_numeric($showempty)) {
7641
+					$textifempty = $langs->trans($showempty);
7642
+				}
7643
+			}
7644
+			if ($showempty) {
7645
+				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7599 7646
 			}
7600
-			if ($showempty) $out .= '<option value="0" selected>' . $textifempty . '</option>';
7601 7647
 
7602 7648
 			$i = 0;
7603 7649
 			while ($num && $i < $num) {
@@ -7659,7 +7705,9 @@  discard block
 block discarded – undo
7659 7705
 		$opt .= '>';
7660 7706
 		$opt .= $objp->ref;
7661 7707
 		$objRef = $objp->ref;
7662
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7708
+		if (!empty($filterkey) && $filterkey != '') {
7709
+			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7710
+		}
7663 7711
 
7664 7712
 		$opt .= "</option>\n";
7665 7713
 		$optJson = array('key' => $outkey, 'value' => $outref, 'type' => $outtype);
@@ -7692,7 +7740,9 @@  discard block
 block discarded – undo
7692 7740
 		$out = '';
7693 7741
 
7694 7742
 		// check parameters
7695
-		if (is_null($ajaxoptions)) $ajaxoptions = array();
7743
+		if (is_null($ajaxoptions)) {
7744
+			$ajaxoptions = array();
7745
+		}
7696 7746
 
7697 7747
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
7698 7748
 			$placeholder = '';
@@ -7710,8 +7760,9 @@  discard block
 block discarded – undo
7710 7760
 
7711 7761
 			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7712 7762
 
7713
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7714
-			elseif ($hidelabel > 1) {
7763
+			if (empty($hidelabel)) {
7764
+				$out .= $langs->trans("RefOrLabel") . ' : ';
7765
+			} elseif ($hidelabel > 1) {
7715 7766
 				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7716 7767
 				if ($hidelabel == 2) {
7717 7768
 					$out .= img_picto($langs->trans("Search"), 'search');
@@ -7772,14 +7823,20 @@  discard block
 block discarded – undo
7772 7823
 			// For natural search
7773 7824
 			$scrit = explode(' ', $filterkey);
7774 7825
 			$i = 0;
7775
-			if (count($scrit) > 1) $sql .= "(";
7826
+			if (count($scrit) > 1) {
7827
+				$sql .= "(";
7828
+			}
7776 7829
 			foreach ($scrit as $crit) {
7777
-				if ($i > 0) $sql .= " AND ";
7830
+				if ($i > 0) {
7831
+					$sql .= " AND ";
7832
+				}
7778 7833
 				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7779 7834
 				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
7780 7835
 				$i++;
7781 7836
 			}
7782
-			if (count($scrit) > 1) $sql .= ")";
7837
+			if (count($scrit) > 1) {
7838
+				$sql .= ")";
7839
+			}
7783 7840
 			$sql .= ')';
7784 7841
 		}
7785 7842
 		if ($status != -1) {
@@ -7809,10 +7866,15 @@  discard block
 block discarded – undo
7809 7866
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
7810 7867
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
7811 7868
 			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
7812
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7813
-				else $textifempty .= $langs->trans("All");
7869
+				if ($showempty && !is_numeric($showempty)) {
7870
+					$textifempty = $langs->trans($showempty);
7871
+				} else {
7872
+					$textifempty .= $langs->trans("All");
7873
+				}
7814 7874
 			} else {
7815
-				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7875
+				if ($showempty && !is_numeric($showempty)) {
7876
+					$textifempty = $langs->trans($showempty);
7877
+				}
7816 7878
 			}
7817 7879
 			if ($showempty) {
7818 7880
 				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
Please login to merge, or discard this patch.
htdocs/mrp/class/mo.class.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -749,7 +749,9 @@  discard block
 block discarded – undo
749 749
 								$moline->position = $line->position;
750 750
 								$moline->qty_frozen = $line->qty_frozen;
751 751
 								$moline->disable_stock_change = $line->disable_stock_change;
752
-								if (!empty($line->fk_default_workstation)) $moline->fk_default_workstation = $line->fk_default_workstation;
752
+								if (!empty($line->fk_default_workstation)) {
753
+									$moline->fk_default_workstation = $line->fk_default_workstation;
754
+								}
753 755
 
754 756
 								$resultline = $moline->create($user, false); // Never use triggers here
755 757
 								if ($resultline <= 0) {
@@ -786,7 +788,9 @@  discard block
 block discarded – undo
786 788
 	{
787 789
 		$error = 0;
788 790
 
789
-		if ($this->status != self::STATUS_DRAFT) return 1;
791
+		if ($this->status != self::STATUS_DRAFT) {
792
+			return 1;
793
+		}
790 794
 
791 795
 		$this->db->begin();
792 796
 
@@ -799,14 +803,18 @@  discard block
 block discarded – undo
799 803
 				while ($obj = $this->db->fetch_object($resql)) {
800 804
 					$moLine = new MoLine($this->db);
801 805
 					$res = $moLine->fetch($obj->rowid);
802
-					if (!$res) $error++;
806
+					if (!$res) {
807
+						$error++;
808
+					}
803 809
 
804 810
 					if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
805 811
 						if (empty($moLine->qty_frozen)) {
806 812
 							$qty = $newQty * $moLine->qty / $oldQty;
807 813
 							$moLine->qty = price2num($qty * (!empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and efficiency
808 814
 							$res = $moLine->update($user);
809
-							if (!$res) $error++;
815
+							if (!$res) {
816
+								$error++;
817
+							}
810 818
 						}
811 819
 					}
812 820
 				}
@@ -1408,7 +1416,9 @@  discard block
 block discarded – undo
1408 1416
 		$objectline = new MoLine($this->db);
1409 1417
 
1410 1418
 		$TFilters = array('customsql'=>'fk_mo = '.((int) $this->id));
1411
-		if (!empty($rolefilter)) $TFilters['role'] = $rolefilter;
1419
+		if (!empty($rolefilter)) {
1420
+			$TFilters['role'] = $rolefilter;
1421
+		}
1412 1422
 		$result = $objectline->fetchAll('ASC', 'position', 0, 0, $TFilters);
1413 1423
 
1414 1424
 		if (is_numeric($result)) {
@@ -1644,8 +1654,11 @@  discard block
 block discarded – undo
1644 1654
 				while ($obj = $this->db->fetch_object($resql)) {
1645 1655
 					$MoChild = new Mo($this->db);
1646 1656
 					$res = $MoChild->fetch($obj->rowid);
1647
-					if ($res > 0) $TMoChilds[$MoChild->id] = $MoChild;
1648
-					else $error++;
1657
+					if ($res > 0) {
1658
+						$TMoChilds[$MoChild->id] = $MoChild;
1659
+					} else {
1660
+						$error++;
1661
+					}
1649 1662
 				}
1650 1663
 			}
1651 1664
 		} else {
@@ -1679,7 +1692,9 @@  discard block
 block discarded – undo
1679 1692
 			if ($this->db->num_rows($resql) > 0) {
1680 1693
 				$obj = $this->db->fetch_object($resql);
1681 1694
 				$res = $MoParent->fetch($obj->id_moparent);
1682
-				if ($res < 0) $error++;
1695
+				if ($res < 0) {
1696
+					$error++;
1697
+				}
1683 1698
 			} else {
1684 1699
 				return 0;
1685 1700
 			}
Please login to merge, or discard this patch.
htdocs/hrm/position.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -876,7 +876,9 @@
 block discarded – undo
876 876
 	}
877 877
 
878 878
 	// Security check (enable the most restrictive one)
879
-	if ($user->socid > 0) accessforbidden();
879
+	if ($user->socid > 0) {
880
+		accessforbidden();
881
+	}
880 882
 	//if ($user->socid > 0) accessforbidden();
881 883
 	//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
882 884
 	//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
Please login to merge, or discard this patch.
htdocs/hrm/skill_card.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,8 +89,12 @@  discard block
 block discarded – undo
89 89
 //if ($user->socid > 0) $socid = $user->socid;
90 90
 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
91 91
 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
92
-if (empty($conf->hrm->enabled)) accessforbidden();
93
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
92
+if (empty($conf->hrm->enabled)) {
93
+	accessforbidden();
94
+}
95
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
96
+	accessforbidden();
97
+}
94 98
 
95 99
 $MaxNumberSkill = isset($conf->global->HRM_MAXRANK) ? $conf->global->HRM_MAXRANK : Skill::DEFAULT_MAX_RANK_PER_SKILL;
96 100
 
@@ -816,7 +820,9 @@  discard block
 block discarded – undo
816 820
 		print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
817 821
 	}
818 822
 
819
-	if (!empty($resql)) $db->free($resql);
823
+	if (!empty($resql)) {
824
+		$db->free($resql);
825
+	}
820 826
 
821 827
 	$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
822 828
 	$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectline); // Note that $action and $objectline may have been modified by hook
Please login to merge, or discard this patch.