4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › CSV export profiles</title>
6 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="tools_csv-profiles" class="tools">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'cat-search.inc' %]
13 <div id="breadcrumbs">
14 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
15 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
16 › CSV export profiles
19 <div class="main container-fluid">
21 <div class="col-sm-10 col-sm-push-2">
24 [% FOR m IN messages %]
25 <div class="dialog [% m.type | html %]">
27 [% CASE 'error_on_update' %]
28 An error occurred when updating this CSV profile. Perhaps it already exists.
29 [% CASE 'error_on_insert' %]
30 An error occurred when adding this CSV profile.
31 [% CASE 'error_on_delete' %]
32 An error occurred when deleting this CSV profile. Check the logs.
33 [% CASE 'success_on_update' %]
34 CSV profile updated successfully.
35 [% CASE 'success_on_insert' %]
36 CSV profile added successfully.
37 [% CASE 'success_on_delete' %]
38 CSV profile deleted successfully.
39 [% CASE 'already_exists' %]
40 This CSV profile already exists.
47 [% BLOCK list_separator_options %]
48 [% IF selected_separator == ',' %]
49 <option value="," selected="selected">Comma (,)</option>
51 <option value=",">Comma (,)</option>
53 [% IF selected_separator == '|' %]
54 <option value="|" selected="selected">Pipe (|)</option>
56 <option value="|">Pipe (|)</option>
58 [% IF selected_separator == ';' %]
59 <option value=";" selected="selected">Semi-colon (;)</option>
61 <option value=";">Semi-colon (;)</option>
63 [% IF selected_separator == '#' %]
64 <option value="#" selected="selected">Sharp (#)</option>
66 <option value="#">Sharp (#)</option>
68 [% IF selected_separator == ' ' %]
69 <option value=" " selected="selected">Space ( )</option>
71 <option value=" ">Space ( )</option>
73 [% IF selected_separator == '\t' %]
74 <option value="\t" selected="selected">Tabulation (\t)</option>
76 <option value="\t">Tabulation (\t)</option>
78 [% IF selected_separator == '\n' %]
79 <option value="\n" selected="selected">New line (\n)</option>
81 <option value="\n">New line (\n)</option>
85 [% BLOCK type_description %]
86 [% IF type_code == 'marc' %] MARC
87 [% ELSIF type_code == 'sql' %] SQL
88 [% ELSE %] Unknown type
92 [% BLOCK used_for_description %]
93 [% IF used_for_code == 'export_records' %] Export records
94 [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
95 [% ELSIF used_for_code == 'late_orders' %] Export late orders
96 [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
97 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
98 [% ELSE %] Unknown usage
102 [% IF op == 'add_form' %]
104 <h1>Modify a CSV profile</h1>
106 <h1>New CSV profile</h1>
109 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
110 <input type="hidden" name="op" value="add_validate" />
111 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
112 <fieldset class="rows">
115 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
118 <label for="profile" class="required">Profile name: </label>
119 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
120 <span class="required">Required</span>
123 <label for="type" class="required">Profile type: </label>
124 <select id="type" name="type">
125 [% FOREACH type IN [ 'marc' 'sql'] %]
126 [% IF csv_profile.type == type %]
127 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
129 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
133 <span class="required">Required</span>
135 <li class="sql_specific">
136 <label for="used_for_sql">Usage: </label>
137 <select id="used_for_sql" name="used_for_sql">
138 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
139 [% IF csv_profile.used_for == used_for %]
140 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
142 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
147 <li class="marc_specific">
148 <label for="used_for_marc">Usage: </label>
149 <select id="used_for_marc" name="used_for_marc">
150 [% FOREACH used_for IN [ 'export_records' ] %]
151 [% IF csv_profile.used_for == used_for %]
152 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
154 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
160 <label for="description">Profile description: </label>
161 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
164 <label for="csv_separator">CSV separator: </label>
165 <select name="csv_separator" id="csv_separator">
166 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
170 <li class="marc_specific">
171 <label for="field_separator">Field separator: </label>
172 <select name="field_separator" id="field_separator">
173 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
177 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
178 <select name="subfield_separator" id="subfield_separator">
179 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
183 <li class="marc_specific"><label for="encoding">Encoding: </label>
184 <select name="encoding" id="encoding">
185 [% FOREACH encoding IN encodings %]
186 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
187 <option selected="selected">[% encoding | html %]</option>
189 <option>[% encoding | html %]</option>
195 <li class="marc_specific">
196 <label for="staff_only">Only available on the staff interface: </label>
197 [% IF csv_profile.staff_only %]
198 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
200 <input type="checkbox" name="staff_only" id="staff_only" value="1">
204 <li class="marc_specific">
205 <label for="marc_content" class="required">Profile MARC fields: </label>
206 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
207 <span class="required">Required</span>
208 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
209 <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>
210 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
211 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
214 <li class="sql_specific">
215 <label for="sql_content" class="required">Profile SQL fields: </label>
216 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
217 <p>You have to define which fields you want to export, separated by pipes.</p>
218 <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>
219 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
220 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
221 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
222 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
226 <fieldset class="action">
227 <input type="submit" value="Submit" />
228 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
233 [% IF op == 'delete_confirm' %]
234 <div class="dialog alert">
236 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
237 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
238 <input type="hidden" name="op" value="delete_confirmed" />
239 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
240 <input type="submit" class="approve" value="Yes, delete" />
242 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
243 <input type="submit" class="deny" value="No, do not Delete" />
246 This CSV Profile does not exist.
251 [% IF op == 'list' %]
253 <div id="toolbar" class="btn-toolbar">
254 <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>
257 <h2>CSV profiles</h2>
259 [% IF csv_profiles %]
260 <table id="table_csv_profiles">
262 <th>CSV profile ID</th>
266 <th>CSV separator</th>
272 [% FOREACH csv_profile IN csv_profiles %]
274 <td>[% csv_profile.export_format_id | html %]</td>
275 <td>[% csv_profile.profile | html %]</td>
276 <td>[% csv_profile.description | html %]</td>
277 <td>[% csv_profile.content | html | html_line_break %]</td>
278 <td>[% csv_profile.csv_separator | html %]</td>
279 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
280 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
282 <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>
283 <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>
290 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
295 </div> <!-- /.col-sm-10.col-sm-push-2 -->
297 <div class="col-sm-2 col-sm-pull-10">
299 [% INCLUDE 'tools-menu.inc' %]
301 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
302 </div> <!-- /.row -->
304 [% MACRO jsinclude BLOCK %]
305 [% Asset.js("js/tools-menu.js") | $raw %]
307 function reloadPage(p) {
309 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
311 $(document).ready(function() {
312 $("#type").change(function(){
313 if ( $(this).find("option:selected").val() == "marc" ) {
314 $("li.marc_specific").show();
315 $("#marc_content").attr("required", "required");
316 $("li.sql_specific").hide();
317 $("#sql_content").removeAttr("required");
319 $("li.marc_specific").hide();
320 $("#marc_content").removeAttr("required");
321 $("li.sql_specific").show();
322 $("#sql_content").attr("required", "required");
330 [% INCLUDE 'intranet-bottom.inc' %]