Test Failed
Push — master ( 2c8b6d...9d1fea )
by Alxarafe
45:51
created
dolibarr/dev/examples/code/create_invoice.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 {
86 86
 	// Change status to validated
87 87
 	$result=$obj->validate($user);
88
-	if ($result > 0) print "OK Object created with id ".$idobject."\n";
89
-	else
88
+	if ($result > 0) {
89
+	    print "OK Object created with id ".$idobject."\n";
90
+	} else
90 91
 	{
91 92
 		$error++;
92 93
 		dol_print_error($db,$obj->error);
93 94
 	}
94
-}
95
-else
95
+} else
96 96
 {
97 97
 	$error++;
98 98
 	dol_print_error($db,$obj->error);
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
 {
106 106
 	$db->commit();
107 107
 	print '--- end ok'."\n";
108
-}
109
-else
108
+} else
110 109
 {
111 110
 	print '--- end error code='.$error."\n";
112 111
 	$db->rollback();
Please login to merge, or discard this patch.
dolibarr/dev/examples/code/create_user.php 1 patch
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,18 +73,17 @@  discard block
 block discarded – undo
73 73
 {
74 74
 	// Change status to validated
75 75
 	$result=$obj->setStatut(1);
76
-	if ($result > 0) print "OK Object created with id ".$idobject."\n";
77
-	else
76
+	if ($result > 0) {
77
+	    print "OK Object created with id ".$idobject."\n";
78
+	} else
78 79
 	{
79 80
 		$error++;
80 81
 		dol_print_error($db,$obj->error);
81 82
 	}
82
-}
83
-else if ($obj->error == 'ErrorLoginAlreadyExists')
83
+} else if ($obj->error == 'ErrorLoginAlreadyExists')
84 84
 {
85 85
      print "User with login ".$obj->login." already exists\n";
86
-}
87
-else
86
+} else
88 87
 {
89 88
 	$error++;
90 89
 	dol_print_error($db,$obj->error);
@@ -97,8 +96,7 @@  discard block
 block discarded – undo
97 96
 {
98 97
 	$db->commit();
99 98
 	print '--- end ok'."\n";
100
-}
101
-else
99
+} else
102 100
 {
103 101
 	print '--- end error code='.$error."\n";
104 102
 	$db->rollback();
Please login to merge, or discard this patch.
dolibarr/dev/examples/code/create_order.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 {
84 84
 	// Change status to validated
85 85
 	$result=$com->valid($user);
86
-	if ($result > 0) print "OK Object created with id ".$idobject."\n";
87
-	else
86
+	if ($result > 0) {
87
+	    print "OK Object created with id ".$idobject."\n";
88
+	} else
88 89
 	{
89 90
 		$error++;
90 91
 		dol_print_error($db,$com->error);
91 92
 	}
92
-}
93
-else
93
+} else
94 94
 {
95 95
 	$error++;
96 96
 	dol_print_error($db,$com->error);
@@ -103,8 +103,7 @@  discard block
 block discarded – undo
103 103
 {
104 104
 	$db->commit();
105 105
 	print '--- end ok'."\n";
106
-}
107
-else
106
+} else
108 107
 {
109 108
 	print '--- end error code='.$error."\n";
110 109
 	$db->rollback();
Please login to merge, or discard this patch.
dolibarr/dev/examples/code/create_product.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
 if ($idobject > 0)
83 83
 {
84 84
 	print "OK Object created with id ".$idobject."\n";
85
-}
86
-else
85
+} else
87 86
 {
88 87
 	$error++;
89 88
 	dol_print_error($db,$myproduct->error);
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
 {
96 95
 	$db->commit();
97 96
 	print '--- end ok'."\n";
98
-}
99
-else
97
+} else
100 98
 {
101 99
 	print '--- end error code='.$error."\n";
102 100
 	$db->rollback();
Please login to merge, or discard this patch.
dolibarr/dev/translation/strip_language_file.php 1 patch
Braces   +7 added lines, -11 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
 		$dir->next();
88 88
 	}
89 89
 	$filesToProcess=$files;
90
+} else {
91
+    $filesToProcess=explode(',',$filesToProcess);
90 92
 }
91
-else $filesToProcess=explode(',',$filesToProcess);
92 93
 
93 94
 // Arguments should be OK here.
94 95
 
@@ -173,8 +174,7 @@  discard block
 block discarded – undo
173 174
 			exit($rc);
174 175
 		}
175 176
 		fclose($handle);
176
-	}
177
-	else {
177
+	} else {
178 178
 		$rc = 6;
179 179
 		$msg = "Cannot open file $lSecondaryFile";
180 180
 		print $msg . " (rc=$rc).\n";
@@ -231,8 +231,7 @@  discard block
 block discarded – undo
231 231
 			exit($rc);
232 232
 		}
233 233
 		fclose($handle);
234
-	}
235
-	else {
234
+	} else {
236 235
 		$rc = 6;
237 236
 		$msg = "Cannot open file $lEnglishFile";
238 237
 		print $msg . " (rc=$rc).\n";
@@ -284,8 +283,7 @@  discard block
 block discarded – undo
284 283
 			if ( array_key_exists($key, $aPrimary) ) {
285 284
 				print "Key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n";
286 285
 				continue;
287
-			}
288
-			else
286
+			} else
289 287
 			{
290 288
 				$fileFirstFound[$key] = $fileToProcess;
291 289
 				$lineFirstFound[$key] = $cnt;
@@ -309,8 +307,7 @@  discard block
 block discarded – undo
309 307
 			if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
310 308
 			{
311 309
 				//print "Key $key is a key we always want to see into secondary file (line: $cnt).\n";
312
-			}
313
-			else if ( ! array_key_exists($key, $aSecondary))
310
+			} else if ( ! array_key_exists($key, $aSecondary))
314 311
 			{
315 312
 				//print "Key $key does NOT exist in secondary language (line: $cnt).\n";
316 313
 				continue;
@@ -335,8 +332,7 @@  discard block
 block discarded – undo
335 332
 		}
336 333
 		fclose($oh);
337 334
 		fclose($handle);
338
-	}
339
-	else {
335
+	} else {
340 336
 		$rc = 8;
341 337
 		$msg = "Cannot open file $lPrimaryFile";
342 338
 		print $msg . " (rc=$rc).\n";
Please login to merge, or discard this patch.
dolibarr/dev/translation/sanity_check_en_langfiles.php 1 patch
Braces   +329 added lines, -114 removed lines patch added patch discarded remove patch
@@ -87,9 +87,13 @@  discard block
 block discarded – undo
87 87
 }
88 88
 
89 89
 echo "If you call this with argument \"unused=true\" it searches for the translation strings that exist in en_US but are never used.\n";
90
-if ($web) print "<br>";
90
+if ($web) {
91
+    print "<br>";
92
+}
91 93
 echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.\n";
92
-if ($web) print "<br>";
94
+if ($web) {
95
+    print "<br>";
96
+}
93 97
 
94 98
 
95 99
 
@@ -156,9 +160,13 @@  discard block
 block discarded – undo
156 160
 	}
157 161
 }
158 162
 
159
-if ($web) print "<h2>";
163
+if ($web) {
164
+    print "<h2>";
165
+}
160 166
 print "Duplicate strings in lang files in $workdir - ".count($dups)." found\n";
161
-if ($web) print "</h2>";
167
+if ($web) {
168
+    print "</h2>";
169
+}
162 170
 
163 171
 if ($web)
164 172
 {
@@ -179,15 +187,31 @@  discard block
 block discarded – undo
179 187
 	$s='';
180 188
 
181 189
 	// Keyword $string
182
-	if ($web) $s.="<tr>";
183
-	if ($web) $s.="<td align=\"center\">";
184
-	if ($web) $s.=$count;
185
-	if ($web) $s.="</td>";
186
-	if ($web) $s.="<td>";
190
+	if ($web) {
191
+	    $s.="<tr>";
192
+	}
193
+	if ($web) {
194
+	    $s.="<td align=\"center\">";
195
+	}
196
+	if ($web) {
197
+	    $s.=$count;
198
+	}
199
+	if ($web) {
200
+	    $s.="</td>";
201
+	}
202
+	if ($web) {
203
+	    $s.="<td>";
204
+	}
187 205
 	$s.=$string;
188
-	if ($web) $s.="</td>";
189
-	if ($web) $s.="<td>";
190
-	if (! $web) $s.= ' : ';
206
+	if ($web) {
207
+	    $s.="</td>";
208
+	}
209
+	if ($web) {
210
+	    $s.="<td>";
211
+	}
212
+	if (! $web) {
213
+	    $s.= ' : ';
214
+	}
191 215
 
192 216
 	// Loop on each files keyword was found
193 217
     $duplicateinsamefile=0;
@@ -204,41 +228,76 @@  discard block
 block discarded – undo
204 228
 	    $listoffilesforthisentry=array();
205 229
 	    foreach ($lines as $line => $translatedvalue)
206 230
 		{
207
-            if (! empty($listoffilesforthisentry[$file])) $duplicateinsamefile=1;
231
+            if (! empty($listoffilesforthisentry[$file])) {
232
+                $duplicateinsamefile=1;
233
+            }
208 234
             $listoffilesforthisentry[$file]=1;
209 235
 
210 236
 			$s.= "(".$line." - ".htmlentities($translatedvalue).") ";
211 237
 		}
212
-		if ($web) $s.="<br>";
238
+		if ($web) {
239
+		    $s.="<br>";
240
+		}
241
+	}
242
+	if ($web) {
243
+	    $s.="</td></tr>";
213 244
 	}
214
-	if ($web) $s.="</td></tr>";
215 245
 	$s.="\n";
216 246
 
217
-	if ($duplicateinsamefile) $sduplicateinsamefile .= $s;
218
-	else if ($inmain) $sinmainandother .= $s;
219
-	else if ($inadmin) $sininstallandadmin .= $s;
220
-	else $sother .= $s;
221
-}
247
+	if ($duplicateinsamefile) {
248
+	    $sduplicateinsamefile .= $s;
249
+	} else if ($inmain) {
250
+	    $sinmainandother .= $s;
251
+	} else if ($inadmin) {
252
+	    $sininstallandadmin .= $s;
253
+	} else {
254
+	    $sother .= $s;
255
+	}
256
+	}
222 257
 
223
-if (! $web) print "\n***** Entries duplicated in same file\n";
258
+if (! $web) {
259
+    print "\n***** Entries duplicated in same file\n";
260
+}
224 261
 print $sduplicateinsamefile;
225
-if (! $web && empty($sduplicateinsamefile)) print "None\n";
226
-if (! $web) print "\n";
262
+if (! $web && empty($sduplicateinsamefile)) {
263
+    print "None\n";
264
+}
265
+if (! $web) {
266
+    print "\n";
267
+}
227 268
 
228
-if (! $web) print "***** Entries in main and another (keep only entry in main)\n";
269
+if (! $web) {
270
+    print "***** Entries in main and another (keep only entry in main)\n";
271
+}
229 272
 print $sinmainandother;
230
-if (! $web && empty($sinmainandother)) print "None\n";
231
-if (! $web) print "\n";
273
+if (! $web && empty($sinmainandother)) {
274
+    print "None\n";
275
+}
276
+if (! $web) {
277
+    print "\n";
278
+}
232 279
 
233
-if (! $web) print "***** Entries in admin and another\n";
280
+if (! $web) {
281
+    print "***** Entries in admin and another\n";
282
+}
234 283
 print $sininstallandadmin;
235
-if (! $web && empty($sininstallandadmin)) print "None\n";
236
-if (! $web) print "\n";
284
+if (! $web && empty($sininstallandadmin)) {
285
+    print "None\n";
286
+}
287
+if (! $web) {
288
+    print "\n";
289
+}
237 290
 
238
-if (! $web) print "***** Other\n";
291
+if (! $web) {
292
+    print "***** Other\n";
293
+}
239 294
 print $sother;
240
-if (! $web && empty($sother)) print "None\n";
241
-if (! $web) print "\n";
295
+if (! $web && empty($sother)) {
296
+    print "None\n";
297
+}
298
+if (! $web) {
299
+    print "\n";
300
+}
242 301
 
243 302
 if ($web)
244 303
 {
@@ -258,93 +317,245 @@  discard block
 block discarded – undo
258 317
 	{
259 318
     	$qualifiedforclean=1;
260 319
 	    // Check if we must keep this key to be into file for removal
261
-	    if (preg_match('/^Module\d+/', $value)) $qualifiedforclean=0;
262
-	    if (preg_match('/^Permission\d+/', $value)) $qualifiedforclean=0;
263
-	    if (preg_match('/^PermissionAdvanced\d+/', $value)) $qualifiedforclean=0;
264
-	    if (preg_match('/^ProfId\d+/', $value)) $qualifiedforclean=0;
265
-	    if (preg_match('/^Delays_/', $value)) $qualifiedforclean=0;
266
-	    if (preg_match('/^BarcodeDesc/', $value)) $qualifiedforclean=0;
267
-	    if (preg_match('/^Extrafield/', $value)) $qualifiedforclean=0;
268
-	    if (preg_match('/^LocalTax/', $value)) $qualifiedforclean=0;
269
-	    if (preg_match('/^Country/', $value)) $qualifiedforclean=0;
270
-	    if (preg_match('/^Civility/', $value)) $qualifiedforclean=0;
271
-	    if (preg_match('/^Currency/', $value)) $qualifiedforclean=0;
272
-	    if (preg_match('/^DemandReasonTypeSRC/', $value)) $qualifiedforclean=0;
273
-	    if (preg_match('/^PaperFormat/', $value)) $qualifiedforclean=0;
274
-	    if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
275
-	    if (preg_match('/^AmountLT/', $value)) $qualifiedforclean=0;
276
-	    if (preg_match('/^TotalLT/', $value)) $qualifiedforclean=0;
277
-	    if (preg_match('/^Month/', $value)) $qualifiedforclean=0;
278
-	    if (preg_match('/^MonthShort/', $value)) $qualifiedforclean=0;
279
-	    if (preg_match('/^Day\d/', $value)) $qualifiedforclean=0;
280
-	    if (preg_match('/^Short/', $value)) $qualifiedforclean=0;
281
-	    if (preg_match('/^ExportDataset_/', $value)) $qualifiedforclean=0;
282
-	    if (preg_match('/^ImportDataset_/', $value)) $qualifiedforclean=0;
283
-	    if (preg_match('/^ActionAC_/', $value)) $qualifiedforclean=0;
284
-	    if (preg_match('/^TypeLocaltax/', $value)) $qualifiedforclean=0;
285
-	    if (preg_match('/^StatusProspect/', $value)) $qualifiedforclean=0;
286
-	    if (preg_match('/^PL_/', $value)) $qualifiedforclean=0;
287
-	    if (preg_match('/^TE_/', $value)) $qualifiedforclean=0;
288
-	    if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
289
-	    if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
290
-	    if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
291
-	    if (preg_match('/^LT[0-9]/', $value)) $qualifiedforclean=0;
292
-	    if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
293
-	    if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
294
-	    if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
295
-	    if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
296
-	    if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
297
-	    if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0;
298
-	    if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0;
320
+	    if (preg_match('/^Module\d+/', $value)) {
321
+	        $qualifiedforclean=0;
322
+	    }
323
+	    if (preg_match('/^Permission\d+/', $value)) {
324
+	        $qualifiedforclean=0;
325
+	    }
326
+	    if (preg_match('/^PermissionAdvanced\d+/', $value)) {
327
+	        $qualifiedforclean=0;
328
+	    }
329
+	    if (preg_match('/^ProfId\d+/', $value)) {
330
+	        $qualifiedforclean=0;
331
+	    }
332
+	    if (preg_match('/^Delays_/', $value)) {
333
+	        $qualifiedforclean=0;
334
+	    }
335
+	    if (preg_match('/^BarcodeDesc/', $value)) {
336
+	        $qualifiedforclean=0;
337
+	    }
338
+	    if (preg_match('/^Extrafield/', $value)) {
339
+	        $qualifiedforclean=0;
340
+	    }
341
+	    if (preg_match('/^LocalTax/', $value)) {
342
+	        $qualifiedforclean=0;
343
+	    }
344
+	    if (preg_match('/^Country/', $value)) {
345
+	        $qualifiedforclean=0;
346
+	    }
347
+	    if (preg_match('/^Civility/', $value)) {
348
+	        $qualifiedforclean=0;
349
+	    }
350
+	    if (preg_match('/^Currency/', $value)) {
351
+	        $qualifiedforclean=0;
352
+	    }
353
+	    if (preg_match('/^DemandReasonTypeSRC/', $value)) {
354
+	        $qualifiedforclean=0;
355
+	    }
356
+	    if (preg_match('/^PaperFormat/', $value)) {
357
+	        $qualifiedforclean=0;
358
+	    }
359
+	    if (preg_match('/^Duration/', $value)) {
360
+	        $qualifiedforclean=0;
361
+	    }
362
+	    if (preg_match('/^AmountLT/', $value)) {
363
+	        $qualifiedforclean=0;
364
+	    }
365
+	    if (preg_match('/^TotalLT/', $value)) {
366
+	        $qualifiedforclean=0;
367
+	    }
368
+	    if (preg_match('/^Month/', $value)) {
369
+	        $qualifiedforclean=0;
370
+	    }
371
+	    if (preg_match('/^MonthShort/', $value)) {
372
+	        $qualifiedforclean=0;
373
+	    }
374
+	    if (preg_match('/^Day\d/', $value)) {
375
+	        $qualifiedforclean=0;
376
+	    }
377
+	    if (preg_match('/^Short/', $value)) {
378
+	        $qualifiedforclean=0;
379
+	    }
380
+	    if (preg_match('/^ExportDataset_/', $value)) {
381
+	        $qualifiedforclean=0;
382
+	    }
383
+	    if (preg_match('/^ImportDataset_/', $value)) {
384
+	        $qualifiedforclean=0;
385
+	    }
386
+	    if (preg_match('/^ActionAC_/', $value)) {
387
+	        $qualifiedforclean=0;
388
+	    }
389
+	    if (preg_match('/^TypeLocaltax/', $value)) {
390
+	        $qualifiedforclean=0;
391
+	    }
392
+	    if (preg_match('/^StatusProspect/', $value)) {
393
+	        $qualifiedforclean=0;
394
+	    }
395
+	    if (preg_match('/^PL_/', $value)) {
396
+	        $qualifiedforclean=0;
397
+	    }
398
+	    if (preg_match('/^TE_/', $value)) {
399
+	        $qualifiedforclean=0;
400
+	    }
401
+	    if (preg_match('/^JuridicalStatus/', $value)) {
402
+	        $qualifiedforclean=0;
403
+	    }
404
+	    if (preg_match('/^CalcMode/', $value)) {
405
+	        $qualifiedforclean=0;
406
+	    }
407
+	    if (preg_match('/^newLT/', $value)) {
408
+	        $qualifiedforclean=0;
409
+	    }
410
+	    if (preg_match('/^LT[0-9]/', $value)) {
411
+	        $qualifiedforclean=0;
412
+	    }
413
+	    if (preg_match('/^TypeContact_contrat_/', $value)) {
414
+	        $qualifiedforclean=0;
415
+	    }
416
+	    if (preg_match('/^ErrorPriceExpression/', $value)) {
417
+	        $qualifiedforclean=0;
418
+	    }
419
+	    if (preg_match('/^Language_/', $value)) {
420
+	        $qualifiedforclean=0;
421
+	    }
422
+	    if (preg_match('/^DescADHERENT_/', $value)) {
423
+	        $qualifiedforclean=0;
424
+	    }
425
+	    if (preg_match('/^SubmitTranslation/', $value)) {
426
+	        $qualifiedforclean=0;
427
+	    }
428
+	    if (preg_match('/^ModuleCompanyCode/', $value)) {
429
+	        $qualifiedforclean=0;
430
+	    }
431
+	    if (preg_match('/InDolibarr$/', $value)) {
432
+	        $qualifiedforclean=0;
433
+	    }
299 434
 	    // admin.lang
300
-	    if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0;
301
-	    if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0;
435
+	    if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) {
436
+	        $qualifiedforclean=0;
437
+	    }
438
+	    if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) {
439
+	        $qualifiedforclean=0;
440
+	    }
302 441
 	    // boxes.lang
303
-	    if (preg_match('/^BoxTitleLast/', $value)) $qualifiedforclean=0;
304
-	    if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0;
442
+	    if (preg_match('/^BoxTitleLast/', $value)) {
443
+	        $qualifiedforclean=0;
444
+	    }
445
+	    if (preg_match('/^BoxTitleLatest/', $value)) {
446
+	        $qualifiedforclean=0;
447
+	    }
305 448
 	    // install.lang
306
-	    if (preg_match('/^KeepDefaultValues/', $value)) $qualifiedforclean=0;
449
+	    if (preg_match('/^KeepDefaultValues/', $value)) {
450
+	        $qualifiedforclean=0;
451
+	    }
307 452
 		// mail.lang
308
-	    if (preg_match('/MailingModuleDesc/i', $value)) $qualifiedforclean=0;
453
+	    if (preg_match('/MailingModuleDesc/i', $value)) {
454
+	        $qualifiedforclean=0;
455
+	    }
309 456
 	    // main.lang
310
-	    if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
311
-	    if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
312
-	    if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0;
313
-	    if (preg_match('/^.b$/', $value)) $qualifiedforclean=0;
314
-	    if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0;
315
-	    if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0;
316
-	    if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0;
457
+	    if (preg_match('/^Duration/', $value)) {
458
+	        $qualifiedforclean=0;
459
+	    }
460
+	    if (preg_match('/^FormatDate/', $value)) {
461
+	        $qualifiedforclean=0;
462
+	    }
463
+	    if (preg_match('/^DateFormat/', $value)) {
464
+	        $qualifiedforclean=0;
465
+	    }
466
+	    if (preg_match('/^.b$/', $value)) {
467
+	        $qualifiedforclean=0;
468
+	    }
469
+	    if (preg_match('/^.*Bytes$/', $value)) {
470
+	        $qualifiedforclean=0;
471
+	    }
472
+	    if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) {
473
+	        $qualifiedforclean=0;
474
+	    }
475
+	    if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) {
476
+	        $qualifiedforclean=0;
477
+	    }
317 478
 		// modulebuilder
318
-		if (preg_match('/^ModuleBuilderDesc/', $value)) $qualifiedforclean=0;
479
+		if (preg_match('/^ModuleBuilderDesc/', $value)) {
480
+		    $qualifiedforclean=0;
481
+		}
319 482
 	    // orders
320
-	    if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
321
-	    if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
483
+	    if (preg_match('/^OrderSource/', $value)) {
484
+	        $qualifiedforclean=0;
485
+	    }
486
+	    if (preg_match('/^TypeContact_/', $value)) {
487
+	        $qualifiedforclean=0;
488
+	    }
322 489
         // other.lang
323
-	    if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
324
-	    if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
325
-	    if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
326
-	    if (preg_match('/^WeightUnit/', $value)) $qualifiedforclean=0;
327
-	    if (preg_match('/^LengthUnit/', $value)) $qualifiedforclean=0;
328
-	    if (preg_match('/^SurfaceUnit/', $value)) $qualifiedforclean=0;
329
-	    if (preg_match('/^VolumeUnit/', $value)) $qualifiedforclean=0;
330
-	    if (preg_match('/^SizeUnit/', $value)) $qualifiedforclean=0;
331
-	    if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0;
332
-	    if (preg_match('/ById$/', $value)) $qualifiedforclean=0;
333
-	    if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0;
490
+	    if (preg_match('/^Notify_/', $value)) {
491
+	        $qualifiedforclean=0;
492
+	    }
493
+	    if (preg_match('/^PredefinedMail/', $value)) {
494
+	        $qualifiedforclean=0;
495
+	    }
496
+	    if (preg_match('/^DemoCompany/', $value)) {
497
+	        $qualifiedforclean=0;
498
+	    }
499
+	    if (preg_match('/^WeightUnit/', $value)) {
500
+	        $qualifiedforclean=0;
501
+	    }
502
+	    if (preg_match('/^LengthUnit/', $value)) {
503
+	        $qualifiedforclean=0;
504
+	    }
505
+	    if (preg_match('/^SurfaceUnit/', $value)) {
506
+	        $qualifiedforclean=0;
507
+	    }
508
+	    if (preg_match('/^VolumeUnit/', $value)) {
509
+	        $qualifiedforclean=0;
510
+	    }
511
+	    if (preg_match('/^SizeUnit/', $value)) {
512
+	        $qualifiedforclean=0;
513
+	    }
514
+	    if (preg_match('/^EMailText/', $value)) {
515
+	        $qualifiedforclean=0;
516
+	    }
517
+	    if (preg_match('/ById$/', $value)) {
518
+	        $qualifiedforclean=0;
519
+	    }
520
+	    if (preg_match('/ByLogin$/', $value)) {
521
+	        $qualifiedforclean=0;
522
+	    }
334 523
 	    // printing
335
-	    if (preg_match('/PrintingDriverDesc$/', $value)) $qualifiedforclean=0;
336
-	    if (preg_match('/PrintTestDesc$/', $value)) $qualifiedforclean=0;
524
+	    if (preg_match('/PrintingDriverDesc$/', $value)) {
525
+	        $qualifiedforclean=0;
526
+	    }
527
+	    if (preg_match('/PrintTestDesc$/', $value)) {
528
+	        $qualifiedforclean=0;
529
+	    }
337 530
 	    // products
338
-	    if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0;
339
-	    if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
340
-	    if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
341
-	    if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
342
-	    if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
531
+	    if (preg_match('/GlobalVariableUpdaterType$/', $value)) {
532
+	        $qualifiedforclean=0;
533
+	    }
534
+	    if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) {
535
+	        $qualifiedforclean=0;
536
+	    }
537
+	    if (preg_match('/OppStatus/', $value)) {
538
+	        $qualifiedforclean=0;
539
+	    }
540
+	    if (preg_match('/AvailabilityType/', $value)) {
541
+	        $qualifiedforclean=0;
542
+	    }
543
+	    if (preg_match('/CardProduct/', $value)) {
544
+	        $qualifiedforclean=0;
545
+	    }
343 546
 
344
-	    if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
345
-	    if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
346
-	    if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
347
-	    if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
547
+	    if (preg_match('/sms/i', $value)) {
548
+	        $qualifiedforclean=0;
549
+	    }
550
+	    if (preg_match('/TF_/i', $value)) {
551
+	        $qualifiedforclean=0;
552
+	    }
553
+	    if (preg_match('/WithBankUsing/i', $value)) {
554
+	        $qualifiedforclean=0;
555
+	    }
556
+	    if (preg_match('/descWORKFLOW_/i', $value)) {
557
+	        $qualifiedforclean=0;
558
+	    }
348 559
 
349 560
 	    if (! $qualifiedforclean)
350 561
 	    {
@@ -359,24 +570,28 @@  discard block
 block discarded – undo
359 570
 		if (empty($output)) {
360 571
    			$unused[$value] = $line;
361 572
        		echo $line;        // $trad contains the \n
362
-		}
363
-		else
573
+		} else
364 574
 		{
365 575
 		    unset($output);
366 576
 		    //print 'X'.$output.'Y';
367 577
 		}
368 578
 	}
369 579
 
370
-	if (empty($unused)) print "No string not used found.\n";
371
-	else
580
+	if (empty($unused)) {
581
+	    print "No string not used found.\n";
582
+	} else
372 583
 	{
373 584
         $filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
374 585
         print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
375 586
         file_put_contents($filetosave, implode("",$unused));
376 587
         print "To remove from original file, run command :\n";
377
-        if (($argv[2]?$argv[2]:"")) print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
588
+        if (($argv[2]?$argv[2]:"")) {
589
+            print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
590
+        }
378 591
         print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut  -b 3- > ".($argv[2]?$argv[2]:"");
379
-        if (($argv[2]?$argv[2]:"")) print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
592
+        if (($argv[2]?$argv[2]:"")) {
593
+            print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
594
+        }
380 595
 	}
381 596
 }
382 597
 
Please login to merge, or discard this patch.
dolibarr/dev/translation/autotranslator.class.php 1 patch
Braces   +61 added lines, -21 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@  discard block
 block discarded – undo
79 79
 		$counter = 1;
80 80
 		foreach($files as $file)
81 81
 		{
82
-			if ($this->_limittofile && $this->_limittofile != $file) continue;
82
+			if ($this->_limittofile && $this->_limittofile != $file) {
83
+			    continue;
84
+			}
83 85
 			$counter++;
84 86
 			$fileContent = null;
85 87
 			$refPath = $this->_langDir.$this->_refLang.self::DIR_SEPARATOR.$file;
@@ -96,16 +98,43 @@  discard block
 block discarded – undo
96 98
 				$arraytmp=dol_dir_list($this->_langDir,'directories',0);
97 99
 				foreach($arraytmp as $dirtmp)
98 100
 				{
99
-					if ($dirtmp['name'] === $this->_refLang) continue;	// We discard source language
101
+					if ($dirtmp['name'] === $this->_refLang) {
102
+					    continue;
103
+					}
104
+					// We discard source language
100 105
 					$tmppart=explode('_',$dirtmp['name']);
101
-					if (preg_match('/^en/i',$dirtmp['name']))  continue;	// We discard en_* languages
102
-					if (preg_match('/^fr/i',$dirtmp['name']))  continue;	// We discard fr_* languages
103
-					if (preg_match('/^es/i',$dirtmp['name']))  continue;	// We discard es_* languages
104
-					if (preg_match('/ca_ES/i',$dirtmp['name']))  continue;	// We discard es_CA language
105
-					if (preg_match('/pt_BR/i',$dirtmp['name']))  continue;	// We discard pt_BR language
106
-                    if (preg_match('/nl_BE/i',$dirtmp['name']))  continue;  // We discard nl_BE language
107
-					if (preg_match('/^\./i',$dirtmp['name']))  continue;	// We discard files .*
108
-					if (preg_match('/^CVS/i',$dirtmp['name']))  continue;	// We discard CVS
106
+					if (preg_match('/^en/i',$dirtmp['name'])) {
107
+					    continue;
108
+					}
109
+					// We discard en_* languages
110
+					if (preg_match('/^fr/i',$dirtmp['name'])) {
111
+					    continue;
112
+					}
113
+					// We discard fr_* languages
114
+					if (preg_match('/^es/i',$dirtmp['name'])) {
115
+					    continue;
116
+					}
117
+					// We discard es_* languages
118
+					if (preg_match('/ca_ES/i',$dirtmp['name'])) {
119
+					    continue;
120
+					}
121
+					// We discard es_CA language
122
+					if (preg_match('/pt_BR/i',$dirtmp['name'])) {
123
+					    continue;
124
+					}
125
+					// We discard pt_BR language
126
+                    if (preg_match('/nl_BE/i',$dirtmp['name'])) {
127
+                        continue;
128
+                    }
129
+                    // We discard nl_BE language
130
+					if (preg_match('/^\./i',$dirtmp['name'])) {
131
+					    continue;
132
+					}
133
+					// We discard files .*
134
+					if (preg_match('/^CVS/i',$dirtmp['name'])) {
135
+					    continue;
136
+					}
137
+					// We discard CVS
109 138
 					$targetlangs[]=$dirtmp['name'];
110 139
 				}
111 140
 				//var_dump($targetlangs);
@@ -123,8 +152,7 @@  discard block
 block discarded – undo
123 152
 					// No file present, we generate file
124 153
 					echo "File not found: " . $destPath . ". We generate it.<br>\n";
125 154
 					$this->createTranslationFile($destPath,$my_destlang);
126
-				}
127
-				else
155
+				} else
128 156
 				{
129 157
 					echo "Updating file: " . $destPath . "<br>\n";
130 158
 				}
@@ -220,19 +248,27 @@  discard block
 block discarded – undo
220 248
 			}
221 249
 		}
222 250
 
223
-		if ($key == 'CHARSET') $val=$this->_outputpagecode;
224
-		else if (preg_match('/^Format/',$key)) $val=$value;
225
-		else if ($value=='-') $val=$value;
226
-		else
251
+		if ($key == 'CHARSET') {
252
+		    $val=$this->_outputpagecode;
253
+		} else if (preg_match('/^Format/',$key)) {
254
+		    $val=$value;
255
+		} else if ($value=='-') {
256
+		    $val=$value;
257
+		} else
227 258
 		{
228 259
 			// If not translated then translate
229
-			if ($this->_outputpagecode == 'UTF-8') $val=$this->translateTexts(array($value),substr($this->_refLang,0,2),substr($my_destlang,0,2));
230
-			else $val=utf8_decode($this->translateTexts(array($value),substr($this->_refLang,0,2),substr($my_destlang,0,2)));
260
+			if ($this->_outputpagecode == 'UTF-8') {
261
+			    $val=$this->translateTexts(array($value),substr($this->_refLang,0,2),substr($my_destlang,0,2));
262
+			} else {
263
+			    $val=utf8_decode($this->translateTexts(array($value),substr($this->_refLang,0,2),substr($my_destlang,0,2)));
264
+			}
231 265
 		}
232 266
 
233 267
 		$val=trim($val);
234 268
 
235
-		if (empty($val)) return 0;
269
+		if (empty($val)) {
270
+		    return 0;
271
+		}
236 272
 
237 273
 		$this->_translatedFiles[$file][] = $key . '=' . $val ;
238 274
 		return 1;
@@ -292,9 +328,13 @@  discard block
 block discarded – undo
292 328
 	{
293 329
 		// We want to be sure that src_lang and dest_lang are using 2 chars only
294 330
 		$tmp=explode('_',$src_lang);
295
-		if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) $src_lang=$tmp[0];
331
+		if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) {
332
+		    $src_lang=$tmp[0];
333
+		}
296 334
 		$tmp=explode('_',$dest_lang);
297
-		if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) $dest_lang=$tmp[0];
335
+		if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) {
336
+		    $dest_lang=$tmp[0];
337
+		}
298 338
 
299 339
 		//setting language pair
300 340
 		$lang_pair = $src_lang.'|'.$dest_lang;
Please login to merge, or discard this patch.
dolibarr/dev/initdemo/sftpget_and_loaddump.php 1 patch
Braces   +31 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,14 +41,32 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Include Dolibarr environment
43 43
 $res=0;
44
-if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php";
45
-if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php";
46
-if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
47
-if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
48
-if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
49
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
50
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
51
-if (! $res) die ("Failed to include master.inc.php file\n");
44
+if (! $res && file_exists($path."../../master.inc.php")) {
45
+    $res=@include $path."../../master.inc.php";
46
+}
47
+if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
48
+    $res=@include $path."../../htdocs/master.inc.php";
49
+}
50
+if (! $res && file_exists("../master.inc.php")) {
51
+    $res=@include "../master.inc.php";
52
+}
53
+if (! $res && file_exists("../../master.inc.php")) {
54
+    $res=@include "../../master.inc.php";
55
+}
56
+if (! $res && file_exists("../../../master.inc.php")) {
57
+    $res=@include "../../../master.inc.php";
58
+}
59
+if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) {
60
+    $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php";
61
+}
62
+// Used on dev env only
63
+if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) {
64
+    $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php";
65
+}
66
+// Used on dev env only
67
+if (! $res) {
68
+    die ("Failed to include master.inc.php file\n");
69
+}
52 70
 include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
53 71
 
54 72
 
@@ -94,8 +112,7 @@  discard block
 block discarded – undo
94 112
 	{
95 113
 		dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password),LOG_ERR);
96 114
 		exit(-5);
97
-	}
98
-	else
115
+	} else
99 116
 	{
100 117
 		//$stream = ssh2_exec($connection, '/usr/bin/php -i');
101 118
 		/*
@@ -125,13 +142,14 @@  discard block
 block discarded – undo
125 142
 		$return_var=0;
126 143
 		print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n";
127 144
 		exec($fullcommand, $output, $return_var);
128
-		foreach($output as $line) print $line."\n";
145
+		foreach($output as $line) {
146
+		    print $line."\n";
147
+		}
129 148
 
130 149
 		//ssh2_sftp_unlink($sftp, $fileinstalllock);
131 150
 		//print $output;
132 151
 	}
133
-}
134
-else
152
+} else
135 153
 {
136 154
 	print 'Failed to connect to ssh2 to '.$server;
137 155
 	exit(-6);
Please login to merge, or discard this patch.
dolibarr/dev/initdemo/updatedemo.php 1 patch
Braces   +34 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,14 +36,32 @@  discard block
 block discarded – undo
36 36
 
37 37
 // Include Dolibarr environment
38 38
 $res=0;
39
-if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php";
40
-if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php";
41
-if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
42
-if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
43
-if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
44
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
45
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
46
-if (! $res) die ("Failed to include master.inc.php file\n");
39
+if (! $res && file_exists($path."../../master.inc.php")) {
40
+    $res=@include $path."../../master.inc.php";
41
+}
42
+if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
43
+    $res=@include $path."../../htdocs/master.inc.php";
44
+}
45
+if (! $res && file_exists("../master.inc.php")) {
46
+    $res=@include "../master.inc.php";
47
+}
48
+if (! $res && file_exists("../../master.inc.php")) {
49
+    $res=@include "../../master.inc.php";
50
+}
51
+if (! $res && file_exists("../../../master.inc.php")) {
52
+    $res=@include "../../../master.inc.php";
53
+}
54
+if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) {
55
+    $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php";
56
+}
57
+// Used on dev env only
58
+if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) {
59
+    $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php";
60
+}
61
+// Used on dev env only
62
+if (! $res) {
63
+    die ("Failed to include master.inc.php file\n");
64
+}
47 65
 include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
48 66
 
49 67
 
@@ -102,19 +120,24 @@  discard block
 block discarded – undo
102 120
                         $j=0;
103 121
                         foreach($tableval as $field)
104 122
                         {
105
-                            if ($j) $sql2.=", ";
123
+                            if ($j) {
124
+                                $sql2.=", ";
125
+                            }
106 126
                             $sql2.= $field." = DATE_ADD(".$field.", INTERVAL ".$delta." YEAR)";
107 127
                             $j++;
108 128
                         }
109 129
                         $sql2.=" WHERE rowid = ".$obj->rowid;
110 130
                         //print $sql2."\n";
111 131
                         $resql2 = $db->query($sql2);
112
-                        if (! $resql2) dol_print_error($db);
132
+                        if (! $resql2) {
133
+                            dol_print_error($db);
134
+                        }
113 135
                     }
114 136
                     $i++;
115 137
                 }
138
+            } else {
139
+                dol_print_error($db);
116 140
             }
117
-            else dol_print_error($db);
118 141
         }
119 142
     }
120 143
 
Please login to merge, or discard this patch.