Bonjour,

I would like to add support of using comma instead of semicolon for the CSV export function. The patch provided below makes it a tiny bit easier to switch from semicolon to comma by editing config/define.php. This is useful in countries that use period instead of comma for decimal places, such as USA, Canada, Japan, and many others. I am not attempting a corresponding settings or setup feature, but I would happily do so in a future patch if the primary developers tell me where they would want it. The patch works with glpi-0.78-RC2 and appears workable with 0.80-work. It changes only 2 lines and inserts 2 more.

Je vous remercie pour votre excellent produit et j'espère que vous accepter ma contribution.

Kevin Walsh
New Jersey Institute of Technology, USA
diff -crB ../glpi-0.78-RC2/config/define.php ./config/define.php
*** ../glpi-0.78-RC2/config/define.php  2010-07-07 08:44:34.000000000 -0400
--- ./config/define.php 2010-07-07 18:12:23.000000000 -0400
***************
*** 269,274 ****
--- 269,275 ----
  // New config options which can be missing during migration
  $CFG_GLPI["number_format"]=0;
  $CFG_GLPI["decimal_number"]=2;
+ $CFG_GLPI["csv_export_delimiter"]=';';
  
  
  // Default debug options : may be locally overriden
Only in .: csv_patch.txt
diff -crB ../glpi-0.78-RC2/inc/search.class.php ./inc/search.class.php
*** ../glpi-0.78-RC2/inc/search.class.php       2010-07-07 08:44:34.000000000 
-0400
--- ./inc/search.class.php      2010-07-07 18:50:14.000000000 -0400
***************
*** 4456,4462 ****
              break;
  
           case CSV_OUTPUT : //CSV
!             $out="\"".csv_clean($value)."\";";
              break;
  
           default :
--- 4456,4462 ----
              break;
  
           case CSV_OUTPUT : //CSV
!             
$out="\"".csv_clean($value)."\"".$CFG_GLPI["csv_export_delimiter"];
              break;
  
           default :
***************
*** 4496,4501 ****
--- 4496,4502 ----
     *
     **/
     static function showItem($type,$value,&$num,$row,$extraparam='') {
+       global $CFG_GLPI;
  
        $out="";
        switch ($type) {
***************
*** 4516,4522 ****
  
           case CSV_OUTPUT : //csv
              $value = weblink_extract($value);
!             $out="\"".csv_clean($value)."\";";
              break;
  
           default :
--- 4517,4523 ----
  
           case CSV_OUTPUT : //csv
              $value = weblink_extract($value);
!             
$out="\"".csv_clean($value)."\"".$CFG_GLPI["csv_export_delimiter"];
              break;
  
           default :
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to