Mantis Bug Tracker
 

View Issue Details Jump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010420mantisbtcsvpublic2009-04-27 08:022009-06-23 15:26
Reporterkesterhabermann 
Assigned Tograngeway 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformanyOSanyOS Versionany
Product Version1.1.7 
Target VersionFixed in Version1.2.0rc1 
Summary0010420: Custom fields with newline break CSV export
DescriptionMultiline entries in custom fields break CSV export as the newlines appear in the CSV.

The following change to "csv_export.php" and "core/csv_api.php" will remove the newlines in the CSV export for all fields:

--- mantisbt-1.1.7.orig/csv_export.php 2009-04-20 15:14:00.000000000 +0200
+++ mantisbt-1.1.7/csv_export.php 2009-04-27 11:38:07.352036000 +0200
@@ -116,11 +117,7 @@
                                helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_CSV_PAGE ) );
                                $t_value = ob_get_clean();

- if ( strstr( $t_value, $t_sep ) !== false ) {
- $t_value = '"' . $t_value . '"';
- }
-
- echo $t_value;
+ echo csv_escape_string($t_value);
                        } else {
                                $t_function = 'csv_format_' . $t_column;
                                echo $t_function( $t_row[ $t_column ] );
--- mantisbt-1.1.7.orig/core/csv_api.php 2009-04-20 15:14:00.000000000 +0200
+++ mantisbt-1.1.7/core/csv_api.php 2009-04-27 11:23:37.844829000 +0200
@@ -57,6 +57,9 @@
                        $p_str = '"' . str_replace( '"', '""', $p_str ) . '"';
                }

+ $p_str = str_replace("\n", '', $p_str);
+ $p_str = str_replace("\r", '', $p_str);
+
                return $p_str;
        }
TagsNo tags attached.
Attached Filespatch file icon mantisbt-1.1.7-csv.patch [^] (937 bytes) 2009-04-27 08:09 [Show Content]

- Relationships

-  Notes
User avatar (0021890)
grangeway (developer)
2009-05-23 12:27

Partial commit of your patch

in 1.2, it looks like csv_escape_string has been modified to quote strings containing new line characters

Paul
User avatar (0022113)
kesterhabermann (reporter)
2009-06-12 05:51

Still broken in 1.1.8.

- Issue History
Date Modified Username Field Change
2009-04-27 08:02 kesterhabermann New Issue
2009-04-27 08:09 kesterhabermann File Added: mantisbt-1.1.7-csv.patch
2009-05-23 12:27 grangeway Note Added: 0021890
2009-05-23 12:27 grangeway Status new => resolved
2009-05-23 12:27 grangeway Fixed in Version => 1.2.x
2009-05-23 12:27 grangeway Resolution open => fixed
2009-05-23 12:27 grangeway Assigned To => grangeway
2009-06-12 05:51 kesterhabermann Note Added: 0022113
2009-06-23 15:26 jreese Status resolved => closed


MantisBT 1.2.2 git master-1.2.x[^]
Copyright © 2000 - 2010 MantisBT Group
Time: 0.2440 seconds.
memory usage: 1,945 KB
Powered by Mantis Bugtracker