Passed
Push — master ( 49af33...3cffbe )
by Alxarafe
21:21
created
dolibarr/htdocs/expedition/contact.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 $action=GETPOST('action','alpha');
43 43
 
44 44
 // Security check
45
-if ($user->societe_id) $socid=$user->societe_id;
45
+if ($user->societe_id) {
46
+    $socid=$user->societe_id;
47
+}
46 48
 $result = restrictedArea($user, 'expedition', $id,'');
47 49
 
48 50
 $object = new Expedition($db);
@@ -87,8 +89,7 @@  discard block
 block discarded – undo
87 89
 	{
88 90
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
89 91
 		exit;
90
-	}
91
-	else
92
+	} else
92 93
 	{
93 94
 		if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
94 95
 		{
@@ -117,8 +118,7 @@  discard block
 block discarded – undo
117 118
 	{
118 119
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
119 120
 		exit;
120
-	}
121
-	else {
121
+	} else {
122 122
 		dol_print_error($db);
123 123
 	}
124 124
 }
@@ -263,7 +263,9 @@  discard block
 block discarded – undo
263 263
 	foreach($dirtpls as $reldir)
264 264
 	{
265 265
 	    $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
266
-	    if ($res) break;
266
+	    if ($res) {
267
+	        break;
268
+	    }
267 269
 	}
268 270
 }
269 271
 
Please login to merge, or discard this patch.
dolibarr/htdocs/expedition/list.php 1 patch
Braces   +208 added lines, -71 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 $socid=GETPOST('socid','int');
39 39
 // Security check
40 40
 $expeditionid = GETPOST('id','int');
41
-if ($user->societe_id) $socid=$user->societe_id;
41
+if ($user->societe_id) {
42
+    $socid=$user->societe_id;
43
+}
42 44
 $result = restrictedArea($user, 'expedition',$expeditionid,'');
43 45
 
44 46
 $diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
@@ -60,8 +62,12 @@  discard block
 block discarded – undo
60 62
 $sortfield = GETPOST('sortfield','alpha');
61 63
 $sortorder = GETPOST('sortorder','alpha');
62 64
 $page = GETPOST('page','int');
63
-if (! $sortfield) $sortfield="e.ref";
64
-if (! $sortorder) $sortorder="DESC";
65
+if (! $sortfield) {
66
+    $sortfield="e.ref";
67
+}
68
+if (! $sortorder) {
69
+    $sortorder="DESC";
70
+}
65 71
 if (empty($page) || $page == -1) { $page = 0; }     // If $page is not defined, or '' or -1
66 72
 $offset = $limit * $page;
67 73
 $pageprev = $page - 1;
@@ -85,7 +91,9 @@  discard block
 block discarded – undo
85 91
 	's.nom'=>"ThirdParty",
86 92
 	'e.note_public'=>'NotePublic',
87 93
 );
88
-if (empty($user->socid)) $fieldstosearchall["e.note_private"]="NotePrivate";
94
+if (empty($user->socid)) {
95
+    $fieldstosearchall["e.note_private"]="NotePrivate";
96
+}
89 97
 
90 98
 $checkedtypetiers=0;
91 99
 $arrayfields=array(
@@ -111,7 +119,9 @@  discard block
 block discarded – undo
111 119
 {
112 120
 	foreach($extrafields->attribute_label as $key => $val)
113 121
 	{
114
-		if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
122
+		if (! empty($extrafields->attribute_list[$key])) {
123
+		    $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
124
+		}
115 125
 	}
116 126
 }
117 127
 
@@ -125,14 +135,18 @@  discard block
 block discarded – undo
125 135
 
126 136
 $parameters=array('socid'=>$socid);
127 137
 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
128
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
138
+if ($reshook < 0) {
139
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
140
+}
129 141
 
130 142
 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
131 143
 
132 144
 // Purge search criteria
133
-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
145
+if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) {
146
+    // All tests are required to be compatible with all browsers
134 147
 {
135 148
 	$search_ref_exp='';
149
+}
136 150
 	$search_ref_liv='';
137 151
 	$search_ref_customer='';
138 152
 	$search_company='';
@@ -185,27 +199,35 @@  discard block
 block discarded – undo
185 199
 $sql.= " state.code_departement as state_code, state.nom as state_name,";
186 200
 $sql.= ' e.date_creation as date_creation, e.tms as date_update';
187 201
 // Add fields from extrafields
188
-foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
202
+foreach ($extrafields->attribute_label as $key => $val) {
203
+    $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
204
+}
189 205
 // Add fields from hooks
190 206
 $parameters=array();
191 207
 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters);    // Note that $action and $object may have been modified by hook
192 208
 $sql.=$hookmanager->resPrint;
193 209
 $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
194
-if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)";
210
+if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
211
+    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)";
212
+}
195 213
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
196 214
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
197 215
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
198 216
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
199 217
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
200 218
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target";
201
-if (!$user->rights->societe->client->voir && !$socid)	// Internal user with no permission to see all
219
+if (!$user->rights->societe->client->voir && !$socid) {
220
+    // Internal user with no permission to see all
202 221
 {
203 222
 	$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
204 223
 }
224
+}
205 225
 $sql.= " WHERE e.entity IN (".getEntity('expedition').")";
206
-if (!$user->rights->societe->client->voir && !$socid)	// Internal user with no permission to see all
226
+if (!$user->rights->societe->client->voir && !$socid) {
227
+    // Internal user with no permission to see all
207 228
 {
208 229
 	$sql.= " AND e.fk_soc = sc.fk_soc";
230
+}
209 231
 	$sql.= " AND sc.fk_user = " .$user->id;
210 232
 }
211 233
 if ($socid)
@@ -215,17 +237,39 @@  discard block
 block discarded – undo
215 237
 if ($viewstatut <> '' && $viewstatut >= 0) {
216 238
 	$sql.= " AND e.fk_statut = ".$viewstatut;
217 239
 }
218
-if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer);
219
-if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed;
220
-if ($search_town)  $sql.= natural_search('s.town', $search_town);
221
-if ($search_zip)   $sql.= natural_search("s.zip",$search_zip);
222
-if ($search_state) $sql.= natural_search("state.nom",$search_state);
223
-if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
224
-if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
225
-if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
226
-if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
227
-if ($search_company) $sql .= natural_search('s.nom', $search_company);
228
-if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
240
+if ($search_ref_customer != '') {
241
+    $sql.=natural_search('e.ref_customer', $search_ref_customer);
242
+}
243
+if ($search_billed != '' && $search_billed >= 0) {
244
+    $sql.=' AND e.billed = '.$search_billed;
245
+}
246
+if ($search_town) {
247
+    $sql.= natural_search('s.town', $search_town);
248
+}
249
+if ($search_zip) {
250
+    $sql.= natural_search("s.zip",$search_zip);
251
+}
252
+if ($search_state) {
253
+    $sql.= natural_search("state.nom",$search_state);
254
+}
255
+if ($search_country) {
256
+    $sql .= " AND s.fk_pays IN (".$search_country.')';
257
+}
258
+if ($search_type_thirdparty) {
259
+    $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
260
+}
261
+if ($search_ref_exp) {
262
+    $sql .= natural_search('e.ref', $search_ref_exp);
263
+}
264
+if ($search_ref_liv) {
265
+    $sql .= natural_search('l.ref', $search_ref_liv);
266
+}
267
+if ($search_company) {
268
+    $sql .= natural_search('s.nom', $search_company);
269
+}
270
+if ($sall) {
271
+    $sql .= natural_search(array_keys($fieldstosearchall), $sall);
272
+}
229 273
 
230 274
 // Add where from extra fields
231 275
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -242,9 +286,11 @@  discard block
 block discarded – undo
242 286
 {
243 287
 	$result = $db->query($sql);
244 288
 	$nbtotalofrecords = $db->num_rows($result);
245
-	if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
289
+	if (($page * $limit) > $nbtotalofrecords) {
290
+	    // if total resultset is smaller then paging size (filtering), goto and load page 0
246 291
 	{
247 292
 		$page = 0;
293
+	}
248 294
 		$offset = 0;
249 295
 	}
250 296
 }
@@ -260,17 +306,39 @@  discard block
 block discarded – undo
260 306
 	$expedition = new Expedition($db);
261 307
 
262 308
 	$param='';
263
-	if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
264
-	if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
265
-	if ($sall) $param.= "&amp;sall=".urlencode($sall);
266
-	if ($search_ref_exp)  $param.= "&amp;search_ref_exp=".urlencode($search_ref_exp);
267
-	if ($search_ref_liv)  $param.= "&amp;search_ref_liv=".urlencode($search_ref_liv);
268
-	if ($search_ref_customer) $param.= "&amp;search_ref_customer=".urlencode($search_ref_customer);
269
-	if ($search_company)   $param.= "&amp;search_company=".urlencode($search_company);
270
-	if ($search_town)      $param.= '&search_town='.urlencode($search_town);
271
-	if ($search_zip)       $param.= '&search_zip='.urlencode($search_zip);
272
-	if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut);
273
-	if ($optioncss != '')  $param.='&amp;optioncss='.urlencode($optioncss);
309
+	if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
310
+	    $param.='&contextpage='.urlencode($contextpage);
311
+	}
312
+	if ($limit > 0 && $limit != $conf->liste_limit) {
313
+	    $param.='&limit='.urlencode($limit);
314
+	}
315
+	if ($sall) {
316
+	    $param.= "&amp;sall=".urlencode($sall);
317
+	}
318
+	if ($search_ref_exp) {
319
+	    $param.= "&amp;search_ref_exp=".urlencode($search_ref_exp);
320
+	}
321
+	if ($search_ref_liv) {
322
+	    $param.= "&amp;search_ref_liv=".urlencode($search_ref_liv);
323
+	}
324
+	if ($search_ref_customer) {
325
+	    $param.= "&amp;search_ref_customer=".urlencode($search_ref_customer);
326
+	}
327
+	if ($search_company) {
328
+	    $param.= "&amp;search_company=".urlencode($search_company);
329
+	}
330
+	if ($search_town) {
331
+	    $param.= '&search_town='.urlencode($search_town);
332
+	}
333
+	if ($search_zip) {
334
+	    $param.= '&search_zip='.urlencode($search_zip);
335
+	}
336
+	if ($viewstatut != '') {
337
+	    $param.= '&viewstatut='.urlencode($viewstatut);
338
+	}
339
+	if ($optioncss != '') {
340
+	    $param.='&amp;optioncss='.urlencode($optioncss);
341
+	}
274 342
 	// Add $param from extra fields
275 343
 	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
276 344
 
@@ -286,7 +354,9 @@  discard block
 block discarded – undo
286 354
 
287 355
 	$i = 0;
288 356
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
289
-	if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
357
+	if ($optioncss != '') {
358
+	    print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
359
+	}
290 360
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
291 361
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
292 362
 	print '<input type="hidden" name="action" value="list">';
@@ -298,7 +368,9 @@  discard block
 block discarded – undo
298 368
 
299 369
 	if ($sall)
300 370
 	{
301
-		foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
371
+		foreach($fieldstosearchall as $key => $val) {
372
+		    $fieldstosearchall[$key]=$langs->trans($val);
373
+		}
302 374
 		print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
303 375
 	}
304 376
 
@@ -343,9 +415,13 @@  discard block
 block discarded – undo
343 415
 		print '</td>';
344 416
 	}
345 417
 	// Town
346
-	if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
418
+	if (! empty($arrayfields['s.town']['checked'])) {
419
+	    print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
420
+	}
347 421
 	// Zip
348
-	if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
422
+	if (! empty($arrayfields['s.zip']['checked'])) {
423
+	    print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
424
+	}
349 425
 	// State
350 426
 	if (! empty($arrayfields['state.nom']['checked']))
351 427
 	{
@@ -425,17 +501,39 @@  discard block
 block discarded – undo
425 501
 	print "</tr>\n";
426 502
 
427 503
 	print '<tr class="liste_titre">';
428
-	if (! empty($arrayfields['e.ref']['checked']))            print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder);
429
-	if (! empty($arrayfields['e.ref_customer']['checked']))   print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"],"e.ref_customer","",$param,'',$sortfield,$sortorder);
430
-	if (! empty($arrayfields['s.nom']['checked']))            print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder);
431
-	if (! empty($arrayfields['s.town']['checked']))           print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
432
-	if (! empty($arrayfields['s.zip']['checked']))            print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
433
-	if (! empty($arrayfields['state.nom']['checked']))        print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
434
-	if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
435
-	if (! empty($arrayfields['typent.code']['checked']))      print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
436
-	if (! empty($arrayfields['e.date_delivery']['checked']))  print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
437
-	if (! empty($arrayfields['l.ref']['checked']))            print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder);
438
-	if (! empty($arrayfields['l.date_delivery']['checked']))  print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
504
+	if (! empty($arrayfields['e.ref']['checked'])) {
505
+	    print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder);
506
+	}
507
+	if (! empty($arrayfields['e.ref_customer']['checked'])) {
508
+	    print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"],"e.ref_customer","",$param,'',$sortfield,$sortorder);
509
+	}
510
+	if (! empty($arrayfields['s.nom']['checked'])) {
511
+	    print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder);
512
+	}
513
+	if (! empty($arrayfields['s.town']['checked'])) {
514
+	    print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
515
+	}
516
+	if (! empty($arrayfields['s.zip']['checked'])) {
517
+	    print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
518
+	}
519
+	if (! empty($arrayfields['state.nom']['checked'])) {
520
+	    print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
521
+	}
522
+	if (! empty($arrayfields['country.code_iso']['checked'])) {
523
+	    print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
524
+	}
525
+	if (! empty($arrayfields['typent.code']['checked'])) {
526
+	    print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
527
+	}
528
+	if (! empty($arrayfields['e.date_delivery']['checked'])) {
529
+	    print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
530
+	}
531
+	if (! empty($arrayfields['l.ref']['checked'])) {
532
+	    print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"],"l.ref","",$param, '',$sortfield,$sortorder);
533
+	}
534
+	if (! empty($arrayfields['l.date_delivery']['checked'])) {
535
+	    print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"],"l.date_delivery","",$param, 'align="center"',$sortfield,$sortorder);
536
+	}
439 537
 	// Extra fields
440 538
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
441 539
 	{
@@ -445,7 +543,9 @@  discard block
 block discarded – undo
445 543
 			{
446 544
 				$align=$extrafields->getAlignFlag($key);
447 545
 				$sortonfield = "ef.".$key;
448
-				if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
546
+				if (! empty($extrafields->attribute_computed[$key])) {
547
+				    $sortonfield='';
548
+				}
449 549
 				print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
450 550
 			}
451 551
 		}
@@ -454,10 +554,18 @@  discard block
 block discarded – undo
454 554
 	$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
455 555
 	$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
456 556
 	print $hookmanager->resPrint;
457
-	if (! empty($arrayfields['e.datec']['checked']))  print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
458
-	if (! empty($arrayfields['e.tms']['checked']))    print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
459
-	if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
460
-	if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'],$_SERVER["PHP_SELF"],"e.billed","",$param,'align="center"',$sortfield,$sortorder);
557
+	if (! empty($arrayfields['e.datec']['checked'])) {
558
+	    print_liste_field_titre($arrayfields['e.datec']['label'],$_SERVER["PHP_SELF"],"e.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
559
+	}
560
+	if (! empty($arrayfields['e.tms']['checked'])) {
561
+	    print_liste_field_titre($arrayfields['e.tms']['label'],$_SERVER["PHP_SELF"],"e.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
562
+	}
563
+	if (! empty($arrayfields['e.fk_statut']['checked'])) {
564
+	    print_liste_field_titre($arrayfields['e.fk_statut']['label'],$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
565
+	}
566
+	if (! empty($arrayfields['e.billed']['checked'])) {
567
+	    print_liste_field_titre($arrayfields['e.billed']['label'],$_SERVER["PHP_SELF"],"e.billed","",$param,'align="center"',$sortfield,$sortorder);
568
+	}
461 569
 	print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
462 570
 	print "</tr>\n";
463 571
 
@@ -483,7 +591,9 @@  discard block
 block discarded – undo
483 591
 			print "<td>";
484 592
 			print $shipment->getNomUrl(1);
485 593
 			print "</td>\n";
486
-			if (! $i) $totalarray['nbfield']++;
594
+			if (! $i) {
595
+			    $totalarray['nbfield']++;
596
+			}
487 597
 		}
488 598
 
489 599
 		// Ref customer
@@ -492,7 +602,9 @@  discard block
 block discarded – undo
492 602
 			print "<td>";
493 603
 			print $obj->ref_customer;
494 604
 			print "</td>\n";
495
-			if (! $i) $totalarray['nbfield']++;
605
+			if (! $i) {
606
+			    $totalarray['nbfield']++;
607
+			}
496 608
 		}
497 609
 
498 610
 		// Third party
@@ -501,7 +613,9 @@  discard block
 block discarded – undo
501 613
 			print '<td>';
502 614
 			print $companystatic->getNomUrl(1);
503 615
 			print '</td>';
504
-			if (! $i) $totalarray['nbfield']++;
616
+			if (! $i) {
617
+			    $totalarray['nbfield']++;
618
+			}
505 619
 		}
506 620
 		// Town
507 621
 		if (! empty($arrayfields['s.town']['checked']))
@@ -509,7 +623,9 @@  discard block
 block discarded – undo
509 623
 			print '<td class="nocellnopadd">';
510 624
 			print $obj->town;
511 625
 			print '</td>';
512
-			if (! $i) $totalarray['nbfield']++;
626
+			if (! $i) {
627
+			    $totalarray['nbfield']++;
628
+			}
513 629
 		}
514 630
 		// Zip
515 631
 		if (! empty($arrayfields['s.zip']['checked']))
@@ -517,13 +633,17 @@  discard block
 block discarded – undo
517 633
 			print '<td class="nocellnopadd">';
518 634
 			print $obj->zip;
519 635
 			print '</td>';
520
-			if (! $i) $totalarray['nbfield']++;
636
+			if (! $i) {
637
+			    $totalarray['nbfield']++;
638
+			}
521 639
 		}
522 640
 		// State
523 641
 		if (! empty($arrayfields['state.nom']['checked']))
524 642
 		{
525 643
 			print "<td>".$obj->state_name."</td>\n";
526
-			if (! $i) $totalarray['nbfield']++;
644
+			if (! $i) {
645
+			    $totalarray['nbfield']++;
646
+			}
527 647
 		}
528 648
 		// Country
529 649
 		if (! empty($arrayfields['country.code_iso']['checked']))
@@ -532,16 +652,22 @@  discard block
 block discarded – undo
532 652
 			$tmparray=getCountry($obj->fk_pays,'all');
533 653
 			print $tmparray['label'];
534 654
 			print '</td>';
535
-			if (! $i) $totalarray['nbfield']++;
655
+			if (! $i) {
656
+			    $totalarray['nbfield']++;
657
+			}
536 658
 		}
537 659
 		// Type ent
538 660
 		if (! empty($arrayfields['typent.code']['checked']))
539 661
 		{
540 662
 			print '<td align="center">';
541
-			if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
663
+			if (count($typenArray)==0) {
664
+			    $typenArray = $formcompany->typent_array(1);
665
+			}
542 666
 			print $typenArray[$obj->typent_code];
543 667
 			print '</td>';
544
-			if (! $i) $totalarray['nbfield']++;
668
+			if (! $i) {
669
+			    $totalarray['nbfield']++;
670
+			}
545 671
 		}
546 672
 
547 673
 		// Date delivery planed
@@ -560,7 +686,9 @@  discard block
 block discarded – undo
560 686
 		{
561 687
 			$shipment->fetchObjectLinked($shipment->id,$shipment->element);
562 688
 			$receiving='';
563
-			if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
689
+			if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) {
690
+			    $receiving=reset($shipment->linkedObjects['delivery']);
691
+			}
564 692
 
565 693
 			if (! empty($arrayfields['l.ref']['checked']))
566 694
 			{
@@ -591,7 +719,9 @@  discard block
 block discarded – undo
591 719
 			print '<td align="center" class="nowrap">';
592 720
 			print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
593 721
 			print '</td>';
594
-			if (! $i) $totalarray['nbfield']++;
722
+			if (! $i) {
723
+			    $totalarray['nbfield']++;
724
+			}
595 725
 		}
596 726
 		// Date modification
597 727
 		if (! empty($arrayfields['e.tms']['checked']))
@@ -599,24 +729,32 @@  discard block
 block discarded – undo
599 729
 			print '<td align="center" class="nowrap">';
600 730
 			print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
601 731
 			print '</td>';
602
-			if (! $i) $totalarray['nbfield']++;
732
+			if (! $i) {
733
+			    $totalarray['nbfield']++;
734
+			}
603 735
 		}
604 736
 		// Status
605 737
 		if (! empty($arrayfields['e.fk_statut']['checked']))
606 738
 		{
607 739
 			print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>';
608
-			if (! $i) $totalarray['nbfield']++;
740
+			if (! $i) {
741
+			    $totalarray['nbfield']++;
742
+			}
609 743
 		}
610 744
 		// Billed
611 745
 		if (! empty($arrayfields['e.billed']['checked']))
612 746
 		{
613 747
 			print '<td align="center">'.yn($obj->billed).'</td>';
614
-			if (! $i) $totalarray['nbfield']++;
748
+			if (! $i) {
749
+			    $totalarray['nbfield']++;
750
+			}
615 751
 		}
616 752
 
617 753
 		// Action column
618 754
 		print '<td></td>';
619
-		if (! $i) $totalarray['nbfield']++;
755
+		if (! $i) {
756
+		    $totalarray['nbfield']++;
757
+		}
620 758
 
621 759
 		print "</tr>\n";
622 760
 
@@ -627,8 +765,7 @@  discard block
 block discarded – undo
627 765
 	print "</div>";
628 766
 	print '</form>';
629 767
 	$db->free($resql);
630
-}
631
-else
768
+} else
632 769
 {
633 770
 	dol_print_error($db);
634 771
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/expedition/stats/index.php 1 patch
Braces   +35 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,15 +74,22 @@  discard block
 block discarded – undo
74 74
 if (!$user->rights->societe->client->voir || $user->societe_id)
75 75
 {
76 76
     $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
77
-    if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
78
-    if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
79
-}
80
-else
77
+    if ($mode == 'customer') {
78
+        $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
79
+    }
80
+    if ($mode == 'supplier') {
81
+        $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$user->id.'-'.$year.'.png';
82
+    }
83
+    } else
81 84
 {
82 85
     $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png';
83
-    if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$year.'.png';
84
-    if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$year.'.png';
85
-}
86
+    if ($mode == 'customer') {
87
+        $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-'.$year.'.png';
88
+    }
89
+    if ($mode == 'supplier') {
90
+        $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-'.$year.'.png';
91
+    }
92
+    }
86 93
 
87 94
 $px1 = new DolGraph();
88 95
 $mesg = $px1->isGraphKo();
@@ -209,7 +216,9 @@  discard block
 block discarded – undo
209 216
 		$arrayyears[$val['year']]=$val['year'];
210 217
 	}
211 218
 }
212
-if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
219
+if (! count($arrayyears)) {
220
+    $arrayyears[$nowyear]=$nowyear;
221
+}
213 222
 
214 223
 $h=0;
215 224
 $head = array();
@@ -238,8 +247,12 @@  discard block
 block discarded – undo
238 247
 	print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
239 248
 	// Company
240 249
 	print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
241
-	if ($mode == 'customer') $filter='s.client in (1,2,3)';
242
-	if ($mode == 'supplier') $filter='s.fournisseur = 1';
250
+	if ($mode == 'customer') {
251
+	    $filter='s.client in (1,2,3)';
252
+	}
253
+	if ($mode == 'supplier') {
254
+	    $filter='s.fournisseur = 1';
255
+	}
243 256
 	print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
244 257
 	print '</td></tr>';
245 258
 	// User
@@ -248,8 +261,12 @@  discard block
 block discarded – undo
248 261
 	print '</td></tr>';
249 262
 	// Year
250 263
 	print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
251
-	if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
252
-	if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
264
+	if (! in_array($year,$arrayyears)) {
265
+	    $arrayyears[$year]=$year;
266
+	}
267
+	if (! in_array($nowyear,$arrayyears)) {
268
+	    $arrayyears[$nowyear]=$nowyear;
269
+	}
253 270
 	arsort($arrayyears);
254 271
 	print $form->selectarray('year',$arrayyears,$year,0);
255 272
 	print '</td></tr>';
@@ -289,8 +306,11 @@  discard block
 block discarded – undo
289 306
 
290 307
 	print '<tr class="oddeven" height="24">';
291 308
 	print '<td align="center">';
292
-	if ($year) print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a>';
293
-	else print $langs->trans("ValidationDateNotDefinedEvenIfShipmentValidated");
309
+	if ($year) {
310
+	    print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a>';
311
+	} else {
312
+	    print $langs->trans("ValidationDateNotDefinedEvenIfShipmentValidated");
313
+	}
294 314
 	print '</td>';
295 315
 	print '<td align="right">'.$val['nb'].'</td>';
296 316
 	/*print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
@@ -308,8 +328,7 @@  discard block
 block discarded – undo
308 328
 
309 329
 // Show graphs
310 330
 print '<table class="border" width="100%"><tr class="pair nohover"><td align="center">';
311
-if ($mesg) { print $mesg; }
312
-else {
331
+if ($mesg) { print $mesg; } else {
313 332
     print $px1->show();
314 333
     print "<br>\n";
315 334
     /*print $px2->show();
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/companypaymentmode.class.php 1 patch
Braces   +87 added lines, -44 removed lines patch added patch discarded remove patch
@@ -212,8 +212,12 @@  discard block
 block discarded – undo
212 212
 
213 213
 		$this->db = $db;
214 214
 
215
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0;
216
-		if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0;
215
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
216
+		    $this->fields['rowid']['visible']=0;
217
+		}
218
+		if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
219
+		    $this->fields['entity']['enabled']=0;
220
+		}
217 221
 	}
218 222
 
219 223
 	/**
@@ -291,11 +295,17 @@  discard block
 block discarded – undo
291 295
 	public function fetch($id, $ref = null, $socid = 0, $type = '')
292 296
 	{
293 297
 		$morewhere = '';
294
-		if ($socid) $morewhere.= " AND fk_soc  = ".$this->db->escape($socid)." AND default_rib = 1";
295
-		if ($type)  $morewhere.= " AND type = '".$this->db->escape($type)."'";
298
+		if ($socid) {
299
+		    $morewhere.= " AND fk_soc  = ".$this->db->escape($socid)." AND default_rib = 1";
300
+		}
301
+		if ($type) {
302
+		    $morewhere.= " AND type = '".$this->db->escape($type)."'";
303
+		}
296 304
 
297 305
 		$result = $this->fetchCommon($id, $ref, $morewhere);
298
-		if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
306
+		if ($result > 0 && ! empty($this->table_element_line)) {
307
+		    $this->fetchLines();
308
+		}
299 309
 		return $result;
300 310
 	}
301 311
 
@@ -353,7 +363,10 @@  discard block
 block discarded – undo
353 363
         global $dolibarr_main_authentication, $dolibarr_main_demo;
354 364
         global $menumanager;
355 365
 
356
-        if (! empty($conf->dol_no_mouse_hover)) $notooltip=1;   // Force disable tooltips
366
+        if (! empty($conf->dol_no_mouse_hover)) {
367
+            $notooltip=1;
368
+        }
369
+        // Force disable tooltips
357 370
 
358 371
         $result = '';
359 372
         $companylink = '';
@@ -368,8 +381,12 @@  discard block
 block discarded – undo
368 381
         {
369 382
 	        // Add param to save lastsearch_values or not
370 383
 	        $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
371
-	        if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
372
-	        if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
384
+	        if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) {
385
+	            $add_save_lastsearch_values=1;
386
+	        }
387
+	        if ($add_save_lastsearch_values) {
388
+	            $url.='&save_lastsearch_values=1';
389
+	        }
373 390
         }
374 391
 
375 392
         $linkclose='';
@@ -382,16 +399,21 @@  discard block
 block discarded – undo
382 399
             }
383 400
             $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
384 401
             $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
402
+        } else {
403
+            $linkclose = ($morecss?' class="'.$morecss.'"':'');
385 404
         }
386
-        else $linkclose = ($morecss?' class="'.$morecss.'"':'');
387 405
 
388 406
 		$linkstart = '<a href="'.$url.'"';
389 407
 		$linkstart.=$linkclose.'>';
390 408
 		$linkend='</a>';
391 409
 
392 410
 		$result .= $linkstart;
393
-		if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
394
-		if ($withpicto != 2) $result.= $this->ref;
411
+		if ($withpicto) {
412
+		    $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
413
+		}
414
+		if ($withpicto != 2) {
415
+		    $result.= $this->ref;
416
+		}
395 417
 		$result .= $linkend;
396 418
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
397 419
 
@@ -417,25 +439,30 @@  discard block
 block discarded – undo
417 439
 			if ($this->db->num_rows($result1) == 0)
418 440
 			{
419 441
 				return 0;
420
-			}
421
-			else
442
+			} else
422 443
 			{
423 444
 				$obj = $this->db->fetch_object($result1);
424 445
 
425 446
 				$type = '';
426
-				if (empty($alltypes)) $type = $obj->type;
447
+				if (empty($alltypes)) {
448
+				    $type = $obj->type;
449
+				}
427 450
 
428 451
 				$this->db->begin();
429 452
 
430 453
 				$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
431 454
 				$sql2.= " WHERE default_rib <> 0 AND fk_soc = ".$obj->fk_soc;
432
-				if ($type) $sql2.= " AND type = '".$this->db->escape($type)."'";
455
+				if ($type) {
456
+				    $sql2.= " AND type = '".$this->db->escape($type)."'";
457
+				}
433 458
 				dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
434 459
 				$result2 = $this->db->query($sql2);
435 460
 
436 461
 				$sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1";
437 462
 				$sql3.= " WHERE rowid = ".$obj->id;
438
-				if ($type) $sql3.= " AND type = '".$this->db->escape($type)."'";
463
+				if ($type) {
464
+				    $sql3.= " AND type = '".$this->db->escape($type)."'";
465
+				}
439 466
 				dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
440 467
 				$result3 = $this->db->query($sql3);
441 468
 
@@ -444,15 +471,13 @@  discard block
 block discarded – undo
444 471
 					dol_print_error($this->db);
445 472
 					$this->db->rollback();
446 473
 					return -1;
447
-				}
448
-				else
474
+				} else
449 475
 				{
450 476
 					$this->db->commit();
451 477
 					return 1;
452 478
 				}
453 479
 			}
454
-		}
455
-		else
480
+		} else
456 481
 		{
457 482
 			dol_print_error($this->db);
458 483
 			return -1;
@@ -485,33 +510,52 @@  discard block
 block discarded – undo
485 510
 
486 511
 		if ($mode == 0 || $mode == 1)
487 512
 		{
488
-			if ($status == 1) return $langs->trans('Enabled');
489
-			if ($status == 0) return $langs->trans('Disabled');
490
-		}
491
-		elseif ($mode == 2)
513
+			if ($status == 1) {
514
+			    return $langs->trans('Enabled');
515
+			}
516
+			if ($status == 0) {
517
+			    return $langs->trans('Disabled');
518
+			}
519
+		} elseif ($mode == 2)
492 520
 		{
493
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
494
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
495
-		}
496
-		elseif ($mode == 3)
521
+			if ($status == 1) {
522
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
523
+			}
524
+			if ($status == 0) {
525
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
526
+			}
527
+		} elseif ($mode == 3)
497 528
 		{
498
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
499
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
500
-		}
501
-		elseif ($mode == 4)
529
+			if ($status == 1) {
530
+			    return img_picto($langs->trans('Enabled'),'statut4');
531
+			}
532
+			if ($status == 0) {
533
+			    return img_picto($langs->trans('Disabled'),'statut5');
534
+			}
535
+		} elseif ($mode == 4)
502 536
 		{
503
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
504
-			if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
505
-		}
506
-		elseif ($mode == 5)
537
+			if ($status == 1) {
538
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
539
+			}
540
+			if ($status == 0) {
541
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
542
+			}
543
+		} elseif ($mode == 5)
507 544
 		{
508
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
509
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
510
-		}
511
-		elseif ($mode == 6)
545
+			if ($status == 1) {
546
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
547
+			}
548
+			if ($status == 0) {
549
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
550
+			}
551
+		} elseif ($mode == 6)
512 552
 		{
513
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
514
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
553
+			if ($status == 1) {
554
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
555
+			}
556
+			if ($status == 0) {
557
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
558
+			}
515 559
 		}
516 560
 	}
517 561
 
@@ -561,8 +605,7 @@  discard block
 block discarded – undo
561 605
 			}
562 606
 
563 607
 			$this->db->free($result);
564
-		}
565
-		else
608
+		} else
566 609
 		{
567 610
 			dol_print_error($this->db);
568 611
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/address.class.php 1 patch
Braces   +17 added lines, -24 removed lines patch added patch discarded remove patch
@@ -118,15 +118,13 @@  discard block
 block discarded – undo
118 118
 					dol_syslog(get_class($this)."::create success id=".$this->id);
119 119
 					$this->db->commit();
120 120
 					return 0;
121
-				}
122
-				else
121
+				} else
123 122
 				{
124 123
 					dol_syslog(get_class($this)."::create echec update");
125 124
 					$this->db->rollback();
126 125
 					return -3;
127 126
 				}
128
-			}
129
-			else
127
+			} else
130 128
 
131 129
 			{
132 130
 				if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
@@ -138,8 +136,7 @@  discard block
 block discarded – undo
138 136
 				$this->db->rollback();
139 137
 				return -2;
140 138
 			}
141
-		}
142
-		else
139
+		} else
143 140
 		{
144 141
 			$this->db->rollback();
145 142
 			dol_syslog(get_class($this)."::create echec verify sql=$sql");
@@ -213,7 +210,9 @@  discard block
 block discarded – undo
213 210
 			$sql.= ", note = ".($this->note?"'".$this->db->escape($this->note)."'":"null");
214 211
 			$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
215 212
 			$sql.= ", fax = ".($this->fax?"'".$this->db->escape($this->fax)."'":"null");
216
-			if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
213
+			if ($user) {
214
+			    $sql .= ",fk_user_modif = '".$user->id."'";
215
+			}
217 216
 			$sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $this->db->escape($id) ."'";
218 217
 
219 218
 			dol_syslog(get_class($this)."::Update", LOG_DEBUG);
@@ -223,16 +222,14 @@  discard block
 block discarded – undo
223 222
 				dol_syslog(get_class($this)."::Update success");
224 223
 				$this->db->commit();
225 224
 				return 1;
226
-			}
227
-			else
225
+			} else
228 226
 			{
229 227
 				if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
230 228
 				{
231 229
 
232 230
 					$this->error=$langs->trans("ErrorDuplicateField",$this->name);
233 231
 					$result=-1;
234
-				}
235
-				else
232
+				} else
236 233
 				{
237 234
 					$this->error=$this->db->lasterror();
238 235
 					$result=-2;
@@ -319,20 +316,17 @@  discard block
 block discarded – undo
319 316
 					}
320 317
 					$this->db->free($resql);
321 318
 					return $num;
322
-				}
323
-				else
319
+				} else
324 320
 				{
325 321
 					dol_syslog(get_class($this).'::Fetch Erreur: aucune adresse', LOG_ERR);
326 322
 					return 0;
327 323
 				}
328
-			}
329
-			else
324
+			} else
330 325
 			{
331 326
 				dol_syslog(get_class($this).'::Fetch Erreur: societe inconnue', LOG_ERR);
332 327
 				return -1;
333 328
 			}
334
-		}
335
-		else
329
+		} else
336 330
 		{
337 331
 			$this->error=$this->db->error();
338 332
 		}
@@ -386,8 +380,7 @@  discard block
 block discarded – undo
386 380
 				$this->note				= $obj->note;
387 381
 
388 382
 				$result = 1;
389
-			}
390
-			else
383
+			} else
391 384
 			{
392 385
 				dol_syslog('Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql);
393 386
 				$this->error='Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql;
@@ -395,8 +388,7 @@  discard block
 block discarded – undo
395 388
 			}
396 389
 
397 390
 			$this->db->free($resql);
398
-		}
399
-		else
391
+		} else
400 392
 		{
401 393
 			dol_syslog('Erreur Societe::Fetch echec', LOG_DEBUG);
402 394
 			dol_syslog('Erreur Societe::Fetch '.$this->db->error());
@@ -450,7 +442,9 @@  discard block
 block discarded – undo
450 442
         $link = '<a href="'.DOL_URL_ROOT.'/comm/address.php?id='.$this->id.'&socid='.$this->socid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
451 443
 		$linkend='</a>';
452 444
 
453
-        if ($withpicto) $result.=($link.img_object($langs->trans("ShowAddress").': '.$this->label, 'address', 'class="classfortooltip"').$linkend.' ');
445
+        if ($withpicto) {
446
+            $result.=($link.img_object($langs->trans("ShowAddress").': '.$this->label, 'address', 'class="classfortooltip"').$linkend.' ');
447
+        }
454 448
 		$result.=$link.$this->label.$linkend;
455 449
 		return $result;
456 450
 	}
@@ -495,8 +489,7 @@  discard block
 block discarded – undo
495 489
 			}
496 490
 
497 491
 			$this->db->free($result);
498
-		}
499
-		else
492
+		} else
500 493
 		{
501 494
 			dol_print_error($this->db);
502 495
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/companybankaccount.class.php 1 patch
Braces   +52 added lines, -38 removed lines patch added patch discarded remove patch
@@ -77,8 +77,12 @@  discard block
 block discarded – undo
77 77
 		if ($result)
78 78
 		{
79 79
 			$numrows=$this->db->num_rows($result);
80
-			if ($this->default_rib && $numrows > 0) $this->default_rib = 0;
81
-			if (empty($this->default_rib) && $numrows == 0) $this->default_rib = 1;
80
+			if ($this->default_rib && $numrows > 0) {
81
+			    $this->default_rib = 0;
82
+			}
83
+			if (empty($this->default_rib) && $numrows == 0) {
84
+			    $this->default_rib = 1;
85
+			}
82 86
 		}
83 87
 
84 88
 		$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec)";
@@ -94,25 +98,24 @@  discard block
 block discarded – undo
94 98
 				{
95 99
 				   	// Call trigger
96 100
 					$result=$this->call_trigger('COMPANY_RIB_CREATE',$user);
97
-					if ($result < 0) $error++;
101
+					if ($result < 0) {
102
+					    $error++;
103
+					}
98 104
 					// End call triggers
99 105
 
100 106
 					if (! $error)
101 107
 					{
102 108
 						return 1;
103
-					}
104
-					else
109
+					} else
105 110
 					{
106 111
 						return 0;
107 112
 					}
108
-				}
109
-				else
113
+				} else
110 114
 				{
111 115
 					return 1;
112 116
 				}
113 117
 			}
114
-		}
115
-		else
118
+		} else
116 119
 		{
117 120
 			print $this->db->error();
118 121
 			return 0;
@@ -131,10 +134,16 @@  discard block
 block discarded – undo
131 134
 		global $conf;
132 135
 		$error = 0;
133 136
 
134
-		if (! $this->id) return -1;
137
+		if (! $this->id) {
138
+		    return -1;
139
+		}
135 140
 
136
-		if (dol_strlen($this->domiciliation) > 255) $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1);
137
-		if (dol_strlen($this->owner_address) > 255) $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1);
141
+		if (dol_strlen($this->domiciliation) > 255) {
142
+		    $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1);
143
+		}
144
+		if (dol_strlen($this->owner_address) > 255) {
145
+		    $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1);
146
+		}
138 147
 
139 148
 		$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET";
140 149
 		$sql.= " bank = '" .$this->db->escape($this->bank)."'";
@@ -154,10 +163,11 @@  discard block
 block discarded – undo
154 163
 			$sql.= ",rum = '".$this->db->escape($this->rum)."'";
155 164
 			$sql.= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null");
156 165
 		}
157
-		if (trim($this->label) != '')
158
-			$sql.= ",label = '".$this->db->escape($this->label)."'";
159
-		else
160
-			$sql.= ",label = NULL";
166
+		if (trim($this->label) != '') {
167
+					$sql.= ",label = '".$this->db->escape($this->label)."'";
168
+		} else {
169
+					$sql.= ",label = NULL";
170
+		}
161 171
 		$sql.= " WHERE rowid = ".$this->id;
162 172
 
163 173
 		$result = $this->db->query($sql);
@@ -169,23 +179,22 @@  discard block
 block discarded – undo
169 179
 		{
170 180
 			// Call trigger
171 181
 			$result=$this->call_trigger('COMPANY_RIB_MODIFY',$user);
172
-			if ($result < 0) $error++;
182
+			if ($result < 0) {
183
+			    $error++;
184
+			}
173 185
 			// End call triggers
174 186
 			if(! $error )
175 187
 			{
176 188
 				return 1;
177
-			}
178
-			else
189
+			} else
179 190
 			{
180 191
 				return -1;
181 192
 			}
182
-		}
183
-		else
193
+		} else
184 194
 		{
185 195
 			return 1;
186 196
 		}
187
-		}
188
-		else
197
+		} else
189 198
 		{
190 199
 			dol_print_error($this->db);
191 200
 			return -1;
@@ -203,17 +212,25 @@  discard block
 block discarded – undo
203 212
 	 */
204 213
 	function fetch($id, $socid=0, $default=1, $type='ban')
205 214
 	{
206
-		if (empty($id) && empty($socid)) return -1;
215
+		if (empty($id) && empty($socid)) {
216
+		    return -1;
217
+		}
207 218
 
208 219
 		$sql = "SELECT rowid, type, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
209 220
 		$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur";
210 221
 		$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
211
-		if ($id)    $sql.= " WHERE rowid = ".$id;
222
+		if ($id) {
223
+		    $sql.= " WHERE rowid = ".$id;
224
+		}
212 225
 		if ($socid)
213 226
 		{
214 227
 			$sql.= " WHERE fk_soc  = ".$socid;
215
-			if ($default > -1) $sql.=" AND default_rib = ".$this->db->escape($default);
216
-			if ($type) $sql.= " AND type ='".$this->db->escape($type)."'";
228
+			if ($default > -1) {
229
+			    $sql.=" AND default_rib = ".$this->db->escape($default);
230
+			}
231
+			if ($type) {
232
+			    $sql.= " AND type ='".$this->db->escape($type)."'";
233
+			}
217 234
 		}
218 235
 
219 236
 		$resql = $this->db->query($sql);
@@ -248,8 +265,7 @@  discard block
 block discarded – undo
248 265
 			$this->db->free($resql);
249 266
 
250 267
 			return 1;
251
-		}
252
-		else
268
+		} else
253 269
 		{
254 270
 			dol_print_error($this->db);
255 271
 			return -1;
@@ -277,7 +293,9 @@  discard block
 block discarded – undo
277 293
 		{
278 294
 			// Call trigger
279 295
 			$result=$this->call_trigger('COMPANY_RIB_DELETE',$user);
280
-			if ($result < 0) $error++;
296
+			if ($result < 0) {
297
+			    $error++;
298
+			}
281 299
 			// End call triggers
282 300
 		}
283 301
 
@@ -297,8 +315,7 @@  discard block
 block discarded – undo
297 315
 		{
298 316
 			$this->db->commit();
299 317
 			return 1;
300
-		}
301
-		else
318
+		} else
302 319
 		{
303 320
 			$this->db->rollback();
304 321
 			return -1*$error;
@@ -345,8 +362,7 @@  discard block
 block discarded – undo
345 362
 			if ($this->db->num_rows($result1) == 0)
346 363
 			{
347 364
 				return 0;
348
-			}
349
-			else
365
+			} else
350 366
 			{
351 367
 				$obj = $this->db->fetch_object($result1);
352 368
 
@@ -367,15 +383,13 @@  discard block
 block discarded – undo
367 383
 					dol_print_error($this->db);
368 384
 					$this->db->rollback();
369 385
 					return -1;
370
-				}
371
-				else
386
+				} else
372 387
 				{
373 388
 					$this->db->commit();
374 389
 					return 1;
375 390
 				}
376 391
 			}
377
-		}
378
-		else
392
+		} else
379 393
 		{
380 394
 			dol_print_error($this->db);
381 395
 			return -1;
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/api_contacts.class.php 1 patch
Braces   +29 added lines, -18 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@  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)
122
-			$search_sale = DolibarrApiAccess::$user->id;
121
+		if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) {
122
+					$search_sale = DolibarrApiAccess::$user->id;
123
+		}
123 124
 
124 125
 		$sql = "SELECT t.rowid";
125 126
 		$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
@@ -130,12 +131,17 @@  discard block
 block discarded – undo
130 131
 		}
131 132
 		$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid";
132 133
 		$sql.= ' WHERE t.entity IN (' . getEntity('socpeople') . ')';
133
-		if ($socids) $sql.= " AND t.fk_soc IN (" . $socids . ")";
134
+		if ($socids) {
135
+		    $sql.= " AND t.fk_soc IN (" . $socids . ")";
136
+		}
134 137
 
135
-		if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0)
136
-			$sql.= " AND t.fk_soc = sc.fk_soc";
137
-		if ($search_sale > 0)
138
-			$sql.= " AND s.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 ($search_sale > 0) {
142
+					$sql.= " AND s.rowid = sc.fk_soc";
143
+		}
144
+		// Join for the needed table to filter by sale
139 145
 		// Insert sale filter
140 146
 		if ($search_sale > 0)
141 147
 		{
@@ -179,8 +185,7 @@  discard block
 block discarded – undo
179 185
 				}
180 186
 				$i++;
181 187
 			}
182
-		}
183
-		else {
188
+		} else {
184 189
 			throw new RestException(503, 'Error when retrieve contacts : ' . $sql);
185 190
 		}
186 191
 		if (!count($obj_ret))
@@ -242,12 +247,15 @@  discard block
 block discarded – undo
242 247
 
243 248
 		foreach ($request_data as $field => $value)
244 249
 		{
245
-            if ($field == 'id') continue;
250
+            if ($field == 'id') {
251
+                continue;
252
+            }
246 253
 		    $this->contact->$field = $value;
247 254
 		}
248 255
 
249
-		if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update'))
250
-			return $this->get($id);
256
+		if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) {
257
+					return $this->get($id);
258
+		}
251 259
 
252 260
 		return false;
253 261
 	}
@@ -293,10 +301,12 @@  discard block
 block discarded – undo
293 301
 	    //throw new RestException(401);
294 302
 	    //}
295 303
 
296
-	    if (!isset($request_data["login"]))
297
-	    				throw new RestException(400, "login field missing");
298
-	    if (!isset($request_data["password"]))
299
-	    				throw new RestException(400, "password field missing");
304
+	    if (!isset($request_data["login"])) {
305
+	    	    				throw new RestException(400, "login field missing");
306
+	    }
307
+	    if (!isset($request_data["password"])) {
308
+	    	    				throw new RestException(400, "password field missing");
309
+	    }
300 310
 
301 311
 	    if (!DolibarrApiAccess::$user->rights->societe->contact->lire) {
302 312
 	        throw new RestException(401, 'No permission to read contacts');
@@ -400,8 +410,9 @@  discard block
 block discarded – undo
400 410
 		$contact = array();
401 411
 		foreach (Contacts::$FIELDS as $field)
402 412
 		{
403
-			if (!isset($data[$field]))
404
-				throw new RestException(400, "$field field missing");
413
+			if (!isset($data[$field])) {
414
+							throw new RestException(400, "$field field missing");
415
+			}
405 416
 			$contact[$field] = $data[$field];
406 417
 		}
407 418
 
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/societeaccount.class.php 1 patch
Braces   +66 added lines, -36 removed lines patch added patch discarded remove patch
@@ -186,7 +186,9 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$this->db = $db;
188 188
 
189
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
189
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
190
+		    $this->fields['rowid']['visible']=0;
191
+		}
190 192
 	}
191 193
 
192 194
 	/**
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
 	public function fetch($id, $ref = null)
261 263
 	{
262 264
 		$result = $this->fetchCommon($id, $ref);
263
-		if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
265
+		if ($result > 0 && ! empty($this->table_element_line)) {
266
+		    $this->fetchLines();
267
+		}
264 268
 		return $result;
265 269
 	}
266 270
 
@@ -352,7 +356,10 @@  discard block
 block discarded – undo
352 356
         global $dolibarr_main_authentication, $dolibarr_main_demo;
353 357
         global $menumanager;
354 358
 
355
-        if (! empty($conf->dol_no_mouse_hover)) $notooltip=1;   // Force disable tooltips
359
+        if (! empty($conf->dol_no_mouse_hover)) {
360
+            $notooltip=1;
361
+        }
362
+        // Force disable tooltips
356 363
 
357 364
         $result = '';
358 365
         $companylink = '';
@@ -370,8 +377,12 @@  discard block
 block discarded – undo
370 377
         {
371 378
 	        // Add param to save lastsearch_values or not
372 379
 	        $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
373
-	        if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
374
-	        if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
380
+	        if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) {
381
+	            $add_save_lastsearch_values=1;
382
+	        }
383
+	        if ($add_save_lastsearch_values) {
384
+	            $url.='&save_lastsearch_values=1';
385
+	        }
375 386
         }
376 387
 
377 388
         $linkclose='';
@@ -384,16 +395,21 @@  discard block
 block discarded – undo
384 395
             }
385 396
             $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
386 397
             $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
398
+        } else {
399
+            $linkclose = ($morecss?' class="'.$morecss.'"':'');
387 400
         }
388
-        else $linkclose = ($morecss?' class="'.$morecss.'"':'');
389 401
 
390 402
 		$linkstart = '<a href="'.$url.'"';
391 403
 		$linkstart.=$linkclose.'>';
392 404
 		$linkend='</a>';
393 405
 
394 406
 		$result .= $linkstart;
395
-		if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
396
-		if ($withpicto != 2) $result.= $this->ref;
407
+		if ($withpicto) {
408
+		    $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
409
+		}
410
+		if ($withpicto != 2) {
411
+		    $result.= $this->ref;
412
+		}
397 413
 		$result .= $linkend;
398 414
 
399 415
 		return $result;
@@ -437,38 +453,53 @@  discard block
 block discarded – undo
437 453
 		if ($mode == 0)
438 454
 		{
439 455
 			$prefix='';
440
-			if ($status == 1) return $langs->trans('Enabled');
441
-			elseif ($status == 0) return $langs->trans('Disabled');
442
-		}
443
-		elseif ($mode == 1)
456
+			if ($status == 1) {
457
+			    return $langs->trans('Enabled');
458
+			} elseif ($status == 0) {
459
+			    return $langs->trans('Disabled');
460
+			}
461
+		} elseif ($mode == 1)
444 462
 		{
445
-			if ($status == 1) return $langs->trans('Enabled');
446
-			elseif ($status == 0) return $langs->trans('Disabled');
447
-		}
448
-		elseif ($mode == 2)
463
+			if ($status == 1) {
464
+			    return $langs->trans('Enabled');
465
+			} elseif ($status == 0) {
466
+			    return $langs->trans('Disabled');
467
+			}
468
+		} elseif ($mode == 2)
449 469
 		{
450
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
451
-			elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
452
-		}
453
-		elseif ($mode == 3)
470
+			if ($status == 1) {
471
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
472
+			} elseif ($status == 0) {
473
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
474
+			}
475
+		} elseif ($mode == 3)
454 476
 		{
455
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
456
-			elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
457
-		}
458
-		elseif ($mode == 4)
477
+			if ($status == 1) {
478
+			    return img_picto($langs->trans('Enabled'),'statut4');
479
+			} elseif ($status == 0) {
480
+			    return img_picto($langs->trans('Disabled'),'statut5');
481
+			}
482
+		} elseif ($mode == 4)
459 483
 		{
460
-			if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
461
-			elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
462
-		}
463
-		elseif ($mode == 5)
484
+			if ($status == 1) {
485
+			    return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
486
+			} elseif ($status == 0) {
487
+			    return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
488
+			}
489
+		} elseif ($mode == 5)
464 490
 		{
465
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
466
-			elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
467
-		}
468
-		elseif ($mode == 6)
491
+			if ($status == 1) {
492
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
493
+			} elseif ($status == 0) {
494
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
495
+			}
496
+		} elseif ($mode == 6)
469 497
 		{
470
-			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
471
-			elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
498
+			if ($status == 1) {
499
+			    return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
500
+			} elseif ($status == 0) {
501
+			    return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
502
+			}
472 503
 		}
473 504
 	}
474 505
 
@@ -518,8 +549,7 @@  discard block
 block discarded – undo
518 549
 			}
519 550
 
520 551
 			$this->db->free($result);
521
-		}
522
-		else
552
+		} else
523 553
 		{
524 554
 			dol_print_error($this->db);
525 555
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/class/client.class.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,13 +78,16 @@  discard block
 block discarded – undo
78 78
         {
79 79
             while ($obj=$this->db->fetch_object($resql))
80 80
             {
81
-                if ($obj->client == 1 || $obj->client == 3) $this->nb["customers"]+=$obj->nb;
82
-                if ($obj->client == 2 || $obj->client == 3) $this->nb["prospects"]+=$obj->nb;
81
+                if ($obj->client == 1 || $obj->client == 3) {
82
+                    $this->nb["customers"]+=$obj->nb;
83
+                }
84
+                if ($obj->client == 2 || $obj->client == 3) {
85
+                    $this->nb["prospects"]+=$obj->nb;
86
+                }
83 87
             }
84 88
             $this->db->free($resql);
85 89
             return 1;
86
-        }
87
-        else
90
+        } else
88 91
         {
89 92
             dol_print_error($this->db);
90 93
             $this->error=$this->db->lasterror();
@@ -103,7 +106,9 @@  discard block
 block discarded – undo
103 106
     	global $langs;
104 107
 
105 108
    		$sql="SELECT id, code, libelle as label FROM ".MAIN_DB_PREFIX."c_stcomm";
106
-   		if ($active >= 0) $sql.=" WHERE active = ".$active;
109
+   		if ($active >= 0) {
110
+   		    $sql.=" WHERE active = ".$active;
111
+   		}
107 112
 		$resql=$this->db->query($sql);
108 113
 		$num=$this->db->num_rows($resql);
109 114
 		$i=0;
Please login to merge, or discard this patch.