From 93bc3af5a9b72d5d15a76648e9b9cd7a963bd05f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 1 Feb 2021 15:57:24 +0100 Subject: [PATCH] Bug 27569: Fix ODS export - take empty string into account If a cell contains an empty string it was not taken into account. Test plan: Same as CSV but with ODS Signed-off-by: Ron Houk Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- C4/ImportExportFramework.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/ImportExportFramework.pm b/C4/ImportExportFramework.pm index 2350cfa446..ea4884f12d 100644 --- a/C4/ImportExportFramework.pm +++ b/C4/ImportExportFramework.pm @@ -907,6 +907,8 @@ sub _processRows_Table my ($dataFields, $dataFieldsR) = _getDataFields($frameworkcode, $nodeR, \@fields, $format); if (scalar(@fields) == scalar(@$dataFieldsR)) { $ok = _processRow_DB($dbh, $table, $fields, $dataStr, $updateStr, $dataFieldsR, $dataFields, $PKArray, \@fieldsPK, $fields2Delete); + } else { + warn "$j don't match number of fields " . scalar(@fields) . ' vs ' . scalar(@$dataFieldsR) . "($dataStr)"; } } $j++; @@ -1079,7 +1081,7 @@ sub _getDataFields if ($format && $format eq 'ods') { ($data, $repeated) = _getDataNodeODS($node2) if ($repeated <= 0); $repeated--; - $ok = 1 if (defined($data)); + $ok = 1; } else { if ($node2->nodeType == 1 && $node2->nodeName =~ /(?:ss:)?Cell/) { my @nodes3 = $node2->getElementsByTagNameNS('urn:schemas-microsoft-com:office:spreadsheet', 'Data'); @@ -1090,6 +1092,7 @@ sub _getDataFields } } if ($ok) { + $data //= ''; $data = '' if ($data eq '#'); $data = $frameworkcode if ($fields->[$i] eq 'frameworkcode'); $dataFields->{$fields->[$i]} = $data; -- 2.39.5