Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/modules/modExport.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *	\brief      Fichier de description et activation du module export
25 25
  */
26 26
 
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 
30 30
 /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$this->family = "technic";
47 47
 		$this->module_position = '72';
48 48
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49
-		$this->name = preg_replace('/^mod/i','',get_class($this));
49
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
50 50
 		$this->description = "Outils d'exports de donnees Dolibarr (via un assistant)";
51 51
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
52 52
 		$this->version = 'dolibarr';
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		// Dependencies
63 63
 		$this->depends = array();
64 64
 		$this->requiredby = array();
65
-		$this->phpmin = array(4,2,0);
65
+		$this->phpmin = array(4, 2, 0);
66 66
 		$this->phpmax = array();
67 67
 
68 68
 		// Constants
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		// Permissions
75 75
 		$this->rights = array();
76 76
 		$this->rights_class = 'export';
77
-		$r=0;
77
+		$r = 0;
78 78
 
79 79
 		$r++;
80 80
 		$this->rights[$r][0] = 1201;
@@ -93,6 +93,6 @@  discard block
 block discarded – undo
93 93
 
94 94
 		// Menus
95 95
 		//-------
96
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
96
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
97 97
 	}
98 98
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_excel2007.modules.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public $version_lib;
57 57
 
58
-	public $workbook;      // Handle fichier
58
+	public $workbook; // Handle fichier
59 59
 
60
-	public $worksheet;     // Handle onglet
60
+	public $worksheet; // Handle onglet
61 61
 
62 62
 	public $row;
63 63
 
64 64
 	public $col;
65 65
 
66
-    public $file;          // To save filename
66
+    public $file; // To save filename
67 67
 
68 68
 	/**
69 69
 	 *	Constructor
@@ -75,36 +75,36 @@  discard block
 block discarded – undo
75 75
 		global $conf, $langs;
76 76
 		$this->db = $db;
77 77
 
78
-		$this->id='excel2007';                  // Same value then xxx in file name export_xxx.modules.php
79
-		$this->label='Excel 2007';               // Label of driver
78
+		$this->id = 'excel2007'; // Same value then xxx in file name export_xxx.modules.php
79
+		$this->label = 'Excel 2007'; // Label of driver
80 80
 		$this->desc = $langs->trans('Excel2007FormatDesc');
81
-		$this->extension='xlsx';             // Extension for generated file by this driver
82
-        $this->picto='mime/xls';			// Picto
83
-		$this->version='1.30';             // Driver version
81
+		$this->extension = 'xlsx'; // Extension for generated file by this driver
82
+        $this->picto = 'mime/xls'; // Picto
83
+		$this->version = '1.30'; // Driver version
84 84
 
85
-		$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0);	// A condition to disable module (used for native debian packages)
85
+		$this->disabled = (in_array(constant('PHPEXCEL_PATH'), array('disabled', 'disabled/')) ? 1 : 0); // A condition to disable module (used for native debian packages)
86 86
 
87 87
 		if (empty($this->disabled))
88 88
 		{
89 89
     		// If driver use an external library, put its name here
90
-    		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
90
+    		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
91 91
     		{
92 92
     			require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
93 93
                 require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
94 94
                 require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
95
-    			$this->label_lib='PhpWriteExcel';
96
-                $this->version_lib='unknown';
95
+    			$this->label_lib = 'PhpWriteExcel';
96
+                $this->version_lib = 'unknown';
97 97
     		}
98 98
     		else
99 99
     		{
100 100
                 require_once PHPEXCEL_PATH.'PHPExcel.php';
101 101
                 require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
102
-    			$this->label_lib='PhpExcel';
103
-                $this->version_lib='1.8.0';		// No way to get info from library
102
+    			$this->label_lib = 'PhpExcel';
103
+                $this->version_lib = '1.8.0'; // No way to get info from library
104 104
     		}
105 105
 		}
106 106
 
107
-		$this->row=0;
107
+		$this->row = 0;
108 108
 	}
109 109
 
110 110
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         // phpcs:enable
120 120
 		global $conf;
121 121
 
122
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
122
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
123 123
     	{
124 124
 	        $this->workbook->close();
125 125
     	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_excel.modules.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public $version_lib;
56 56
 
57
-	public $workbook;      // Handle file
57
+	public $workbook; // Handle file
58 58
 
59
-	public $worksheet;     // Handle sheet
59
+	public $worksheet; // Handle sheet
60 60
 
61 61
 	public $row;
62 62
 
63 63
 	public $col;
64 64
 
65
-    public $file;          // To save filename
65
+    public $file; // To save filename
66 66
 
67 67
 
68 68
 	/**
@@ -75,36 +75,36 @@  discard block
 block discarded – undo
75 75
 		global $conf, $langs;
76 76
 		$this->db = $db;
77 77
 
78
-		$this->id='excel';                  // Same value then xxx in file name export_xxx.modules.php
79
-		$this->label='Excel 95';             // Label of driver
78
+		$this->id = 'excel'; // Same value then xxx in file name export_xxx.modules.php
79
+		$this->label = 'Excel 95'; // Label of driver
80 80
 		$this->desc = $langs->trans('Excel95FormatDesc');
81
-		$this->extension='xls';             // Extension for generated file by this driver
82
-        $this->picto='mime/xls';					// Picto
83
-		$this->version='1.30';             // Driver version
81
+		$this->extension = 'xls'; // Extension for generated file by this driver
82
+        $this->picto = 'mime/xls'; // Picto
83
+		$this->version = '1.30'; // Driver version
84 84
 
85
-		$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0);	// A condition to disable module (used for native debian packages)
85
+		$this->disabled = (in_array(constant('PHPEXCEL_PATH'), array('disabled', 'disabled/')) ? 1 : 0); // A condition to disable module (used for native debian packages)
86 86
 
87 87
 		if (empty($this->disabled))
88 88
 		{
89 89
     		// If driver use an external library, put its name here
90
-    		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
90
+    		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
91 91
     		{
92 92
     			require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
93 93
                 require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
94 94
                 require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
95
-    			$this->label_lib='PhpWriteExcel';
96
-                $this->version_lib='unknown';
95
+    			$this->label_lib = 'PhpWriteExcel';
96
+                $this->version_lib = 'unknown';
97 97
     		}
98 98
     		else
99 99
     		{
100 100
                 require_once PHPEXCEL_PATH.'PHPExcel.php';
101 101
                 require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
102
-    			$this->label_lib='PhpExcel';
103
-                $this->version_lib='1.8.0';		// No way to get info from library
102
+    			$this->label_lib = 'PhpExcel';
103
+                $this->version_lib = '1.8.0'; // No way to get info from library
104 104
     		}
105 105
 		}
106 106
 
107
-		$this->row=0;
107
+		$this->row = 0;
108 108
 	}
109 109
 
110 110
 	/**
@@ -186,29 +186,29 @@  discard block
 block discarded – undo
186 186
 	 *  @param		Translate	$outputlangs	Output language object
187 187
 	 *	@return		int							<0 if KO, >=0 if OK
188 188
 	 */
189
-	function open_file($file,$outputlangs)
189
+	function open_file($file, $outputlangs)
190 190
 	{
191 191
         // phpcs:enable
192
-		global $user,$conf,$langs;
192
+		global $user, $conf, $langs;
193 193
 
194
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
194
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
195 195
 		{
196
-		    $outputlangs->charset_output='ISO-8859-1';	// Because Excel 5 format is ISO
196
+		    $outputlangs->charset_output = 'ISO-8859-1'; // Because Excel 5 format is ISO
197 197
 		}
198 198
 
199 199
 		dol_syslog(get_class($this)."::open_file file=".$file);
200
-        $this->file=$file;
200
+        $this->file = $file;
201 201
 
202
-		$ret=1;
202
+		$ret = 1;
203 203
 
204 204
     	$outputlangs->load("exports");
205
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
205
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
206 206
 		{
207 207
             require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
208 208
             require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
209 209
             require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
210 210
 		    $this->workbook = new writeexcel_workbookbig($file);
211
-    		$this->workbook->set_tempdir($conf->export->dir_temp);			// Set temporary directory
211
+    		$this->workbook->set_tempdir($conf->export->dir_temp); // Set temporary directory
212 212
     		$this->workbook->set_sheetname($outputlangs->trans("Sheet"));
213 213
     		$this->worksheet = &$this->workbook->addworksheet();
214 214
 		}
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 
220 220
 		    if ($this->id == 'excel2007')
221 221
 		    {
222
-	            if (! class_exists('ZipArchive'))	// For Excel2007, PHPExcel need ZipArchive
222
+	            if (!class_exists('ZipArchive'))	// For Excel2007, PHPExcel need ZipArchive
223 223
 	            {
224 224
 	            	$langs->load("errors");
225
-	            	$this->error=$langs->trans('ErrorPHPNeedModule','zip');
225
+	            	$this->error = $langs->trans('ErrorPHPNeedModule', 'zip');
226 226
 	            	return -1;
227 227
 	            }
228 228
 		    }
229 229
 
230 230
 		    if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) {
231 231
 			    $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
232
-			    $cacheSettings = array (
232
+			    $cacheSettings = array(
233 233
 			    		'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR
234 234
 			    );
235 235
 			    PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
      *  @param		array		$array_types					Array with types of fields
276 276
 	 * 	@return		int											<0 if KO, >0 if OK
277 277
 	 */
278
-	function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
278
+	function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
279 279
 	{
280 280
         // phpcs:enable
281 281
 		global $conf;
282 282
 
283 283
 		// Create a format for the column headings
284
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
284
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
285 285
 		{
286
-		    $outputlangs->charset_output='ISO-8859-1';	// Because Excel 5 format is ISO
286
+		    $outputlangs->charset_output = 'ISO-8859-1'; // Because Excel 5 format is ISO
287 287
 
288
-		    $formatheader =$this->workbook->addformat();
288
+		    $formatheader = $this->workbook->addformat();
289 289
     		$formatheader->set_bold();
290 290
     		$formatheader->set_color('blue');
291 291
     		//$formatheader->set_size(12);
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 		    $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
299 299
 		}
300 300
 
301
-		$this->col=0;
302
-		foreach($array_selected_sorted as $code => $value)
301
+		$this->col = 0;
302
+		foreach ($array_selected_sorted as $code => $value)
303 303
 		{
304
-            $alias=$array_export_fields_label[$code];
304
+            $alias = $array_export_fields_label[$code];
305 305
 			//print "dd".$alias;
306
-			if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
307
-    		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
306
+			if (empty($alias)) dol_print_error('', 'Bad value for field with code='.$code.'. Try to redefine export.');
307
+    		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
308 308
     		{
309 309
     			$this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader);
310 310
     		}
311 311
     		else
312 312
     		{
313
-                $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $outputlangs->transnoentities($alias));
314
-    		    if (! empty($array_types[$code]) && in_array($array_types[$code],array('Date','Numeric','TextAuto')))		// Set autowidth for some types
313
+                $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($alias));
314
+    		    if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto')))		// Set autowidth for some types
315 315
                 {
316 316
                 	$this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true);
317 317
                 }
@@ -332,29 +332,29 @@  discard block
 block discarded – undo
332 332
      *  @param		array		$array_types				Array with types of fields
333 333
 	 * 	@return		int										<0 if KO, >0 if OK
334 334
 	 */
335
-	function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
335
+	function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
336 336
 	{
337 337
         // phpcs:enable
338 338
 		global $conf;
339 339
 
340 340
 		// Create a format for the column headings
341
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
341
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
342 342
 		{
343
-		    $outputlangs->charset_output='ISO-8859-1';	// Because Excel 5 format is ISO
343
+		    $outputlangs->charset_output = 'ISO-8859-1'; // Because Excel 5 format is ISO
344 344
 		}
345 345
 
346 346
 		// Define first row
347
-		$this->col=0;
347
+		$this->col = 0;
348 348
 
349
-		foreach($array_selected_sorted as $code => $value)
349
+		foreach ($array_selected_sorted as $code => $value)
350 350
 		{
351
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
352
-			else $alias=substr($code, strpos($code, ' as ') + 4);
353
-            if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
354
-            $newvalue=$objp->$alias;
351
+			if (strpos($code, ' as ') == 0) $alias = str_replace(array('.', '-', '(', ')'), '_', $code);
352
+			else $alias = substr($code, strpos($code, ' as ') + 4);
353
+            if (empty($alias)) dol_print_error('', 'Bad value for field with code='.$code.'. Try to redefine export.');
354
+            $newvalue = $objp->$alias;
355 355
 
356
-			$newvalue=$this->excel_clean($newvalue);
357
-			$typefield=isset($array_types[$code])?$array_types[$code]:'';
356
+			$newvalue = $this->excel_clean($newvalue);
357
+			$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
358 358
 
359 359
 			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
360 360
 			{
@@ -364,58 +364,58 @@  discard block
 block discarded – undo
364 364
 			}
365 365
 
366 366
 			// Traduction newvalue
367
-			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
367
+			if (preg_match('/^\((.*)\)$/i', $newvalue, $reg))
368 368
 			{
369
-				$newvalue=$outputlangs->transnoentities($reg[1]);
369
+				$newvalue = $outputlangs->transnoentities($reg[1]);
370 370
 			}
371 371
 			else
372 372
 			{
373
-				$newvalue=$outputlangs->convToOutputCharset($newvalue);
373
+				$newvalue = $outputlangs->convToOutputCharset($newvalue);
374 374
 			}
375 375
 
376
-			if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i',$newvalue))
376
+			if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i', $newvalue))
377 377
 			{
378
-        		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
378
+        		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
379 379
         		{
380
-            		$formatdate=$this->workbook->addformat();
380
+            		$formatdate = $this->workbook->addformat();
381 381
             		$formatdate->set_num_format('yyyy-mm-dd');
382 382
             		//$formatdate->set_num_format(0x0f);
383
-        		    $arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
383
+        		    $arrayvalue = preg_split('/[.,]/', xl_parse_date($newvalue));
384 384
     				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
385
-    				$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]);	// $newvalue=strval(36892.521); directly does not work because . will be convert into , later
385
+    				$newvalue = strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
386 386
         		    $this->worksheet->write($this->row, $this->col, $newvalue, PHPExcel_Shared_Date::PHPToExcel($formatdate));
387 387
         		}
388 388
         		else
389 389
         		{
390
-        		    $newvalue=dol_stringtotime($newvalue);
391
-        		    $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
392
-        		    $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
390
+        		    $newvalue = dol_stringtotime($newvalue);
391
+        		    $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
392
+        		    $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
393 393
         		    $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
394 394
         		}
395 395
 			}
396
-			elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i',$newvalue))
396
+			elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i', $newvalue))
397 397
 			{
398
-				if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
398
+				if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
399 399
     		    {
400
-            		$formatdatehour=$this->workbook->addformat();
400
+            		$formatdatehour = $this->workbook->addformat();
401 401
             		$formatdatehour->set_num_format('yyyy-mm-dd hh:mm:ss');
402 402
             		//$formatdatehour->set_num_format(0x0f);
403
-            		$arrayvalue=preg_split('/[.,]/',xl_parse_date($newvalue));
403
+            		$arrayvalue = preg_split('/[.,]/', xl_parse_date($newvalue));
404 404
     				//print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
405
-    				$newvalue=strval($arrayvalue[0]).'.'.strval($arrayvalue[1]);	// $newvalue=strval(36892.521); directly does not work because . will be convert into , later
405
+    				$newvalue = strval($arrayvalue[0]).'.'.strval($arrayvalue[1]); // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
406 406
     		        $this->worksheet->write($this->row, $this->col, $newvalue, $formatdatehour);
407 407
     		    }
408 408
     		    else
409 409
     		    {
410
-        		    $newvalue=dol_stringtotime($newvalue);
411
-    		        $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
412
-        		    $coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
410
+        		    $newvalue = dol_stringtotime($newvalue);
411
+    		        $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
412
+        		    $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
413 413
         		    $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
414 414
     		    }
415 415
 			}
416 416
 			else
417 417
 			{
418
-				if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
418
+				if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
419 419
     		    {
420 420
 			        $this->worksheet->write($this->row, $this->col, $newvalue);
421 421
     		    }
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
     		    	if ($typefield == 'Text' || $typefield == 'TextAuto')
425 425
     		    	{
426 426
     		    		//$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
427
-						$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue);
428
-    		    		$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
427
+						$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, (string) $newvalue);
428
+    		    		$coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
429 429
     		    		$this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
430 430
     		    		$this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
431 431
     		    	}
432 432
     		    	else
433 433
     		    	{
434
-    		    		$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
434
+    		    		$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue);
435 435
     		    	}
436 436
     		    }
437 437
 			}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
         // phpcs:enable
468 468
 		global $conf;
469 469
 
470
-		if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
470
+		if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
471 471
     	{
472 472
 	        $this->workbook->close();
473 473
     	}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
     {
495 495
         // phpcs:enable
496 496
 		// Rule Dolibarr: No HTML
497
-    	$newvalue=dol_string_nohtmltag($newvalue);
497
+    	$newvalue = dol_string_nohtmltag($newvalue);
498 498
 
499 499
     	return $newvalue;
500 500
     }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     	{
517 517
     		$p = ($c - 1) % 26;
518 518
     		$c = intval(($c - $p) / 26);
519
-    		$letter = chr(65 + $p) . $letter;
519
+    		$letter = chr(65 + $p).$letter;
520 520
     	}
521 521
 
522 522
     	return $letter;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_csv.modules.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *		\author	    Laurent Destailleur
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php';
26 26
 
27 27
 
28 28
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public $separator;
56 56
 
57
-	public $handle;    // Handle fichier
57
+	public $handle; // Handle fichier
58 58
 
59 59
 
60 60
 	/**
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 		global $conf, $langs;
68 68
 		$this->db = $db;
69 69
 
70
-		$this->separator=',';
71
-		if (! empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
72
-		$this->escape='"';
73
-		$this->enclosure='"';
70
+		$this->separator = ',';
71
+		if (!empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator = $conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
72
+		$this->escape = '"';
73
+		$this->enclosure = '"';
74 74
 
75
-		$this->id='csv';                // Same value then xxx in file name export_xxx.modules.php
76
-		$this->label = 'CSV';             // Label of driver
77
-		$this->desc=$langs->trans("CSVFormatDesc",$this->separator,$this->enclosure,$this->escape);
78
-		$this->extension='csv';         // Extension for generated file by this driver
79
-		$this->picto='mime/other';		// Picto
80
-		$this->version='1.32';         // Driver version
75
+		$this->id = 'csv'; // Same value then xxx in file name export_xxx.modules.php
76
+		$this->label = 'CSV'; // Label of driver
77
+		$this->desc = $langs->trans("CSVFormatDesc", $this->separator, $this->enclosure, $this->escape);
78
+		$this->extension = 'csv'; // Extension for generated file by this driver
79
+		$this->picto = 'mime/other'; // Picto
80
+		$this->version = '1.32'; // Driver version
81 81
 
82 82
 		// If driver use an external library, put its name here
83
-		$this->label_lib='Dolibarr';
84
-		$this->version_lib=DOL_VERSION;
83
+		$this->label_lib = 'Dolibarr';
84
+		$this->version_lib = DOL_VERSION;
85 85
 	}
86 86
 
87 87
 	/**
@@ -163,22 +163,22 @@  discard block
 block discarded – undo
163 163
 	 * 	@param		Translate	$outputlangs	Output language object
164 164
 	 *	@return		int							<0 if KO, >=0 if OK
165 165
 	 */
166
-	function open_file($file,$outputlangs)
166
+	function open_file($file, $outputlangs)
167 167
 	{
168 168
         // phpcs:enable
169 169
 		global $langs;
170 170
 
171 171
 		dol_syslog("ExportCsv::open_file file=".$file);
172 172
 
173
-		$ret=1;
173
+		$ret = 1;
174 174
 
175 175
 		$outputlangs->load("exports");
176 176
 		$this->handle = fopen($file, "wt");
177
-		if (! $this->handle)
177
+		if (!$this->handle)
178 178
 		{
179 179
 			$langs->load("errors");
180
-			$this->error=$langs->trans("ErrorFailToCreateFile",$file);
181
-			$ret=-1;
180
+			$this->error = $langs->trans("ErrorFailToCreateFile", $file);
181
+			$ret = -1;
182 182
 		}
183 183
 
184 184
 		return $ret;
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
      *  @param		array		$array_types					Array with types of fields
209 209
 	 * 	@return		int											<0 if KO, >0 if OK
210 210
 	 */
211
-	function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
211
+	function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
212 212
 	{
213 213
         // phpcs:enable
214 214
 		global $conf;
215 215
 
216
-		if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
216
+		if (!empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
217 217
 		{
218 218
 			$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
219 219
 		}
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
 			$outputlangs->charset_output = 'ISO-8859-1';
223 223
 		}
224 224
 
225
-		foreach($array_selected_sorted as $code => $value)
225
+		foreach ($array_selected_sorted as $code => $value)
226 226
 		{
227
-			$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);		// newvalue is now $outputlangs->charset_output encoded
228
-			$newvalue=$this->csvClean($newvalue,$outputlangs->charset_output);
227
+			$newvalue = $outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded
228
+			$newvalue = $this->csvClean($newvalue, $outputlangs->charset_output);
229 229
 
230
-			fwrite($this->handle,$newvalue.$this->separator);
230
+			fwrite($this->handle, $newvalue.$this->separator);
231 231
 		}
232
-		fwrite($this->handle,"\n");
232
+		fwrite($this->handle, "\n");
233 233
 		return 0;
234 234
 	}
235 235
 
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      *  @param		array		$array_types				Array with types of fields
245 245
 	 * 	@return		int										<0 if KO, >0 if OK
246 246
 	 */
247
-	function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
247
+	function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
248 248
 	{
249 249
         // phpcs:enable
250 250
 		global $conf;
251 251
 
252
-		if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
252
+		if (!empty($conf->global->EXPORT_CSV_FORCE_CHARSET))
253 253
 		{
254 254
 			$outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
255 255
 		}
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 			$outputlangs->charset_output = 'ISO-8859-1';
259 259
 		}
260 260
 
261
-		$this->col=0;
262
-		foreach($array_selected_sorted as $code => $value)
261
+		$this->col = 0;
262
+		foreach ($array_selected_sorted as $code => $value)
263 263
 		{
264
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
265
-			else $alias=substr($code, strpos($code, ' as ') + 4);
266
-			if (empty($alias)) dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.');
264
+			if (strpos($code, ' as ') == 0) $alias = str_replace(array('.', '-', '(', ')'), '_', $code);
265
+			else $alias = substr($code, strpos($code, ' as ') + 4);
266
+			if (empty($alias)) dol_print_error('', 'Bad value for field with key='.$code.'. Try to redefine export.');
267 267
 
268
-			$newvalue=$outputlangs->convToOutputCharset($objp->$alias);		// objp->$alias must be utf8 encoded as any var in memory	// newvalue is now $outputlangs->charset_output encoded
269
-			$typefield=isset($array_types[$code])?$array_types[$code]:'';
268
+			$newvalue = $outputlangs->convToOutputCharset($objp->$alias); // objp->$alias must be utf8 encoded as any var in memory	// newvalue is now $outputlangs->charset_output encoded
269
+			$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
270 270
 
271 271
 			// Translation newvalue
272
-			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
272
+			if (preg_match('/^\((.*)\)$/i', $newvalue, $reg)) $newvalue = $outputlangs->transnoentities($reg[1]);
273 273
 
274
-			$newvalue=$this->csvClean($newvalue,$outputlangs->charset_output);
274
+			$newvalue = $this->csvClean($newvalue, $outputlangs->charset_output);
275 275
 
276 276
 			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
277 277
 			{
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 				$newvalue = $array[$newvalue];
281 281
 			}
282 282
 
283
-			fwrite($this->handle,$newvalue.$this->separator);
283
+			fwrite($this->handle, $newvalue.$this->separator);
284 284
 			$this->col++;
285 285
 		}
286 286
 
287
-		fwrite($this->handle,"\n");
287
+		fwrite($this->handle, "\n");
288 288
 		return 0;
289 289
 	}
290 290
 
@@ -327,39 +327,39 @@  discard block
 block discarded – undo
327 327
 	public function csvClean($newvalue, $charset)
328 328
 	{
329 329
 		global $conf;
330
-		$addquote=0;
330
+		$addquote = 0;
331 331
 
332 332
 
333 333
 		// Rule Dolibarr: No HTML
334 334
    		//print $charset.' '.$newvalue."\n";
335 335
    		//$newvalue=dol_string_nohtmltag($newvalue,0,$charset);
336
-   		$newvalue=dol_htmlcleanlastbr($newvalue);
336
+   		$newvalue = dol_htmlcleanlastbr($newvalue);
337 337
    		//print $charset.' '.$newvalue."\n";
338 338
 
339 339
 		// Rule 1 CSV: No CR, LF in cells (except if USE_STRICT_CSV_RULES is on, we can keep record as it is but we must add quotes)
340
-		$oldvalue=$newvalue;
341
-		$newvalue=str_replace("\r",'',$newvalue);
342
-		$newvalue=str_replace("\n",'\n',$newvalue);
343
-		if (! empty($conf->global->USE_STRICT_CSV_RULES) && $oldvalue != $newvalue)
340
+		$oldvalue = $newvalue;
341
+		$newvalue = str_replace("\r", '', $newvalue);
342
+		$newvalue = str_replace("\n", '\n', $newvalue);
343
+		if (!empty($conf->global->USE_STRICT_CSV_RULES) && $oldvalue != $newvalue)
344 344
 		{
345 345
 			// If strict use of CSV rules, we just add quote
346
-			$newvalue=$oldvalue;
347
-			$addquote=1;
346
+			$newvalue = $oldvalue;
347
+			$addquote = 1;
348 348
 		}
349 349
 
350 350
 		// Rule 2 CSV: If value contains ", we must escape with ", and add "
351
-		if (preg_match('/"/',$newvalue))
351
+		if (preg_match('/"/', $newvalue))
352 352
 		{
353
-			$addquote=1;
354
-			$newvalue=str_replace('"','""',$newvalue);
353
+			$addquote = 1;
354
+			$newvalue = str_replace('"', '""', $newvalue);
355 355
 		}
356 356
 
357 357
 		// Rule 3 CSV: If value contains separator, we must add "
358
-		if (preg_match('/'.$this->separator.'/',$newvalue))
358
+		if (preg_match('/'.$this->separator.'/', $newvalue))
359 359
 		{
360
-			$addquote=1;
360
+			$addquote = 1;
361 361
 		}
362 362
 
363
-		return ($addquote?'"':'').$newvalue.($addquote?'"':'');
363
+		return ($addquote ? '"' : '').$newvalue.($addquote ? '"' : '');
364 364
 	}
365 365
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/export_tsv.modules.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *		\author	    Laurent Destailleur
24 24
  */
25 25
 
26
-require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php';
26
+require_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php';
27 27
 
28 28
 
29 29
 /**
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     public $version_lib;
55 55
 
56
-    public $separator="\t";
56
+    public $separator = "\t";
57 57
 
58
-    public $handle;    // Handle fichier
58
+    public $handle; // Handle fichier
59 59
 
60 60
 
61 61
     /**
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
         global $conf, $langs;
69 69
         $this->db = $db;
70 70
 
71
-        $this->id='tsv';                // Same value then xxx in file name export_xxx.modules.php
72
-        $this->label = 'TSV';             // Label of driver
71
+        $this->id = 'tsv'; // Same value then xxx in file name export_xxx.modules.php
72
+        $this->label = 'TSV'; // Label of driver
73 73
         $this->desc = $langs->trans('TsvFormatDesc');
74
-        $this->extension='tsv';         // Extension for generated file by this driver
75
-        $this->picto='mime/other';		// Picto
76
-        $this->version='1.15';         // Driver version
74
+        $this->extension = 'tsv'; // Extension for generated file by this driver
75
+        $this->picto = 'mime/other'; // Picto
76
+        $this->version = '1.15'; // Driver version
77 77
 
78 78
         // If driver use an external library, put its name here
79
-        $this->label_lib='Dolibarr';
80
-        $this->version_lib=DOL_VERSION;
79
+        $this->label_lib = 'Dolibarr';
80
+        $this->version_lib = DOL_VERSION;
81 81
     }
82 82
 
83 83
 	/**
@@ -159,22 +159,22 @@  discard block
 block discarded – undo
159 159
 	*	@param		Translate	$outputlangs	Output language object
160 160
 	*	@return		int							<0 if KO, >=0 if OK
161 161
     */
162
-    function open_file($file,$outputlangs)
162
+    function open_file($file, $outputlangs)
163 163
     {
164 164
         // phpcs:enable
165 165
         global $langs;
166 166
 
167 167
         dol_syslog("ExportTsv::open_file file=".$file);
168 168
 
169
-        $ret=1;
169
+        $ret = 1;
170 170
 
171 171
         $outputlangs->load("exports");
172 172
 		$this->handle = fopen($file, "wt");
173
-        if (! $this->handle)
173
+        if (!$this->handle)
174 174
 		{
175 175
 			$langs->load("errors");
176
-			$this->error=$langs->trans("ErrorFailToCreateFile",$file);
177
-			$ret=-1;
176
+			$this->error = $langs->trans("ErrorFailToCreateFile", $file);
177
+			$ret = -1;
178 178
 		}
179 179
 
180 180
 		return $ret;
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
      *  @param		array		$array_types					Array with types of fields
205 205
 	 * 	@return		int											<0 if KO, >0 if OK
206 206
 	 */
207
-    function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
207
+    function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
208 208
     {
209 209
         // phpcs:enable
210
-        foreach($array_selected_sorted as $code => $value)
210
+        foreach ($array_selected_sorted as $code => $value)
211 211
         {
212
-            $newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);		// newvalue is now $outputlangs->charset_output encoded
213
-			$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
212
+            $newvalue = $outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded
213
+			$newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output);
214 214
 
215
-			fwrite($this->handle,$newvalue.$this->separator);
215
+			fwrite($this->handle, $newvalue.$this->separator);
216 216
         }
217
-        fwrite($this->handle,"\n");
217
+        fwrite($this->handle, "\n");
218 218
         return 0;
219 219
     }
220 220
 
@@ -229,25 +229,25 @@  discard block
 block discarded – undo
229 229
      *  @param		array		$array_types				Array with types of fields
230 230
 	 * 	@return		int										<0 if KO, >0 if OK
231 231
 	 */
232
-    function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
232
+    function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
233 233
     {
234 234
         // phpcs:enable
235 235
     	global $conf;
236 236
 
237
-		$this->col=0;
238
- 		foreach($array_selected_sorted as $code => $value)
237
+		$this->col = 0;
238
+ 		foreach ($array_selected_sorted as $code => $value)
239 239
         {
240
-			if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-','(',')'),'_',$code);
241
-			else $alias=substr($code, strpos($code, ' as ') + 4);
242
-            if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
240
+			if (strpos($code, ' as ') == 0) $alias = str_replace(array('.', '-', '(', ')'), '_', $code);
241
+			else $alias = substr($code, strpos($code, ' as ') + 4);
242
+            if (empty($alias)) dol_print_error('', 'Bad value for field with code='.$code.'. Try to redefine export.');
243 243
 
244
-            $newvalue=$outputlangs->convToOutputCharset($objp->$alias);		// objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded
245
-            $typefield=isset($array_types[$code])?$array_types[$code]:'';
244
+            $newvalue = $outputlangs->convToOutputCharset($objp->$alias); // objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded
245
+            $typefield = isset($array_types[$code]) ? $array_types[$code] : '';
246 246
 
247 247
             // Translation newvalue
248
-			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
248
+			if (preg_match('/^\((.*)\)$/i', $newvalue, $reg)) $newvalue = $outputlangs->transnoentities($reg[1]);
249 249
 
250
-			$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
250
+			$newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output);
251 251
 
252 252
 			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
253 253
 			{
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
 				$newvalue = $array[$newvalue];
257 257
 			}
258 258
 
259
-			fwrite($this->handle,$newvalue.$this->separator);
259
+			fwrite($this->handle, $newvalue.$this->separator);
260 260
             $this->col++;
261 261
 		}
262
-        fwrite($this->handle,"\n");
262
+        fwrite($this->handle, "\n");
263 263
         return 0;
264 264
     }
265 265
 
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
     {
302 302
         // phpcs:enable
303 303
 		// Rule Dolibarr: No HTML
304
-		$newvalue=dol_string_nohtmltag($newvalue, 1, $charset);
304
+		$newvalue = dol_string_nohtmltag($newvalue, 1, $charset);
305 305
 
306 306
 		// Rule 1 TSV: No CR, LF in cells
307
-    	$newvalue=str_replace("\r",'',$newvalue);
308
-        $newvalue=str_replace("\n",'\n',$newvalue);
307
+    	$newvalue = str_replace("\r", '', $newvalue);
308
+        $newvalue = str_replace("\n", '\n', $newvalue);
309 309
 
310 310
         // Rule 2 TSV: If value contains tab, we must replace by space
311
-		if (preg_match('/'.$this->separator.'/',$newvalue))
311
+		if (preg_match('/'.$this->separator.'/', $newvalue))
312 312
 		{
313
-			$newvalue=str_replace("\t"," ",$newvalue);
313
+			$newvalue = str_replace("\t", " ", $newvalue);
314 314
 		}
315 315
 
316 316
         return $newvalue;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/export/modules_export.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @var string Error code (or message)
35 35
 	 */
36
-	public $error='';
36
+	public $error = '';
37 37
 
38
-	public $driverlabel=array();
38
+	public $driverlabel = array();
39 39
 
40
-	public $driverversion=array();
40
+	public $driverversion = array();
41 41
 
42
-	public $liblabel=array();
42
+	public $liblabel = array();
43 43
 
44
-	public $libversion=array();
44
+	public $libversion = array();
45 45
 
46 46
 
47 47
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
      *  @param  integer	$maxfilenamelength  Max length of value to show
53 53
      *  @return	array						List of templates (same content than array this->driverlabel)
54 54
 	 */
55
-	function liste_modeles($db,$maxfilenamelength=0)
55
+	function liste_modeles($db, $maxfilenamelength = 0)
56 56
 	{
57 57
         // phpcs:enable
58 58
 		dol_syslog(get_class($this)."::liste_modeles");
59 59
 
60
-		$dir=DOL_DOCUMENT_ROOT."/core/modules/export/";
61
-		$handle=opendir($dir);
60
+		$dir = DOL_DOCUMENT_ROOT."/core/modules/export/";
61
+		$handle = opendir($dir);
62 62
 
63 63
 		// Recherche des fichiers drivers exports disponibles
64
-		$i=0;
64
+		$i = 0;
65 65
         if (is_resource($handle))
66 66
         {
67
-    		while (($file = readdir($handle))!==false)
67
+    		while (($file = readdir($handle)) !== false)
68 68
     		{
69
-    			if (preg_match("/^export_(.*)\.modules\.php$/i",$file,$reg))
69
+    			if (preg_match("/^export_(.*)\.modules\.php$/i", $file, $reg))
70 70
     			{
71
-    				$moduleid=$reg[1];
71
+    				$moduleid = $reg[1];
72 72
 
73 73
     				// Loading Class
74 74
     				$file = $dir."export_".$moduleid.".modules.php";
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
         				$module = new $classname($db);
81 81
 
82 82
         				// Picto
83
-        				$this->picto[$module->id]=$module->picto;
83
+        				$this->picto[$module->id] = $module->picto;
84 84
         				// Driver properties
85
-        				$this->driverlabel[$module->id]=$module->getDriverLabel().(empty($module->disabled)?'':' __(Disabled)__');	// '__(Disabled)__' is a key
86
-        				$this->driverdesc[$module->id]=$module->getDriverDesc();
87
-        				$this->driverversion[$module->id]=$module->getDriverVersion();
85
+        				$this->driverlabel[$module->id] = $module->getDriverLabel().(empty($module->disabled) ? '' : ' __(Disabled)__'); // '__(Disabled)__' is a key
86
+        				$this->driverdesc[$module->id] = $module->getDriverDesc();
87
+        				$this->driverversion[$module->id] = $module->getDriverVersion();
88 88
         				// If use an external lib
89
-        				$this->liblabel[$module->id]=$module->getLibLabel();
90
-        				$this->libversion[$module->id]=$module->getLibVersion();
89
+        				$this->liblabel[$module->id] = $module->getLibLabel();
90
+        				$this->libversion[$module->id] = $module->getLibVersion();
91 91
     				}
92 92
     				$i++;
93 93
     			}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modModuleBuilder.class.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *  \ingroup    blockedlog
24 24
  *  \brief      Description and activation file for module ModuleBuilder
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
26
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
27 27
 
28 28
 /**
29 29
  *	Class to describe a ModuleBuilder module
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     function __construct($db)
39 39
     {
40
-    	global $langs,$conf;
40
+    	global $langs, $conf;
41 41
 
42 42
         $this->db = $db;
43 43
         $this->numero = 3300;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 		// It is used to group modules in module setup page
47 47
         $this->family = "technic";
48 48
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49
-        $this->name = preg_replace('/^mod/i','',get_class($this));
49
+        $this->name = preg_replace('/^mod/i', '', get_class($this));
50 50
         $this->description = "A RAD (Rapid Application Development) tool to help developers to build their own module.";
51 51
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
52 52
         $this->version = 'dolibarr';
53 53
         // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
54 54
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55 55
         // Name of image file used for this module.
56
-        $this->picto='technic';
56
+        $this->picto = 'technic';
57 57
 
58 58
         // Data directories to create when module is enabled
59 59
         $this->dirs = array();
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 
65 65
         // Dependencies
66 66
         //-------------
67
-	    $this->hidden = false;	// A condition to disable module
68
-	    $this->depends = array();		// List of modules id that must be enabled if this module is enabled
69
-        $this->requiredby = array();	// List of modules id to disable if this one is disabled
70
-	    $this->conflictwith = array();	// List of modules id this module is in conflict with
67
+	    $this->hidden = false; // A condition to disable module
68
+	    $this->depends = array(); // List of modules id that must be enabled if this module is enabled
69
+        $this->requiredby = array(); // List of modules id to disable if this one is disabled
70
+	    $this->conflictwith = array(); // List of modules id this module is in conflict with
71 71
         $this->langfiles = array();
72 72
 
73 73
         // Constants
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         //------------------
87 87
         $this->menu = array();
88 88
 
89
-        $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
89
+        $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
90 90
             'type'=>'left',
91 91
             'titre'=>'ModuleBuilder',
92 92
             'mainmenu'=>'home',
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/syslog/mod_syslog_chromephp.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		global $langs;
50 50
 
51
-		return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
51
+		return ($this->isActive() == 1) ? '' : $langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php');
52 52
 	}
53 53
 	
54 54
 	/**
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		try
63 63
 		{
64 64
 			if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) {
65
-				$conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/';
65
+				$conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/';
66 66
 			}
67 67
 			set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
68 68
 
69 69
 		    $res = @include_once 'ChromePhp.php';
70
-		    if (! $res) $res=@include_once 'ChromePhp.class.php';
70
+		    if (!$res) $res = @include_once 'ChromePhp.class.php';
71 71
 
72 72
 		    restore_include_path();
73 73
 
74 74
 		    if ($res)
75 75
 		    {
76
-        		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0;    // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
76
+        		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP) ? 1 : 0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
77 77
 		    }
78 78
 		    else
79 79
 		    {
80 80
 		        return 0;
81 81
 		    }
82 82
 		}
83
-		catch(Exception $e)
83
+		catch (Exception $e)
84 84
 		{
85 85
 		    print '<!-- ChromePHP not available into PHP -->'."\n";
86 86
 		}
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 
100 100
 		return array(
101 101
 			array(
102
-				'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'),
102
+				'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'),
103 103
 				'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH',
104
-				'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/',
104
+				'default' => DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/',
105 105
 				'attr' => 'size="60"',
106
-			    'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'
106
+			    'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT.'/includes/ccampbell/chromephp/'
107 107
 			)
108 108
 		);
109 109
 	}
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function checkConfiguration()
117 117
 	{
118
-		global $langs,$conf;
118
+		global $langs, $conf;
119 119
 
120 120
 		$errors = array();
121 121
 
122
-		if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
122
+		if (!file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && !file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
123 123
 		{
124 124
 			$conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop
125 125
 			if (is_object($langs))   // $langs may not be defined yet.
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	{
146 146
 		global $conf;
147 147
 
148
-		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return;	// Global option to disable output of this handler
148
+		if (!empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler
149 149
 
150 150
 		//We check the configuration to avoid showing PHP warnings
151 151
 		if (count($this->checkConfiguration()) > 0) return false;
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		{
155 155
 			// Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from
156 156
 			// database or config file because we must be able to log data before database or config file read.
157
-			$oldinclude=get_include_path();
157
+			$oldinclude = get_include_path();
158 158
 			set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
159 159
 		    $res = @include_once 'ChromePhp.php';
160
-		    if (! $res) $res=@include_once 'ChromePhp.class.php';
160
+		    if (!$res) $res = @include_once 'ChromePhp.class.php';
161 161
 			set_include_path($oldinclude);
162 162
 			
163
-			ob_start();	// To be sure headers are not flushed until all page is completely processed
163
+			ob_start(); // To be sure headers are not flushed until all page is completely processed
164 164
 			if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
165 165
 			elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
166 166
 			elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/syslog/mod_syslog_syslog.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		// This function does not exists on some ISP (Ex: Free in France)
54 54
 		if (!function_exists('openlog')) return 0;
55 55
 
56
-		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0;    // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler
56
+		return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG) ? 1 : 0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler
57 57
 	}
58 58
 
59 59
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	    if ($facility)
90 90
 		{
91 91
 			// Only LOG_USER supported on Windows
92
-			if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER');
92
+			if (!empty($_SERVER["WINDIR"])) $facility = constant('LOG_USER');
93 93
 
94 94
 			dol_syslog("admin/syslog: facility ".$facility);
95 95
 		}
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 	{
112 112
 		global $conf;
113 113
 
114
-		if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return;	// Global option to disable output of this handler
114
+		if (!empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler
115 115
 
116
-		if (! empty($conf->global->SYSLOG_FACILITY))  // Example LOG_USER
116
+		if (!empty($conf->global->SYSLOG_FACILITY))  // Example LOG_USER
117 117
 		{
118 118
 			$facility = constant($conf->global->SYSLOG_FACILITY);
119 119
 		}
Please login to merge, or discard this patch.