4 [% INCLUDE 'doc-head-open.inc' %]
6 Koha › Tools › CSV profiles
7 [% IF op == 'add_form' %]
9 › Modify a CSV profile
11 › New CSV profile
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 An error occurred when updating this CSV profile. Perhaps it already exists.
65 [% CASE 'error_on_insert' %]
66 An error occurred when adding this CSV profile.
67 [% CASE 'error_on_delete' %]
68 An error occurred when deleting this CSV profile. Check the logs.
69 [% CASE 'success_on_update' %]
70 CSV profile updated successfully.
71 [% CASE 'success_on_insert' %]
72 CSV profile added successfully.
73 [% CASE 'success_on_delete' %]
74 CSV profile deleted successfully.
75 [% CASE 'already_exists' %]
76 This CSV profile already exists.
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 [% IF selected_separator == '\t' %]
110 <option value="\t" selected="selected">Tabulation (\t)</option>
112 <option value="\t">Tabulation (\t)</option>
114 [% IF selected_separator == '\n' %]
115 <option value="\n" selected="selected">New line (\n)</option>
117 <option value="\n">New line (\n)</option>
121 [% BLOCK type_description %]
122 [% IF type_code == 'marc' %] MARC
123 [% ELSIF type_code == 'sql' %] SQL
124 [% ELSE %] Unknown type
128 [% BLOCK used_for_description %]
129 [% IF used_for_code == 'export_records' %] Export records
130 [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
131 [% ELSIF used_for_code == 'late_orders' %] Export late orders
132 [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
133 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
134 [% ELSE %] Unknown usage
138 [% IF op == 'add_form' %]
140 <h1>Modify a CSV profile</h1>
142 <h1>New CSV profile</h1>
145 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
146 <input type="hidden" name="op" value="add_validate" />
147 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
148 <fieldset class="rows">
151 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
154 <label for="profile" class="required">Profile name: </label>
155 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
156 <span class="required">Required</span>
159 <label for="type" class="required">Profile type: </label>
160 <select id="type" name="type">
161 [% FOREACH type IN [ 'marc' 'sql'] %]
162 [% IF csv_profile.type == type %]
163 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
165 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
169 <span class="required">Required</span>
171 <li class="sql_specific">
172 <label for="used_for_sql">Usage: </label>
173 <select id="used_for_sql" name="used_for_sql">
174 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
175 [% IF csv_profile.used_for == used_for %]
176 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
178 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
183 <li class="marc_specific">
184 <label for="used_for_marc">Usage: </label>
185 <select id="used_for_marc" name="used_for_marc">
186 [% FOREACH used_for IN [ 'export_records' ] %]
187 [% IF csv_profile.used_for == used_for %]
188 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
190 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
196 <label for="description">Profile description: </label>
197 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
200 <label for="csv_separator">CSV separator: </label>
201 <select name="csv_separator" id="csv_separator">
202 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
206 <li class="marc_specific">
207 <label for="field_separator">Field separator: </label>
208 <select name="field_separator" id="field_separator">
209 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
213 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
214 <select name="subfield_separator" id="subfield_separator">
215 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
219 <li class="marc_specific"><label for="encoding">Encoding: </label>
220 <select name="encoding" id="encoding">
221 [% FOREACH encoding IN encodings %]
222 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
223 <option selected="selected">[% encoding | html %]</option>
225 <option>[% encoding | html %]</option>
231 <li class="marc_specific">
232 <label for="staff_only">Only available on the staff interface: </label>
233 [% IF csv_profile.staff_only %]
234 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
236 <input type="checkbox" name="staff_only" id="staff_only" value="1">
240 <li class="marc_specific">
241 <label for="marc_content" class="required">Profile MARC fields: </label>
242 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
243 <span class="required">Required</span>
244 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
245 <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>
246 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
247 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
250 <li class="sql_specific">
251 <label for="sql_content" class="required">Profile SQL fields: </label>
252 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
253 <p>You have to define which fields you want to export, separated by pipes.</p>
254 <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>
255 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
256 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
257 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
258 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
262 <fieldset class="action">
263 <input type="submit" value="Submit" />
264 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
269 [% IF op == 'delete_confirm' %]
270 <div class="dialog alert">
272 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
273 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
274 <input type="hidden" name="op" value="delete_confirmed" />
275 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
276 <input type="submit" class="approve" value="Yes, delete" />
278 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
279 <input type="submit" class="deny" value="No, do not Delete" />
282 This CSV Profile does not exist.
287 [% IF op == 'list' %]
289 <div id="toolbar" class="btn-toolbar">
290 <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>
293 <h2>CSV profiles</h2>
295 [% IF csv_profiles %]
296 <table id="table_csv_profiles">
298 <th>CSV profile ID</th>
302 <th>CSV separator</th>
305 <th class="noExport">Actions</th>
308 [% FOREACH csv_profile IN csv_profiles %]
310 <td>[% csv_profile.export_format_id | html %]</td>
311 <td>[% csv_profile.profile | html %]</td>
312 <td>[% csv_profile.description | html %]</td>
313 <td>[% csv_profile.content | html | html_line_break %]</td>
314 <td>[% csv_profile.csv_separator | html %]</td>
315 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
316 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
318 <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>
319 <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>
326 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
331 </div> <!-- /.col-sm-10.col-sm-push-2 -->
333 <div class="col-sm-2 col-sm-pull-10">
335 [% INCLUDE 'tools-menu.inc' %]
337 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
338 </div> <!-- /.row -->
340 [% MACRO jsinclude BLOCK %]
341 [% Asset.js("js/tools-menu.js") | $raw %]
343 function reloadPage(p) {
345 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
347 $(document).ready(function() {
348 $("#type").change(function(){
349 if ( $(this).find("option:selected").val() == "marc" ) {
350 $("li.marc_specific").show();
351 $("#marc_content").attr("required", "required");
352 $("li.sql_specific").hide();
353 $("#sql_content").removeAttr("required");
355 $("li.marc_specific").hide();
356 $("#marc_content").removeAttr("required");
357 $("li.sql_specific").show();
358 $("#sql_content").attr("required", "required");
366 [% INCLUDE 'intranet-bottom.inc' %]