[Koha-patches] [PATCH] [SIGNED-OFF] Bug 6614: Remove newlines from order notes when exporting to CSV

Nicole C. Engard nengard at bywatersolutions.com
Tue Jul 26 20:22:53 CEST 2011


From: Ian Walls <ian.walls at bywatersolutions.com>

Newline is not a valid character to Text::CSV's combine() subroutine.  If an order
contained a note with a newline in it, that line would come out as a blank entry in
the exported CSV.  This patch strips such characters, globally.

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
 C4/Acquisition.pm |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 09cb39c..738fe16 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -241,6 +241,8 @@ sub GetBasketAsCSV {
     my @rows;
     foreach my $order (@orders) {
 	my @cols;
+	# newlines are not valid characters for Text::CSV combine()
+        $order->{'notes'} =~ s/[\r\n]+//g;
 	push(@cols,
 		$contract->{'contractname'},
 		$order->{'ordernumber'},
-- 
1.7.2.3



More information about the Koha-patches mailing list