4 [% INCLUDE 'doc-head-open.inc' %]
6 [% IF op == 'add_form' %]
8 Modify a CSV profile ›
10 New CSV profile ›
13 CSV export profiles › Tools › Koha
15 [% INCLUDE 'doc-head-close.inc' %]
18 <body id="tools_csv-profiles" class="tools">
19 [% INCLUDE 'header.inc' %]
20 [% INCLUDE 'cat-search.inc' %]
22 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
25 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
28 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
30 [% IF op == 'add_form' %]
32 <a href="/cgi-bin/koha/tools/csv-profiles.pl">
38 <a href="#" aria-current="page">Modify a CSV profile</a>
42 <a href="#" aria-current="page">New CSV profile</a>
47 <a href="#" aria-current="page">
55 <div class="main container-fluid">
57 <div class="col-sm-10 col-sm-push-2">
60 [% FOR m IN messages %]
61 <div class="dialog [% m.type | html %]">
63 [% CASE 'error_on_update' %]
64 <span>An error occurred when updating this CSV profile. Perhaps it already exists</span>
65 [% CASE 'error_on_insert' %]
66 <span>An error occurred when adding this CSV profile</span>
67 [% CASE 'error_on_delete' %]
68 <span>An error occurred when deleting this CSV profile. Check the logs</span>
69 [% CASE 'success_on_update' %]
70 <span>CSV profile updated successfully</span>
71 [% CASE 'success_on_insert' %]
72 <span>CSV profile added successfully</span>
73 [% CASE 'success_on_delete' %]
74 <span>CSV profile deleted successfully</span>
75 [% CASE 'already_exists' %]
76 <span>This CSV profile already exists</span>
78 <span>[% m.code | html %]</span>
83 [% BLOCK list_separator_options %]
84 [% IF selected_separator == ',' %]
85 <option value="," selected="selected">Comma (,)</option>
87 <option value=",">Comma (,)</option>
89 [% IF selected_separator == '|' %]
90 <option value="|" selected="selected">Pipe (|)</option>
92 <option value="|">Pipe (|)</option>
94 [% IF selected_separator == ';' %]
95 <option value=";" selected="selected">Semi-colon (;)</option>
97 <option value=";">Semi-colon (;)</option>
99 [% IF selected_separator == '#' %]
100 <option value="#" selected="selected">Sharp (#)</option>
102 <option value="#">Sharp (#)</option>
104 [% IF selected_separator == ' ' %]
105 <option value=" " selected="selected">Space ( )</option>
107 <option value=" ">Space ( )</option>
109 [% tab_char = '\t' %]
110 [% IF selected_separator == '\t' %]
111 <option value="\t" selected="selected">Tabulation ([% tab_char | html %])</option>
113 <option value="\t">Tabulation ([% tab_char | html %])</option>
115 [% new_line_char = '\n' %]
116 [% IF selected_separator == '\n' %]
117 <option value="\n" selected="selected">New line ([% new_line_char | html %])</option>
119 <option value="\n">New line ([% new_line_char | html %])</option>
123 [% BLOCK type_description %]
124 [% IF type_code == 'marc' %] <span>MARC</span>
125 [% ELSIF type_code == 'sql' %] <span>SQL</span>
126 [% ELSE %] <span>Unknown type</span>
130 [% BLOCK used_for_description %]
131 [% IF used_for_code == 'export_records' %] <span>Export records</span>
132 [% ELSIF used_for_code == 'late_issues' %] <span>Late serial issues claims</span>
133 [% ELSIF used_for_code == 'late_orders' %] <span>Export late orders</span>
134 [% ELSIF used_for_code == 'export_basket' %] <span>Basket export in acquisition</span>
135 [% ELSIF used_for_code == 'export_lost_items' %] <span>Export lost items in report</span>
136 [% ELSE %] <span>Unknown usage</span>
140 [% IF op == 'add_form' %]
142 <h1>Modify a CSV profile</h1>
144 <h1>New CSV profile</h1>
147 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
148 <input type="hidden" name="op" value="add_validate" />
149 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
150 <fieldset class="rows">
153 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
156 <label for="profile" class="required">Profile name: </label>
157 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
158 <span class="required">Required</span>
161 <label for="type" class="required">Profile type: </label>
162 <select id="type" name="type">
163 [% FOREACH type IN [ 'marc' 'sql'] %]
164 [% IF csv_profile.type == type %]
165 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
167 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
171 <span class="required">Required</span>
173 <li class="sql_specific">
174 <label for="used_for_sql">Usage: </label>
175 <select id="used_for_sql" name="used_for_sql">
176 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
177 [% IF csv_profile.used_for == used_for %]
178 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
180 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
185 <li class="marc_specific">
186 <label for="used_for_marc">Usage: </label>
187 <select id="used_for_marc" name="used_for_marc">
188 [% FOREACH used_for IN [ 'export_records' ] %]
189 [% IF csv_profile.used_for == used_for %]
190 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
192 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
198 <label for="description">Profile description: </label>
199 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
202 <label for="csv_separator">CSV separator: </label>
203 <select name="csv_separator" id="csv_separator">
204 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
208 <li class="marc_specific">
209 <label for="field_separator">Field separator: </label>
210 <select name="field_separator" id="field_separator">
211 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
215 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
216 <select name="subfield_separator" id="subfield_separator">
217 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
221 <li class="marc_specific"><label for="encoding">Encoding: </label>
222 <select name="encoding" id="encoding">
223 [% FOREACH encoding IN encodings %]
224 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
225 <option selected="selected">[% encoding | html %]</option>
227 <option>[% encoding | html %]</option>
233 <li class="marc_specific">
234 <label for="staff_only">Only available on the staff interface: </label>
235 [% IF csv_profile.staff_only %]
236 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
238 <input type="checkbox" name="staff_only" id="staff_only" value="1">
242 <li class="marc_specific">
243 <label for="marc_content" class="required">Profile MARC fields: </label>
244 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
245 <span class="required">Required</span>
246 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
247 <p>You can also use your own headers (instead of the ones from Koha) by prefixing the field number with an header, followed by the equal sign.</p>
248 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
249 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
252 <li class="sql_specific">
253 <label for="sql_content" class="required">Profile SQL fields: </label>
254 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
255 <p>You have to define which fields you want to export, separated by pipes.</p>
256 <p>You can also use your own headers (instead of the ones from Koha) by prefixing the field name with an header, followed by the equal sign.</p>
257 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
258 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
259 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
260 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
264 <fieldset class="action">
265 <input type="submit" value="Submit" />
266 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
271 [% IF op == 'delete_confirm' %]
272 <div class="dialog alert">
274 <h1>Delete CSV Profile "[% csv_profile.profile | html %]?"</h1>
275 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
276 <input type="hidden" name="op" value="delete_confirmed" />
277 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
278 <input type="submit" class="approve" value="Yes, delete" />
280 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
281 <input type="submit" class="deny" value="No, do not Delete" />
284 This CSV Profile does not exist.
289 [% IF op == 'list' %]
291 <div id="toolbar" class="btn-toolbar">
292 <a class="btn btn-default" id="newcsvprofile" href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form"><i class="fa fa-plus"></i> New CSV profile</a>
295 <h1>CSV profiles</h1>
297 [% IF csv_profiles %]
298 <table id="table_csv_profiles">
300 <th>CSV profile ID</th>
304 <th>CSV separator</th>
307 <th class="noExport">Actions</th>
310 [% FOREACH csv_profile IN csv_profiles %]
312 <td>[% csv_profile.export_format_id | html %]</td>
313 <td>[% csv_profile.profile | html %]</td>
314 <td>[% csv_profile.description | html %]</td>
315 <td>[% csv_profile.content | html | html_line_break %]</td>
316 <td>[% csv_profile.csv_separator | html %]</td>
317 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
318 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
320 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
321 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
328 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
333 </div> <!-- /.col-sm-10.col-sm-push-2 -->
335 <div class="col-sm-2 col-sm-pull-10">
337 [% INCLUDE 'tools-menu.inc' %]
339 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
340 </div> <!-- /.row -->
342 [% MACRO jsinclude BLOCK %]
343 [% Asset.js("js/tools-menu.js") | $raw %]
345 function reloadPage(p) {
347 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
349 $(document).ready(function() {
350 $("#type").change(function(){
351 if ( $(this).find("option:selected").val() == "marc" ) {
352 $("li.marc_specific").show();
353 $("#marc_content").attr("required", "required");
354 $("li.sql_specific").hide();
355 $("#sql_content").removeAttr("required");
357 $("li.marc_specific").hide();
358 $("#marc_content").removeAttr("required");
359 $("li.sql_specific").show();
360 $("#sql_content").attr("required", "required");
368 [% INCLUDE 'intranet-bottom.inc' %]