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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
16 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
19 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
22 <a href="#" aria-current="page">
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
34 [% FOR m IN messages %]
35 <div class="dialog [% m.type | html %]">
37 [% CASE 'error_on_update' %]
38 An error occurred when updating this CSV profile. Perhaps it already exists.
39 [% CASE 'error_on_insert' %]
40 An error occurred when adding this CSV profile.
41 [% CASE 'error_on_delete' %]
42 An error occurred when deleting this CSV profile. Check the logs.
43 [% CASE 'success_on_update' %]
44 CSV profile updated successfully.
45 [% CASE 'success_on_insert' %]
46 CSV profile added successfully.
47 [% CASE 'success_on_delete' %]
48 CSV profile deleted successfully.
49 [% CASE 'already_exists' %]
50 This CSV profile already exists.
57 [% BLOCK list_separator_options %]
58 [% IF selected_separator == ',' %]
59 <option value="," selected="selected">Comma (,)</option>
61 <option value=",">Comma (,)</option>
63 [% IF selected_separator == '|' %]
64 <option value="|" selected="selected">Pipe (|)</option>
66 <option value="|">Pipe (|)</option>
68 [% IF selected_separator == ';' %]
69 <option value=";" selected="selected">Semi-colon (;)</option>
71 <option value=";">Semi-colon (;)</option>
73 [% IF selected_separator == '#' %]
74 <option value="#" selected="selected">Sharp (#)</option>
76 <option value="#">Sharp (#)</option>
78 [% IF selected_separator == ' ' %]
79 <option value=" " selected="selected">Space ( )</option>
81 <option value=" ">Space ( )</option>
83 [% IF selected_separator == '\t' %]
84 <option value="\t" selected="selected">Tabulation (\t)</option>
86 <option value="\t">Tabulation (\t)</option>
88 [% IF selected_separator == '\n' %]
89 <option value="\n" selected="selected">New line (\n)</option>
91 <option value="\n">New line (\n)</option>
95 [% BLOCK type_description %]
96 [% IF type_code == 'marc' %] MARC
97 [% ELSIF type_code == 'sql' %] SQL
98 [% ELSE %] Unknown type
102 [% BLOCK used_for_description %]
103 [% IF used_for_code == 'export_records' %] Export records
104 [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
105 [% ELSIF used_for_code == 'late_orders' %] Export late orders
106 [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
107 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
108 [% ELSE %] Unknown usage
112 [% IF op == 'add_form' %]
114 <h1>Modify a CSV profile</h1>
116 <h1>New CSV profile</h1>
119 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
120 <input type="hidden" name="op" value="add_validate" />
121 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
122 <fieldset class="rows">
125 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
128 <label for="profile" class="required">Profile name: </label>
129 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
130 <span class="required">Required</span>
133 <label for="type" class="required">Profile type: </label>
134 <select id="type" name="type">
135 [% FOREACH type IN [ 'marc' 'sql'] %]
136 [% IF csv_profile.type == type %]
137 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
139 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
143 <span class="required">Required</span>
145 <li class="sql_specific">
146 <label for="used_for_sql">Usage: </label>
147 <select id="used_for_sql" name="used_for_sql">
148 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
149 [% IF csv_profile.used_for == used_for %]
150 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
152 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
157 <li class="marc_specific">
158 <label for="used_for_marc">Usage: </label>
159 <select id="used_for_marc" name="used_for_marc">
160 [% FOREACH used_for IN [ 'export_records' ] %]
161 [% IF csv_profile.used_for == used_for %]
162 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
164 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
170 <label for="description">Profile description: </label>
171 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
174 <label for="csv_separator">CSV separator: </label>
175 <select name="csv_separator" id="csv_separator">
176 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
180 <li class="marc_specific">
181 <label for="field_separator">Field separator: </label>
182 <select name="field_separator" id="field_separator">
183 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
187 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
188 <select name="subfield_separator" id="subfield_separator">
189 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
193 <li class="marc_specific"><label for="encoding">Encoding: </label>
194 <select name="encoding" id="encoding">
195 [% FOREACH encoding IN encodings %]
196 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
197 <option selected="selected">[% encoding | html %]</option>
199 <option>[% encoding | html %]</option>
205 <li class="marc_specific">
206 <label for="staff_only">Only available on the staff interface: </label>
207 [% IF csv_profile.staff_only %]
208 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
210 <input type="checkbox" name="staff_only" id="staff_only" value="1">
214 <li class="marc_specific">
215 <label for="marc_content" class="required">Profile MARC fields: </label>
216 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
217 <span class="required">Required</span>
218 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
219 <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>
220 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
221 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
224 <li class="sql_specific">
225 <label for="sql_content" class="required">Profile SQL fields: </label>
226 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
227 <p>You have to define which fields you want to export, separated by pipes.</p>
228 <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>
229 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
230 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
231 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
232 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
236 <fieldset class="action">
237 <input type="submit" value="Submit" />
238 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
243 [% IF op == 'delete_confirm' %]
244 <div class="dialog alert">
246 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
247 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
248 <input type="hidden" name="op" value="delete_confirmed" />
249 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
250 <input type="submit" class="approve" value="Yes, delete" />
252 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
253 <input type="submit" class="deny" value="No, do not Delete" />
256 This CSV Profile does not exist.
261 [% IF op == 'list' %]
263 <div id="toolbar" class="btn-toolbar">
264 <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>
267 <h2>CSV profiles</h2>
269 [% IF csv_profiles %]
270 <table id="table_csv_profiles">
272 <th>CSV profile ID</th>
276 <th>CSV separator</th>
279 <th class="noExport">Actions</th>
282 [% FOREACH csv_profile IN csv_profiles %]
284 <td>[% csv_profile.export_format_id | html %]</td>
285 <td>[% csv_profile.profile | html %]</td>
286 <td>[% csv_profile.description | html %]</td>
287 <td>[% csv_profile.content | html | html_line_break %]</td>
288 <td>[% csv_profile.csv_separator | html %]</td>
289 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
290 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
292 <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>
293 <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>
300 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
305 </div> <!-- /.col-sm-10.col-sm-push-2 -->
307 <div class="col-sm-2 col-sm-pull-10">
309 [% INCLUDE 'tools-menu.inc' %]
311 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
312 </div> <!-- /.row -->
314 [% MACRO jsinclude BLOCK %]
315 [% Asset.js("js/tools-menu.js") | $raw %]
317 function reloadPage(p) {
319 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
321 $(document).ready(function() {
322 $("#type").change(function(){
323 if ( $(this).find("option:selected").val() == "marc" ) {
324 $("li.marc_specific").show();
325 $("#marc_content").attr("required", "required");
326 $("li.sql_specific").hide();
327 $("#sql_content").removeAttr("required");
329 $("li.marc_specific").hide();
330 $("#marc_content").removeAttr("required");
331 $("li.sql_specific").show();
332 $("#sql_content").attr("required", "required");
340 [% INCLUDE 'intranet-bottom.inc' %]