[Koha-patches] [PATCH 9/9] MT2116 : CSV Exports : add 'new line' as separator

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Tue Feb 16 21:46:57 CET 2010


From: Matthias Meusburger <matthias.meusburger at biblibre.com>

---
 C4/Record.pm                                       |    4 ++-
 .../prog/en/modules/tools/csv-profiles.tmpl        |   33 ++++++++++++++++---
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/C4/Record.pm b/C4/Record.pm
index 20901b6..1acad7a 100644
--- a/C4/Record.pm
+++ b/C4/Record.pm
@@ -425,7 +425,9 @@ sub marcrecord2csv {
     if ($csvseparator eq '\t') { $csvseparator = "\t" }
     if ($fieldseparator eq '\t') { $fieldseparator = "\t" }
     if ($subfieldseparator eq '\t') { $subfieldseparator = "\t" }
-
+    if ($csvseparator eq '\n') { $csvseparator = "\n" }
+    if ($fieldseparator eq '\n') { $fieldseparator = "\n" }
+    if ($subfieldseparator eq '\n') { $subfieldseparator = "\n" }
 
     $csv = $csv->encoding_out($encoding) ;
     $csv->sep_char($csvseparator);
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl
index 7ca532f..fd8ed2e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tmpl
@@ -68,7 +68,9 @@ function reloadPage(p) {
 							<option value="#">Sharp (#)</option>
 							<option value=" ">Space ( )</option>
 							<option value="\t">Tabulation (\t)</option>
-						    </select></li>
+							<option value="\n">New line (\n)</option>
+						    </select>
+                            </li>
 
 						    <li><label for="new_field_separator">Field separator: </label>
 						    <select name="field_separator" id="new_field_separator">
@@ -79,7 +81,9 @@ function reloadPage(p) {
 							<option value="#" selected="selected">Sharp (#)</option>
 							<option value=" ">Space ( )</option>
 							<option value="\t">Tabulation (\t)</option>
-						    </select></li>
+							<option value="\n">New line (\n)</option>
+						    </select>
+                            </li>
 
 						    <li><label for="new_subfield_separator">Subfield separator: </label>
 						    <select name="subfield_separator" id="new_subfield_separator">
@@ -90,8 +94,10 @@ function reloadPage(p) {
 							<option value="#">Sharp (#)</option>
 							<option value=" ">Space ( )</option>
 							<option value="\t">Tabulation (\t)</option>
-						    </select></li>
-
+							<option value="\n">New line (\n)</option>
+						    </select>
+                            </li>
+					
 						    <li><label for="new_encoding">Encoding: </label>
 						    <select name="encoding" id="new_encoding">
 							<!-- TMPL_LOOP NAME="encodings" -->
@@ -167,7 +173,12 @@ function reloadPage(p) {
 								<!--TMPL_ELSE -->
 								<option value="\t">Tabulation (\t)</option>
 								<!-- /TMPL_IF -->
-						    </select></li>
+						    	<!-- TMPL_IF EXPR="selected_csv_separator eq '\n'" -->
+								<option value="\n" selected="selected">New line (\n)</option>
+								<!--TMPL_ELSE -->
+								<option value="\n">New line (\n)</option>
+								<!-- /TMPL_IF -->
+                            </select></li>
 
 						    <li><label for="field_separator">Field separator: </label>
 						    <select name="field_separator" id="field_separator">
@@ -208,6 +219,11 @@ function reloadPage(p) {
                                 <!--TMPL_ELSE -->
                                 <option value="\t">Tabulation (\t)</option>
                                 <!-- /TMPL_IF -->
+						    	<!-- TMPL_IF EXPR="selected_field_separator eq '\n'" -->
+								<option value="\n" selected="selected">New line (\n)</option>
+								<!--TMPL_ELSE -->
+								<option value="\n">New line (\n)</option>
+								<!-- /TMPL_IF -->
 						    </select></li>
 
 
@@ -251,7 +267,12 @@ function reloadPage(p) {
                                 <!--TMPL_ELSE -->
                                 <option value="\t">Tabulation (\t)</option>
                                 <!-- /TMPL_IF -->
-
+						    	<!-- TMPL_IF EXPR="selected_subfield_separator eq '\n'" -->
+								<option value="\n" selected="selected">New line (\n)</option>
+								<!--TMPL_ELSE -->
+								<option value="\n">New line (\n)</option>
+                                <!-- /TMPL_IF -->
+	
 						    </select></li>
 
 						    <li><label for="encoding">Encoding: </label>
-- 
1.6.3.3




More information about the Koha-patches mailing list