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 [% WRAPPER 'header.inc' %]
20 [% INCLUDE 'cat-search.inc' %]
23 [% WRAPPER 'sub-header.inc' %]
24 [% WRAPPER breadcrumbs %]
25 [% WRAPPER breadcrumb_item %]
26 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28 [% IF op == 'add_form' %]
29 [% WRAPPER breadcrumb_item %]
30 <a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a>
33 [% WRAPPER breadcrumb_item bc_active= 1 %]
34 <span>Modify a CSV profile</span>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 <span>New CSV profile</span>
42 [% WRAPPER breadcrumb_item bc_active= 1 %]
43 <span>CSV profiles</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 <div class="main container-fluid">
51 <div class="col-sm-10 col-sm-push-2">
54 [% FOR m IN messages %]
55 <div class="dialog [% m.type | html %]">
57 [% CASE 'error_on_update' %]
58 <span>An error occurred when updating this CSV profile. Perhaps it already exists</span>
59 [% CASE 'error_on_insert' %]
60 <span>An error occurred when adding this CSV profile</span>
61 [% CASE 'error_on_delete' %]
62 <span>An error occurred when deleting this CSV profile. Check the logs</span>
63 [% CASE 'success_on_update' %]
64 <span>CSV profile updated successfully</span>
65 [% CASE 'success_on_insert' %]
66 <span>CSV profile added successfully</span>
67 [% CASE 'success_on_delete' %]
68 <span>CSV profile deleted successfully</span>
69 [% CASE 'already_exists' %]
70 <span>This CSV profile already exists</span>
72 <span>[% m.code | html %]</span>
77 [% BLOCK list_separator_options %]
78 [% IF selected_separator == ',' %]
79 <option value="," selected="selected">Comma (,)</option>
81 <option value=",">Comma (,)</option>
83 [% IF selected_separator == '|' %]
84 <option value="|" selected="selected">Pipe (|)</option>
86 <option value="|">Pipe (|)</option>
88 [% IF selected_separator == ';' %]
89 <option value=";" selected="selected">Semi-colon (;)</option>
91 <option value=";">Semi-colon (;)</option>
93 [% IF selected_separator == '#' %]
94 <option value="#" selected="selected">Sharp (#)</option>
96 <option value="#">Sharp (#)</option>
98 [% IF selected_separator == ' ' %]
99 <option value=" " selected="selected">Space ( )</option>
101 <option value=" ">Space ( )</option>
103 [% IF selected_separator == '\t' %]
104 <option value="\t" selected="selected">Tabulation (\t)</option>
106 <option value="\t">Tabulation (\t)</option>
108 [% IF selected_separator == '\n' %]
109 <option value="\n" selected="selected">New line (\n)</option>
111 <option value="\n">New line (\n)</option>
115 [% BLOCK type_description %]
116 [% IF type_code == 'marc' %] <span>MARC</span>
117 [% ELSIF type_code == 'sql' %] <span>SQL</span>
118 [% ELSE %] <span>Unknown type</span>
122 [% BLOCK used_for_description %]
123 [% IF used_for_code == 'export_records' %] <span>Export records</span>
124 [% ELSIF used_for_code == 'late_issues' %] <span>Late serial issues claims</span>
125 [% ELSIF used_for_code == 'late_orders' %] <span>Export late orders</span>
126 [% ELSIF used_for_code == 'export_basket' %] <span>Basket export in acquisition</span>
127 [% ELSIF used_for_code == 'export_lost_items' %] <span>Export lost items in report</span>
128 [% ELSE %] <span>Unknown usage</span>
132 [% IF op == 'add_form' %]
134 <h1>Modify a CSV profile</h1>
136 <h1>New CSV profile</h1>
139 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
140 <input type="hidden" name="op" value="add_validate" />
141 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
142 <fieldset class="rows">
145 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
148 <label for="profile" class="required">Profile name: </label>
149 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
150 <span class="required">Required</span>
153 <label for="type" class="required">Profile type: </label>
154 <select id="type" name="type">
155 [% FOREACH type IN [ 'marc' 'sql'] %]
156 [% IF csv_profile.type == type %]
157 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
159 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
163 <span class="required">Required</span>
165 <li class="sql_specific">
166 <label for="used_for_sql">Usage: </label>
167 <select id="used_for_sql" name="used_for_sql">
168 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
169 [% IF csv_profile.used_for == used_for %]
170 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
172 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
177 <li class="marc_specific">
178 <label for="used_for_marc">Usage: </label>
179 <select id="used_for_marc" name="used_for_marc">
180 [% FOREACH used_for IN [ 'export_records' ] %]
181 [% IF csv_profile.used_for == used_for %]
182 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
184 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
190 <label for="description">Profile description: </label>
191 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
194 <label for="csv_separator">CSV separator: </label>
195 <select name="csv_separator" id="csv_separator">
196 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
200 <li class="marc_specific">
201 <label for="field_separator">Field separator: </label>
202 <select name="field_separator" id="field_separator">
203 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
207 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
208 <select name="subfield_separator" id="subfield_separator">
209 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
213 <li class="marc_specific"><label for="encoding">Encoding: </label>
214 <select name="encoding" id="encoding">
215 [% FOREACH encoding IN encodings %]
216 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
217 <option selected="selected">[% encoding | html %]</option>
219 <option>[% encoding | html %]</option>
225 <li class="marc_specific">
226 <label for="staff_only">Only available on the staff interface: </label>
227 [% IF csv_profile.staff_only %]
228 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
230 <input type="checkbox" name="staff_only" id="staff_only" value="1">
234 <li class="marc_specific">
235 <label for="marc_content" class="required">Profile MARC fields: </label>
236 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
237 <span class="required">Required</span>
238 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
239 <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>
240 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
241 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
244 <li class="sql_specific">
245 <label for="sql_content" class="required">Profile SQL fields: </label>
246 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
247 <p>You have to define which fields you want to export, separated by pipes.</p>
248 <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>
249 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
250 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
251 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
252 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
256 <fieldset class="action">
257 <input type="submit" class="btn btn-primary" value="Submit" />
258 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
263 [% IF op == 'delete_confirm' %]
264 <div class="dialog alert">
266 <h1>Delete CSV Profile "[% csv_profile.profile | html %]?"</h1>
267 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
268 <input type="hidden" name="op" value="delete_confirmed" />
269 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
270 <input type="submit" class="approve" value="Yes, delete" />
272 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
273 <input type="submit" class="deny" value="No, do not Delete" />
276 This CSV Profile does not exist.
281 [% IF op == 'list' %]
283 <div id="toolbar" class="btn-toolbar">
284 <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>
287 <h1>CSV profiles</h1>
289 [% IF csv_profiles %]
290 <div class="page-section">
291 <table id="table_csv_profiles">
293 <th>CSV profile ID</th>
297 <th>CSV separator</th>
300 <th class="noExport">Actions</th>
303 [% FOREACH csv_profile IN csv_profiles %]
305 <td>[% csv_profile.export_format_id | html %]</td>
306 <td>[% csv_profile.profile | html %]</td>
307 <td>[% csv_profile.description | html %]</td>
308 <td>[% csv_profile.content | html | html_line_break %]</td>
309 <td>[% csv_profile.csv_separator | html %]</td>
310 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
311 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
313 <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-alt"></i> Edit</a>
314 <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-can"></i> Delete</a>
322 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
327 </div> <!-- /.col-sm-10.col-sm-push-2 -->
329 <div class="col-sm-2 col-sm-pull-10">
331 [% INCLUDE 'tools-menu.inc' %]
333 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
334 </div> <!-- /.row -->
336 [% MACRO jsinclude BLOCK %]
337 [% Asset.js("js/tools-menu.js") | $raw %]
339 function reloadPage(p) {
341 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
343 $(document).ready(function() {
344 $("#type").change(function(){
345 if ( $(this).find("option:selected").val() == "marc" ) {
346 $("li.marc_specific").show();
347 $("#marc_content").attr("required", "required");
348 $("li.sql_specific").hide();
349 $("#sql_content").removeAttr("required");
351 $("li.marc_specific").hide();
352 $("#marc_content").removeAttr("required");
353 $("li.sql_specific").show();
354 $("#sql_content").attr("required", "required");
362 [% INCLUDE 'intranet-bottom.inc' %]