Passed
Push — master ( 49af33...3cffbe )
by Alxarafe
21:21
created
dolibarr/htdocs/core/lib/invoice2.lib.php 1 patch
Braces   +104 added lines, -46 removed lines patch added patch discarded remove patch
@@ -60,8 +60,11 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 	if (in_array('date',$filter))
62 62
 	{
63
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
64
-		else $sqlwhere.=" AND";
63
+		if (empty($sqlwhere)) {
64
+		    $sqlwhere=' WHERE ';
65
+		} else {
66
+		    $sqlwhere.=" AND";
67
+		}
65 68
 		$sqlwhere.= " f.fk_statut > 0";
66 69
 		$sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'";
67 70
 		$sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'";
@@ -70,17 +73,25 @@  discard block
 block discarded – undo
70 73
 	if (in_array('nopayment',$filter))
71 74
 	{
72 75
 		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
73
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
74
-		else $sqlwhere.=" AND";
76
+		if (empty($sqlwhere)) {
77
+		    $sqlwhere=' WHERE ';
78
+		} else {
79
+		    $sqlwhere.=" AND";
80
+		}
75 81
 		$sqlwhere.= " f.fk_statut > 0";
76 82
 		$sqlwhere.= " AND pf.fk_paiement IS NULL";
77 83
 	}
78 84
 	if (in_array('payments',$filter) || in_array('bank',$filter))
79 85
 	{
80 86
 		$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
81
-		if (in_array('bank',$filter)) $sql.= ", ".MAIN_DB_PREFIX."bank as b";
82
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
83
-		else $sqlwhere.=" AND";
87
+		if (in_array('bank',$filter)) {
88
+		    $sql.= ", ".MAIN_DB_PREFIX."bank as b";
89
+		}
90
+		if (empty($sqlwhere)) {
91
+		    $sqlwhere=' WHERE ';
92
+		} else {
93
+		    $sqlwhere.=" AND";
94
+		}
84 95
 		$sqlwhere.= " f.fk_statut > 0";
85 96
 		$sqlwhere.= " AND f.rowid = pf.fk_facture";
86 97
 		$sqlwhere.= " AND pf.fk_paiement = p.rowid";
@@ -98,41 +109,62 @@  discard block
 block discarded – undo
98 109
 	}
99 110
 	if (in_array('nodeposit',$filter))
100 111
 	{
101
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
102
-	    else $sqlwhere.=" AND";
112
+	    if (empty($sqlwhere)) {
113
+	        $sqlwhere=' WHERE ';
114
+	    } else {
115
+	        $sqlwhere.=" AND";
116
+	    }
103 117
 	    $sqlwhere.=' type <> 3';
104 118
 	}
105 119
 	if (in_array('noreplacement',$filter))
106 120
 	{
107
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
108
-	    else $sqlwhere.=" AND";
121
+	    if (empty($sqlwhere)) {
122
+	        $sqlwhere=' WHERE ';
123
+	    } else {
124
+	        $sqlwhere.=" AND";
125
+	    }
109 126
 	    $sqlwhere.=' type <> 1';
110 127
 	}
111 128
 	if (in_array('nocreditnote',$filter))
112 129
 	{
113
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
114
-	    else $sqlwhere.=" AND";
130
+	    if (empty($sqlwhere)) {
131
+	        $sqlwhere=' WHERE ';
132
+	    } else {
133
+	        $sqlwhere.=" AND";
134
+	    }
115 135
 	    $sqlwhere.=' type <> 2';
116 136
 	}
117 137
 	if (in_array('excludethirdparties',$filter) && is_array($thirdpartiesid))
118 138
 	{
119
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
120
-	    else $sqlwhere.=" AND";
139
+	    if (empty($sqlwhere)) {
140
+	        $sqlwhere=' WHERE ';
141
+	    } else {
142
+	        $sqlwhere.=" AND";
143
+	    }
121 144
 	    $sqlwhere.=' f.fk_soc NOT IN ('.join(',',$thirdpartiesid).')';
122 145
 	}
123 146
 	if (in_array('onlythirdparties',$filter) && is_array($thirdpartiesid))
124 147
 	{
125
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
126
-	    else $sqlwhere.=" AND";
148
+	    if (empty($sqlwhere)) {
149
+	        $sqlwhere=' WHERE ';
150
+	    } else {
151
+	        $sqlwhere.=" AND";
152
+	    }
127 153
 	    $sqlwhere.=' f.fk_soc IN ('.join(',',$thirdpartiesid).')';
128 154
 	}
129
-	if ($sqlwhere) $sql.=$sqlwhere;
130
-	if ($sqlorder) $sql.=$sqlorder;
155
+	if ($sqlwhere) {
156
+	    $sql.=$sqlwhere;
157
+	}
158
+	if ($sqlorder) {
159
+	    $sql.=$sqlorder;
160
+	}
131 161
 
132 162
 	//print $sql; exit;
133 163
 	dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
134 164
 
135
-	if ($usestdout) print '--- start'."\n";
165
+	if ($usestdout) {
166
+	    print '--- start'."\n";
167
+	}
136 168
 
137 169
 	// Start of transaction
138 170
 	//$db->begin();
@@ -175,11 +207,14 @@  discard block
 block discarded – undo
175 207
 					$filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
176 208
 					if ($regenerate || ! dol_is_file($filename))
177 209
 					{
178
-	            	    if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
210
+	            	    if ($usestdout) {
211
+	            	        print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
212
+	            	    }
179 213
 	    				$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
180
-					}
181
-					else {
182
-					    if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
214
+					} else {
215
+					    if ($usestdout) {
216
+					        print "PDF for invoice ".$obj->ref." already exists\n";
217
+					    }
183 218
 					}
184 219
 
185 220
 					// Add file into files array
@@ -189,8 +224,11 @@  discard block
 block discarded – undo
189 224
 				if ($result <= 0)
190 225
 				{
191 226
 					$error++;
192
-					if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
193
-					else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
227
+					if ($usestdout) {
228
+					    print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
229
+					} else {
230
+					    dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
231
+					}
194 232
 				}
195 233
 
196 234
 	            $cpt++;
@@ -203,8 +241,11 @@  discard block
 block discarded – undo
203 241
 	        $page_hauteur = $formatarray['height'];
204 242
 	        $format = array($page_largeur,$page_hauteur);
205 243
 
206
-	        if ($usestdout) print "Using output PDF format ".join('x',$format)."\n";
207
-	        else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR);
244
+	        if ($usestdout) {
245
+	            print "Using output PDF format ".join('x',$format)."\n";
246
+	        } else {
247
+	            dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR);
248
+	        }
208 249
 
209 250
 
210 251
 	        // Now, build a merged files with all files in $files array
@@ -219,14 +260,19 @@  discard block
 block discarded – undo
219 260
 	        }
220 261
 	        $pdf->SetFont(pdf_getPDFFont($langs));
221 262
 
222
-	        if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
263
+	        if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
264
+	            $pdf->SetCompression(false);
265
+	        }
223 266
 			//$pdf->SetCompression(false);
224 267
 
225 268
 			// Add all others
226 269
 			foreach($files as $file)
227 270
 			{
228
-	            if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
229
-	            else dol_syslog("Merge PDF file for invoice ".$file);
271
+	            if ($usestdout) {
272
+	                print "Merge PDF file for invoice ".$file."\n";
273
+	            } else {
274
+	                dol_syslog("Merge PDF file for invoice ".$file);
275
+	            }
230 276
 
231 277
 				// Charge un document PDF depuis un fichier.
232 278
 				$pagecount = $pdf->setSourceFile($file);
@@ -244,40 +290,52 @@  discard block
 block discarded – undo
244 290
 
245 291
 			// Save merged file
246 292
 			$filename=$fileprefix;
247
-			if (empty($filename)) $filename='mergedpdf';
248
-			if (! empty($filesuffix)) $filename.='_'.$filesuffix;
293
+			if (empty($filename)) {
294
+			    $filename='mergedpdf';
295
+			}
296
+			if (! empty($filesuffix)) {
297
+			    $filename.='_'.$filesuffix;
298
+			}
249 299
 			$file=$diroutputpdf.'/'.$filename.'.pdf';
250 300
 
251 301
 			if (! $error && $pagecount)
252 302
 			{
253 303
 				$pdf->Output($file,'F');
254
-				if (! empty($conf->global->MAIN_UMASK))
255
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
304
+				if (! empty($conf->global->MAIN_UMASK)) {
305
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
306
+				}
256 307
 			}
257 308
 
258 309
 			if ($usestdout)
259 310
 			{
260
-				if (! $error) print "Merged PDF has been built in ".$file."\n";
261
-				else print "Can't build PDF ".$file."\n";
311
+				if (! $error) {
312
+				    print "Merged PDF has been built in ".$file."\n";
313
+				} else {
314
+				    print "Can't build PDF ".$file."\n";
315
+				}
262 316
 			}
263 317
 
264 318
 			$result = 1;
265
-	    }
266
-	    else
319
+	    } else
267 320
 	    {
268
-	        if ($usestdout) print "No invoices found for criteria.\n";
269
-	        else dol_syslog("No invoices found for criteria");
321
+	        if ($usestdout) {
322
+	            print "No invoices found for criteria.\n";
323
+	        } else {
324
+	            dol_syslog("No invoices found for criteria");
325
+	        }
270 326
 	        $result = 0;
271 327
 	    }
272
-	}
273
-	else
328
+	} else
274 329
 	{
275 330
 	    dol_print_error($db);
276 331
 	    dol_syslog("scripts/invoices/rebuild_merge.php: Error");
277 332
 	    $error++;
278 333
 	}
279 334
 
280
-	if ($error) return -1;
281
-	else return $result;
282
-}
335
+	if ($error) {
336
+	    return -1;
337
+	} else {
338
+	    return $result;
339
+	}
340
+	}
283 341
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/prelevement.lib.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,9 +78,15 @@
 block discarded – undo
78 78
 function prelevement_check_config()
79 79
 {
80 80
 	global $conf;
81
-	if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
82
-	if(empty($conf->global->PRELEVEMENT_ICS)) return -1;
83
-    if(empty($conf->global->PRELEVEMENT_USER)) return -1;
81
+	if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) {
82
+	    return -1;
83
+	}
84
+	if(empty($conf->global->PRELEVEMENT_ICS)) {
85
+	    return -1;
86
+	}
87
+    if(empty($conf->global->PRELEVEMENT_USER)) {
88
+        return -1;
89
+    }
84 90
 	return 0;
85 91
 }
86 92
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/barcode.lib.php 1 patch
Braces   +87 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,11 +35,17 @@  discard block
 block discarded – undo
35 35
 /* ******************************************************************** */
36 36
 /*                          FONT FILE                                   */
37 37
 /* ******************************************************************** */
38
-if (defined('DOL_DEFAULT_TTF_BOLD')) $font_loc=constant('DOL_DEFAULT_TTF_BOLD');
38
+if (defined('DOL_DEFAULT_TTF_BOLD')) {
39
+    $font_loc=constant('DOL_DEFAULT_TTF_BOLD');
40
+}
39 41
 // Automatic-Detection of Font if running Windows
40 42
 // @CHANGE LDR
41
-if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) $font_loc=$_SERVER['WINDIR'].'\Fonts\arialbd.ttf';
42
-if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path to a TTF font.');
43
+if (isset($_SERVER['WINDIR']) && @file_exists($_SERVER['WINDIR'])) {
44
+    $font_loc=$_SERVER['WINDIR'].'\Fonts\arialbd.ttf';
45
+}
46
+if (empty($font_loc)) {
47
+    die('DOL_DEFAULT_TTF_BOLD must de defined with full path to a TTF font.');
48
+}
43 49
 
44 50
 
45 51
 /* ******************************************************************** */
@@ -50,8 +56,11 @@  discard block
 block discarded – undo
50 56
 * genbarcode is needed to render encodings other than EAN-12/EAN-13/ISBN
51 57
 */
52 58
 
53
-if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND');
54
-else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
59
+if (defined('PHP-BARCODE_PATH_COMMAND')) {
60
+    $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND');
61
+} else {
62
+    $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
63
+}
55 64
 
56 65
 
57 66
 
@@ -73,12 +82,17 @@  discard block
 block discarded – undo
73 82
     if (! $bars || ! empty($bars['error']))
74 83
     {
75 84
         // Return error message instead of array
76
-        if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding;
77
-        else $error=$bars['error'];
85
+        if (empty($bars['error'])) {
86
+            $error='Bad Value '.$code.' for encoding '.$encoding;
87
+        } else {
88
+            $error=$bars['error'];
89
+        }
78 90
         dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR);
79 91
         return $error;
80 92
     }
81
-    if (! $mode) $mode="png";
93
+    if (! $mode) {
94
+        $mode="png";
95
+    }
82 96
     //if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']);
83 97
     //elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0);
84 98
     //else
@@ -127,14 +141,14 @@  discard block
 block discarded – undo
127 141
         /* use built-in EAN-Encoder */
128 142
         dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean");
129 143
         $bars=barcode_encode_ean($code, $encoding);
130
-    }
131
-    else if (file_exists($genbarcode_loc))	// For example C39
144
+    } else if (file_exists($genbarcode_loc)) {
145
+        // For example C39
132 146
     {
133 147
         /* use genbarcode */
134 148
         dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
135
-        $bars=barcode_encode_genbarcode($code, $encoding);
136 149
     }
137
-    else
150
+        $bars=barcode_encode_genbarcode($code, $encoding);
151
+    } else
138 152
     {
139 153
         print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")<BR>\n";
140 154
         print "<UL>\n";
@@ -164,7 +178,11 @@  discard block
 block discarded – undo
164 178
     $ln=strlen($ean)-1;
165 179
     for ($i=$ln; $i>=0; $i--)
166 180
     {
167
-        if ($even) $esum+=$ean[$i];	else $osum+=$ean[$i];
181
+        if ($even) {
182
+            $esum+=$ean[$i];
183
+        } else {
184
+            $osum+=$ean[$i];
185
+        }
168 186
         $even=!$even;
169 187
     }
170 188
     return (10-((3*$esum+$osum)%10))%10;
@@ -191,9 +209,13 @@  discard block
 block discarded – undo
191 209
     $encoding=strtoupper($encoding);
192 210
     if ($encoding=="ISBN")
193 211
     {
194
-        if (!preg_match("/^978/", $ean)) $ean="978".$ean;
212
+        if (!preg_match("/^978/", $ean)) {
213
+            $ean="978".$ean;
214
+        }
215
+    }
216
+    if (preg_match("/^978/", $ean)) {
217
+        $encoding="ISBN";
195 218
     }
196
-    if (preg_match("/^978/", $ean)) $encoding="ISBN";
197 219
     if (strlen($ean)<12 || strlen($ean)>13)
198 220
     {
199 221
         return array("error"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)", "text"=>"Invalid encoding/code. encoding=".$encoding." code=".$ean." (must have 12/13 numbers)");
@@ -206,8 +228,14 @@  discard block
 block discarded – undo
206 228
     for ($i=1;$i<13;$i++)
207 229
     {
208 230
         $str=$digits[$ean[$i]];
209
-        if ($i<7 && $mirror[$ean[0]][$i-1]==1) $line.=strrev($str); else $line.=$str;
210
-        if ($i==6) $line.=$guards[1];
231
+        if ($i<7 && $mirror[$ean[0]][$i-1]==1) {
232
+            $line.=strrev($str);
233
+        } else {
234
+            $line.=$str;
235
+        }
236
+        if ($i==6) {
237
+            $line.=$guards[1];
238
+        }
211 239
     }
212 240
     $line.=$guards[2];
213 241
 
@@ -216,11 +244,17 @@  discard block
 block discarded – undo
216 244
     $text="";
217 245
     for ($a=0;$a<13;$a++)
218 246
     {
219
-        if ($a>0) $text.=" ";
247
+        if ($a>0) {
248
+            $text.=" ";
249
+        }
220 250
         $text.="$pos:12:{$ean[$a]}";
221
-        if ($a==0) $pos+=12;
222
-        else if ($a==6) $pos+=12;
223
-        else $pos+=7;
251
+        if ($a==0) {
252
+            $pos+=12;
253
+        } else if ($a==6) {
254
+            $pos+=12;
255
+        } else {
256
+            $pos+=7;
257
+        }
224 258
     }
225 259
 
226 260
     return array(
@@ -243,8 +277,12 @@  discard block
 block discarded – undo
243 277
     global $genbarcode_loc;
244 278
 
245 279
     // Clean parameters
246
-    if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12);
247
-    if (!$encoding) $encoding="ANY";
280
+    if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) {
281
+        $code=substr($code,0,12);
282
+    }
283
+    if (!$encoding) {
284
+        $encoding="ANY";
285
+    }
248 286
     $encoding=preg_replace("/[\\\|]/", "_", $encoding);
249 287
     $code=preg_replace("/[\\\|]/", "_", $code);
250 288
 
@@ -263,8 +301,7 @@  discard block
 block discarded – undo
263 301
         $text=fgets($fp, 1024);
264 302
         $encoding=fgets($fp, 1024);
265 303
         pclose($fp);
266
-    }
267
-    else
304
+    } else
268 305
     {
269 306
         dol_syslog("barcode.lib.php::barcode_encode_genbarcode failed to run popen ".$fullcommandclear, LOG_ERR);
270 307
         return false;
@@ -282,9 +319,15 @@  discard block
 block discarded – undo
282 319
     	$ret['error']=$ret['bars']; $ret['bars']='';
283 320
     	return $ret;
284 321
     }
285
-    if (!$ret['bars']) return false;
286
-    if (!$ret['text']) return false;
287
-    if (!$ret['encoding']) return false;
322
+    if (!$ret['bars']) {
323
+        return false;
324
+    }
325
+    if (!$ret['text']) {
326
+        return false;
327
+    }
328
+    if (!$ret['encoding']) {
329
+        return false;
330
+    }
288 331
     return $ret;
289 332
 }
290 333
 
@@ -310,11 +353,16 @@  discard block
 block discarded – undo
310 353
     //var_dump($font_loc);
311 354
 
312 355
     /* set defaults */
313
-    if ($scale<1) $scale=2;
356
+    if ($scale<1) {
357
+        $scale=2;
358
+    }
314 359
     $total_y=(int) $total_y;
315
-    if ($total_y<1) $total_y=(int) $scale * 60;
316
-    if (!$space)
317
-    $space=array('top'=>2*$scale,'bottom'=>2*$scale,'left'=>2*$scale,'right'=>2*$scale);
360
+    if ($total_y<1) {
361
+        $total_y=(int) $scale * 60;
362
+    }
363
+    if (!$space) {
364
+        $space=array('top'=>2*$scale,'bottom'=>2*$scale,'left'=>2*$scale,'right'=>2*$scale);
365
+    }
318 366
 
319 367
     /* count total width */
320 368
     $xpos=0;
@@ -371,7 +419,9 @@  discard block
 block discarded – undo
371 419
             /* tall bar */
372 420
             $val=ord($val)-ord('a')+1;
373 421
             $h=$height2;
374
-        } else $h=$height;
422
+        } else {
423
+            $h=$height;
424
+        }
375 425
         imagefilledrectangle($im, $xpos, $space['top'], $xpos+($val*$scale)-1, $h, $col_bar);
376 426
         $xpos+=$val*$scale;
377 427
         $width=true;
@@ -396,17 +446,16 @@  discard block
 block discarded – undo
396 446
     {
397 447
         header("Content-Type: image/jpeg; name=\"barcode.jpg\"");
398 448
         imagejpeg($im);
399
-    }
400
-    else if ($mode=='gif')
449
+    } else if ($mode=='gif')
401 450
     {
402 451
         header("Content-Type: image/gif; name=\"barcode.gif\"");
403 452
         imagegif($im);
404
-    }
405
-    else if (! empty($filebarcode))    // To wxrite into  afile onto disk
453
+    } else if (! empty($filebarcode)) {
454
+        // To wxrite into  afile onto disk
406 455
     {
407 456
         imagepng($im,$filebarcode);
408 457
     }
409
-    else
458
+    } else
410 459
     {
411 460
         header("Content-Type: image/png; name=\"barcode.png\"");
412 461
         imagepng($im);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/accounting.lib.php 1 patch
Braces   +45 added lines, -16 removed lines patch added patch discarded remove patch
@@ -75,9 +75,13 @@  discard block
 block discarded – undo
75 75
 {
76 76
 	global $conf;
77 77
 
78
-	if ($account < 0 || empty($account)) return '';
78
+	if ($account < 0 || empty($account)) {
79
+	    return '';
80
+	}
79 81
 
80
-	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
82
+	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
83
+	    return $account;
84
+	}
81 85
 
82 86
 	$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
83 87
 	if (! empty($g)) {
@@ -110,9 +114,13 @@  discard block
 block discarded – undo
110 114
 {
111 115
 	global $conf, $langs;
112 116
 
113
-	if ($accounta < 0 || empty($accounta)) return '';
117
+	if ($accounta < 0 || empty($accounta)) {
118
+	    return '';
119
+	}
114 120
 
115
-	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
121
+	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
122
+	    return $accounta;
123
+	}
116 124
 
117 125
 	$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
118 126
 	if (! empty($a)) {
@@ -156,11 +164,15 @@  discard block
 block discarded – undo
156 164
 {
157 165
     global $langs;
158 166
 
159
-    if (empty($hselected)) $hselected='report';
167
+    if (empty($hselected)) {
168
+        $hselected='report';
169
+    }
160 170
 
161 171
     print "\n\n<!-- debut cartouche journal -->\n";
162 172
 
163
-    if(! empty($varlink)) $varlink = '?'.$varlink;
173
+    if(! empty($varlink)) {
174
+        $varlink = '?'.$varlink;
175
+    }
164 176
 
165 177
     $h=0;
166 178
     $head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
@@ -180,10 +192,15 @@  discard block
 block discarded – undo
180 192
     // Ligne de titre
181 193
     print '<tr>';
182 194
     print '<td width="110">'.$langs->trans("Name").'</td>';
183
-    if (! $variantexxx) print '<td colspan="3">';
184
-    else print '<td>';
195
+    if (! $variantexxx) {
196
+        print '<td colspan="3">';
197
+    } else {
198
+        print '<td>';
199
+    }
185 200
     print $nom;
186
-    if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
201
+    if ($variantexxx) {
202
+        print '</td><td colspan="2">'.$variantexxx;
203
+    }
187 204
     print '</td>';
188 205
     print '</tr>';
189 206
 
@@ -192,10 +209,15 @@  discard block
 block discarded – undo
192 209
     {
193 210
         print '<tr>';
194 211
         print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
195
-        if (! $variante) print '<td colspan="3">';
196
-        else print '<td>';
212
+        if (! $variante) {
213
+            print '<td colspan="3">';
214
+        } else {
215
+            print '<td>';
216
+        }
197 217
         print $calcmode;
198
-        if ($variante) print '</td><td colspan="2">'.$variante;
218
+        if ($variante) {
219
+            print '</td><td colspan="2">'.$variante;
220
+        }
199 221
         print '</td>';
200 222
         print '</tr>';
201 223
     }
@@ -203,10 +225,17 @@  discard block
 block discarded – undo
203 225
     // Ligne de la periode d'analyse du rapport
204 226
     print '<tr>';
205 227
     print '<td>'.$langs->trans("ReportPeriod").'</td>';
206
-    if (! $periodlink) print '<td colspan="3">';
207
-    else print '<td>';
208
-    if ($period) print $period;
209
-    if ($periodlink) print '</td><td colspan="2">'.$periodlink;
228
+    if (! $periodlink) {
229
+        print '<td colspan="3">';
230
+    } else {
231
+        print '<td>';
232
+    }
233
+    if ($period) {
234
+        print $period;
235
+    }
236
+    if ($periodlink) {
237
+        print '</td><td colspan="2">'.$periodlink;
238
+    }
210 239
     print '</td>';
211 240
     print '</tr>';
212 241
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/resource.lib.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
46 46
 	    $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
47 47
 		$head[$h][1] = $langs->trans('ContactsAddresses');
48
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
48
+		if ($nbContact > 0) {
49
+		    $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
50
+		}
49 51
 		$head[$h][2] = 'contact';
50 52
 		$h++;
51 53
 	}
@@ -59,11 +61,17 @@  discard block
 block discarded – undo
59 61
 	if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
60 62
 	{
61 63
 		$nbNote = 0;
62
-		if(!empty($object->note_private)) $nbNote++;
63
-		if(!empty($object->note_public)) $nbNote++;
64
+		if(!empty($object->note_private)) {
65
+		    $nbNote++;
66
+		}
67
+		if(!empty($object->note_public)) {
68
+		    $nbNote++;
69
+		}
64 70
 		$head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
65 71
 		$head[$h][1] = $langs->trans('Notes');
66
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
72
+		if ($nbNote > 0) {
73
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
74
+		}
67 75
 		$head[$h][2] = 'note';
68 76
 		$h++;
69 77
 	}
@@ -73,7 +81,9 @@  discard block
 block discarded – undo
73 81
 	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
74 82
 	$head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
75 83
 	$head[$h][1] = $langs->trans("Documents");
76
-	if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
84
+	if($nbFiles > 0) {
85
+	    $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
86
+	}
77 87
 	$head[$h][2] = 'documents';
78 88
 	$h++;
79 89
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/ws.lib.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
         {
59 59
             $error++;
60 60
             $errorcode='ERROR_FETCH_USER'; $errorlabel='A technical error occurred during fetch of user';
61
-        }
62
-        else if ($result == 0)
61
+        } else if ($result == 0)
63 62
         {
64 63
             $error++;
65 64
             $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
@@ -77,9 +76,13 @@  discard block
 block discarded – undo
77 76
 			$fuser->getrights();	// Load permission of user
78 77
 
79 78
         	// Authentication mode
80
-        	if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
79
+        	if (empty($dolibarr_main_authentication)) {
80
+        	    $dolibarr_main_authentication='http,dolibarr';
81
+        	}
81 82
         	// Authentication mode: forceuser
82
-        	if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
83
+        	if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
84
+        	    $dolibarr_auto_user='auto';
85
+        	}
83 86
         	// Set authmode
84 87
         	$authmode=explode(',',$dolibarr_main_authentication);
85 88
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/fichinter.lib.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@  discard block
 block discarded – undo
51 51
 	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
52 52
 	    $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
53 53
 		$head[$h][1] = $langs->trans('InterventionContact');
54
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
54
+		if ($nbContact > 0) {
55
+		    $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
56
+		}
55 57
 		$head[$h][2] = 'contact';
56 58
 		$h++;
57 59
 	}
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
    		$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
84 86
 		$head[$h][1] = $langs->trans("Resources");
85
-		if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
87
+		if ($nbResource > 0) {
88
+		    $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
89
+		}
86 90
 		$head[$h][2] = 'resource';
87 91
 		$h++;
88 92
 	}
@@ -90,11 +94,17 @@  discard block
 block discarded – undo
90 94
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
91 95
     {
92 96
     	$nbNote = 0;
93
-        if(!empty($object->note_private)) $nbNote++;
94
-		if(!empty($object->note_public)) $nbNote++;
97
+        if(!empty($object->note_private)) {
98
+            $nbNote++;
99
+        }
100
+		if(!empty($object->note_public)) {
101
+		    $nbNote++;
102
+		}
95 103
     	$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
96 104
     	$head[$h][1] = $langs->trans('Notes');
97
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
105
+		if ($nbNote > 0) {
106
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
107
+		}
98 108
     	$head[$h][2] = 'note';
99 109
     	$h++;
100 110
     }
@@ -106,7 +116,9 @@  discard block
 block discarded – undo
106 116
     $nbLinks=Link::count($db, $object->element, $object->id);
107 117
 	$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
108 118
 	$head[$h][1] = $langs->trans("Documents");
109
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
119
+	if (($nbFiles+$nbLinks) > 0) {
120
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
121
+	}
110 122
 	$head[$h][2] = 'documents';
111 123
 	$h++;
112 124
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/emailing.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@
 block discarded – undo
43 43
 	{
44 44
     	$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
45 45
     	$head[$h][1] = $langs->trans("MailRecipients");
46
-		if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
46
+		if ($object->nbemail > 0) {
47
+		    $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
48
+		}
47 49
     	$head[$h][2] = 'targets';
48 50
     	$h++;
49 51
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/order.lib.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 function commande_prepare_head(Commande $object)
35 35
 {
36 36
 	global $db, $langs, $conf, $user;
37
-	if (! empty($conf->expedition->enabled)) $langs->load("sendings");
37
+	if (! empty($conf->expedition->enabled)) {
38
+	    $langs->load("sendings");
39
+	}
38 40
 	$langs->load("orders");
39 41
 
40 42
 	$h = 0;
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
54 56
 	    $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
55 57
 		$head[$h][1] = $langs->trans('ContactsAddresses');
56
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
58
+		if ($nbContact > 0) {
59
+		    $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
60
+		}
57 61
 		$head[$h][2] = 'contact';
58 62
 		$h++;
59 63
 	}
@@ -64,13 +68,27 @@  discard block
 block discarded – undo
64 68
 		$nbShipments=$object->getNbOfShipments(); $nbReceiption=0;
65 69
 		$head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
66 70
 		$text='';
67
-		if ($conf->expedition_bon->enabled) $text.=$langs->trans("Shipments");
68
-		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
69
-		if ($conf->livraison_bon->enabled)  $text.=$langs->trans("Receivings");
70
-		if ($nbShipments > 0 || $nbReceiption > 0) $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0);
71
-		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
72
-		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text.= ($nbReceiption?$nbReceiption:0);
73
-		if ($nbShipments > 0 || $nbReceiption > 0) $text.= '</span>';
71
+		if ($conf->expedition_bon->enabled) {
72
+		    $text.=$langs->trans("Shipments");
73
+		}
74
+		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) {
75
+		    $text.='/';
76
+		}
77
+		if ($conf->livraison_bon->enabled) {
78
+		    $text.=$langs->trans("Receivings");
79
+		}
80
+		if ($nbShipments > 0 || $nbReceiption > 0) {
81
+		    $text.= ' <span class="badge">'.($nbShipments?$nbShipments:0);
82
+		}
83
+		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) {
84
+		    $text.='/';
85
+		}
86
+		if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) {
87
+		    $text.= ($nbReceiption?$nbReceiption:0);
88
+		}
89
+		if ($nbShipments > 0 || $nbReceiption > 0) {
90
+		    $text.= '</span>';
91
+		}
74 92
 		$head[$h][1] = $text;
75 93
 		$head[$h][2] = 'shipping';
76 94
 		$h++;
@@ -85,11 +103,17 @@  discard block
 block discarded – undo
85 103
 	if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
86 104
 	{
87 105
 		$nbNote = 0;
88
-        if(!empty($object->note_private)) $nbNote++;
89
-		if(!empty($object->note_public)) $nbNote++;
106
+        if(!empty($object->note_private)) {
107
+            $nbNote++;
108
+        }
109
+		if(!empty($object->note_public)) {
110
+		    $nbNote++;
111
+		}
90 112
 		$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
91 113
 		$head[$h][1] = $langs->trans('Notes');
92
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
114
+		if ($nbNote > 0) {
115
+		    $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
116
+		}
93 117
 		$head[$h][2] = 'note';
94 118
 		$h++;
95 119
 	}
@@ -101,7 +125,9 @@  discard block
 block discarded – undo
101 125
     $nbLinks=Link::count($db, $object->element, $object->id);
102 126
 	$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
103 127
 	$head[$h][1] = $langs->trans('Documents');
104
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
128
+	if (($nbFiles+$nbLinks) > 0) {
129
+	    $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
130
+	}
105 131
 	$head[$h][2] = 'documents';
106 132
 	$h++;
107 133
 
Please login to merge, or discard this patch.