View | Details | Raw Unified | Return to bug 6727
Collapse All | Expand All

(-)a/C4/ImportExportFramework.pm (-1 / +13 lines)
Lines 322-327 sub _export_table_csv Link Here
322
        my $data;
322
        my $data;
323
        while (my $hashRef = $sth->fetchrow_hashref) {
323
        while (my $hashRef = $sth->fetchrow_hashref) {
324
            for (@fields) {
324
            for (@fields) {
325
                $hashRef->{$_} =~ s/[\r\n]//g;
325
                $$strCSV .= '"' . $hashRef->{$_} . '",';
326
                $$strCSV .= '"' . $hashRef->{$_} . '",';
326
            }
327
            }
327
            chop $$strCSV;
328
            chop $$strCSV;
Lines 1133-1138 sub _import_table_csv Link Here
1133
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $fields2Delete, $fields) = @_;
1134
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $fields2Delete, $fields) = @_;
1134
1135
1135
    my $row = '';
1136
    my $row = '';
1137
    my $partialRow = '';
1136
    my $numFields = @$fields;
1138
    my $numFields = @$fields;
1137
    my $fieldsNameRead = 0;
1139
    my $fieldsNameRead = 0;
1138
    my @arrData;
1140
    my @arrData;
Lines 1145-1150 sub _import_table_csv Link Here
1145
    my $pos = 0;
1147
    my $pos = 0;
1146
    while (<$dom>) {
1148
    while (<$dom>) {
1147
        $row = $_;
1149
        $row = $_;
1150
        # Check whether the line has an unfinished field, i.e., a field with CR/LF in its data
1151
        if ($row =~ /,"[^"]*[\r\n]+$/ || $row =~ /^[^"]+[\r\n]+$/) {
1152
            $row =~ s/[\r\n]+$//;
1153
            $partialRow .= $row;
1154
            next;
1155
        }
1156
        if ($partialRow) {
1157
            $row = $partialRow . $row;
1158
            $partialRow = '';
1159
        }
1160
        # Line OK, process it
1148
        if ($row =~ /(?:".*?",?)+/) {
1161
        if ($row =~ /(?:".*?",?)+/) {
1149
            @arrData = split('","', $row);
1162
            @arrData = split('","', $row);
1150
            $arrData[0] = substr($arrData[0], 1) if ($arrData[0] =~ /^"/);
1163
            $arrData[0] = substr($arrData[0], 1) if ($arrData[0] =~ /^"/);
1151
- 

Return to bug 6727