Passed
Branch develop (66e4de)
by Laurent
33:03
created
htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,11 +44,17 @@  discard block
 block discarded – undo
44 44
 	if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
45 45
 	{
46 46
 		$nbNote = 0;
47
-		if (!empty($object->note_private)) $nbNote++;
48
-		if (!empty($object->note_public)) $nbNote++;
47
+		if (!empty($object->note_private)) {
48
+			$nbNote++;
49
+		}
50
+		if (!empty($object->note_public)) {
51
+			$nbNote++;
52
+		}
49 53
 		$head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
50 54
 		$head[$h][1] = $langs->trans('Notes');
51
-		if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
55
+		if ($nbNote > 0) {
56
+			$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
57
+		}
52 58
 		$head[$h][2] = 'note';
53 59
 		$h++;
54 60
 	}
@@ -60,7 +66,9 @@  discard block
 block discarded – undo
60 66
 	$nbLinks = Link::count($db, $object->element, $object->id);
61 67
 	$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
62 68
 	$head[$h][1] = $langs->trans('Documents');
63
-	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
69
+	if (($nbFiles + $nbLinks) > 0) {
70
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
71
+	}
64 72
 	$head[$h][2] = 'document';
65 73
 	$h++;
66 74
 
Please login to merge, or discard this patch.
htdocs/loan/calcmens.php 1 patch
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,9 +24,16 @@
 block discarded – undo
24 24
  *  \brief File to calculate loan monthly payments
25 25
  */
26 26
 
27
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
28
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
29
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
+if (!defined('NOTOKENRENEWAL')) {
28
+	define('NOTOKENRENEWAL', '1');
29
+}
30
+// Disables token renewal
31
+if (!defined('NOREQUIREMENU')) {
32
+	define('NOREQUIREMENU', '1');
33
+}
34
+if (!defined('NOREQUIREAJAX')) {
35
+	define('NOREQUIREAJAX', '1');
36
+}
30 37
 
31 38
 require '../main.inc.php';
32 39
 require DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
Please login to merge, or discard this patch.
htdocs/accountancy/expensereport/card.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@  discard block
 block discarded – undo
42 42
 $id = GETPOST('id', 'int');
43 43
 
44 44
 // Security check
45
-if ($user->socid > 0)
45
+if ($user->socid > 0) {
46 46
 	accessforbidden();
47
+}
47 48
 
48 49
 
49 50
 /*
@@ -54,7 +55,9 @@  discard block
 block discarded – undo
54 55
 {
55 56
 	if (!$cancel)
56 57
 	{
57
-		if ($codeventil < 0) $codeventil = 0;
58
+		if ($codeventil < 0) {
59
+			$codeventil = 0;
60
+		}
58 61
 
59 62
 		$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
60 63
 		$sql .= " SET fk_code_ventilation = ".$codeventil;
Please login to merge, or discard this patch.
htdocs/mrp/mo_note.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Load object
52 52
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
53
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity]."/".$object->id;
53
+if ($id > 0 || !empty($ref)) {
54
+	$upload_dir = $conf->mrp->multidir_output[$object->entity]."/".$object->id;
55
+}
54 56
 
55 57
 // Security check - Protection if external user
56 58
 //if ($user->socid > 0) accessforbidden();
@@ -106,8 +108,9 @@  discard block
 block discarded – undo
106 108
 		$morehtmlref .= '<br>'.$langs->trans('Project').' ';
107 109
 		if ($permissiontoadd)
108 110
 		{
109
-			if ($action != 'classify')
110
-				$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
111
+			if ($action != 'classify') {
112
+							$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
113
+			}
111 114
 			if ($action == 'classify') {
112 115
 				//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 1);
113 116
 				$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/class/api_mymodule.class.php 1 patch
Braces   +34 added lines, -11 removed lines patch added patch discarded remove patch
@@ -118,23 +118,40 @@  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 ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
121
+		if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) {
122
+			$search_sale = DolibarrApiAccess::$user->id;
123
+		}
122 124
 
123 125
 		$sql = "SELECT t.rowid";
124
-		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $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 ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $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.$tmpobject->table_element." as t";
126 131
 
127
-		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $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 ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $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
 		$sql .= " WHERE 1 = 1";
129 137
 
130 138
 		// Example of use $mode
131 139
 		//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
132 140
 		//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
133 141
 
134
-		if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
135
-		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
136
-		if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid;
137
-		if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
142
+		if ($tmpobject->ismultientitymanaged) {
143
+			$sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
144
+		}
145
+		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
146
+			$sql .= " AND t.fk_soc = sc.fk_soc";
147
+		}
148
+		if ($restrictonsocid && $socid) {
149
+			$sql .= " AND t.fk_soc = ".$socid;
150
+		}
151
+		if ($restrictonsocid && $search_sale > 0) {
152
+			$sql .= " AND t.rowid = sc.fk_soc";
153
+		}
154
+		// Join for the needed table to filter by sale
138 155
 		// Insert sale filter
139 156
 		if ($restrictonsocid && $search_sale > 0) {
140 157
 			$sql .= " AND sc.fk_user = ".$search_sale;
@@ -235,7 +252,9 @@  discard block
 block discarded – undo
235 252
 		}
236 253
 
237 254
 		foreach ($request_data as $field => $value) {
238
-			if ($field == 'id') continue;
255
+			if ($field == 'id') {
256
+				continue;
257
+			}
239 258
 			$this->myobject->$field = $value;
240 259
 		}
241 260
 
@@ -361,9 +380,13 @@  discard block
 block discarded – undo
361 380
 	{
362 381
 		$myobject = array();
363 382
 		foreach ($this->myobject->fields as $field => $propfield) {
364
-			if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field
365
-			if (!isset($data[$field]))
366
-				throw new RestException(400, "$field field missing");
383
+			if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) {
384
+				continue;
385
+			}
386
+			// Not a mandatory field
387
+			if (!isset($data[$field])) {
388
+							throw new RestException(400, "$field field missing");
389
+			}
367 390
 			$myobject[$field] = $data[$field];
368 391
 		}
369 392
 		return $myobject;
Please login to merge, or discard this patch.
htdocs/takepos/admin/printqr.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
24 24
 require '../../main.inc.php';
25 25
 
26 26
 // Security check
27
-if (!$user->admin) accessforbidden();
27
+if (!$user->admin) {
28
+	accessforbidden();
29
+}
28 30
 
29 31
 $langs->load("cashdesk");
30 32
 
@@ -37,8 +39,7 @@  discard block
 block discarded – undo
37 39
 if (GETPOSTISSET("id")) {
38 40
 	print '<h1><b>'.$langs->trans("ScanToOrder").'</b></h1>';
39 41
 	print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($id)."' width='30%'>";
40
-}
41
-else {
42
+} else {
42 43
 	print '<h1><b>'.$langs->trans("ScanToMenu").'</b></h1>';
43 44
 	print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' width='30%'>";
44 45
 }
Please login to merge, or discard this patch.
htdocs/core/tpl/advtarget.tpl.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -473,8 +473,9 @@
 block discarded – undo
473 473
 	$extrafields->fetch_name_optionals_label($elementype);
474 474
 	if (!empty($extrafields->attributes[$elementtype]['type'])) {
475 475
 		foreach ($extrafields->attributes[$elementtype]['type'] as $key => &$value) {
476
-			if ($value == 'radio')
477
-				$value = 'select';
476
+			if ($value == 'radio') {
477
+							$value = 'select';
478
+			}
478 479
 		}
479 480
 	}
480 481
 	if (!empty($extrafields->attributes[$elementtype]['label'])) {
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/scripts/mymodule.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,12 +47,22 @@
 block discarded – undo
47 47
 // Try master.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
48 48
 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
49 49
 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
50
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/master.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/master.inc.php";
51
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/master.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/master.inc.php";
50
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/master.inc.php")) {
51
+	$res = @include substr($tmp, 0, ($i + 1))."/master.inc.php";
52
+}
53
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/master.inc.php")) {
54
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/master.inc.php";
55
+}
52 56
 // Try master.inc.php using relative path
53
-if (!$res && file_exists("../master.inc.php")) $res = @include "../master.inc.php";
54
-if (!$res && file_exists("../../master.inc.php")) $res = @include "../../master.inc.php";
55
-if (!$res && file_exists("../../../master.inc.php")) $res = @include "../../../master.inc.php";
57
+if (!$res && file_exists("../master.inc.php")) {
58
+	$res = @include "../master.inc.php";
59
+}
60
+if (!$res && file_exists("../../master.inc.php")) {
61
+	$res = @include "../../master.inc.php";
62
+}
63
+if (!$res && file_exists("../../../master.inc.php")) {
64
+	$res = @include "../../../master.inc.php";
65
+}
56 66
 if (!$res) {
57 67
 	print "Include of master fails";
58 68
 	exit(-1);
Please login to merge, or discard this patch.
htdocs/compta/prelevement/index.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
 // Security check
40 40
 $socid = GETPOST('socid', 'int');
41
-if ($user->socid) $socid = $user->socid;
41
+if ($user->socid) {
42
+	$socid = $user->socid;
43
+}
42 44
 $result = restrictedArea($user, 'prelevement', '', '');
43 45
 
44 46
 
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
 $sql .= " s.nom as name, s.email, s.rowid as socid";
98 100
 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
99 101
 $sql .= " ".MAIN_DB_PREFIX."societe as s";
100
-if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
102
+if (!$user->rights->societe->client->voir && !$socid) {
103
+	$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
104
+}
101 105
 $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
102 106
 $sql .= " WHERE s.rowid = f.fk_soc";
103 107
 $sql .= " AND f.entity IN (".getEntity('invoice').")";
@@ -109,8 +113,12 @@  discard block
 block discarded – undo
109 113
 $sql .= " AND pfd.traite = 0";
110 114
 $sql .= " AND pfd.ext_payment_id IS NULL";
111 115
 $sql .= " AND pfd.fk_facture = f.rowid";
112
-if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
113
-if ($socid) $sql .= " AND f.fk_soc = ".$socid;
116
+if (!$user->rights->societe->client->voir && !$socid) {
117
+	$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
118
+}
119
+if ($socid) {
120
+	$sql .= " AND f.fk_soc = ".$socid;
121
+}
114 122
 
115 123
 $resql = $db->query($sql);
116 124
 if ($resql)
Please login to merge, or discard this patch.