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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
32 [% IF op == 'add_form' %]
34 <a href="/cgi-bin/koha/tools/csv-profiles.pl">
40 <a href="#" aria-current="page">Modify a CSV profile</a>
44 <a href="#" aria-current="page">New CSV profile</a>
49 <a href="#" aria-current="page">
58 <div class="main container-fluid">
60 <div class="col-sm-10 col-sm-push-2">
63 [% FOR m IN messages %]
64 <div class="dialog [% m.type | html %]">
66 [% CASE 'error_on_update' %]
67 <span>An error occurred when updating this CSV profile. Perhaps it already exists</span>
68 [% CASE 'error_on_insert' %]
69 <span>An error occurred when adding this CSV profile</span>
70 [% CASE 'error_on_delete' %]
71 <span>An error occurred when deleting this CSV profile. Check the logs</span>
72 [% CASE 'success_on_update' %]
73 <span>CSV profile updated successfully</span>
74 [% CASE 'success_on_insert' %]
75 <span>CSV profile added successfully</span>
76 [% CASE 'success_on_delete' %]
77 <span>CSV profile deleted successfully</span>
78 [% CASE 'already_exists' %]
79 <span>This CSV profile already exists</span>
81 <span>[% m.code | html %]</span>
86 [% BLOCK list_separator_options %]
87 [% IF selected_separator == ',' %]
88 <option value="," selected="selected">Comma (,)</option>
90 <option value=",">Comma (,)</option>
92 [% IF selected_separator == '|' %]
93 <option value="|" selected="selected">Pipe (|)</option>
95 <option value="|">Pipe (|)</option>
97 [% IF selected_separator == ';' %]
98 <option value=";" selected="selected">Semi-colon (;)</option>
100 <option value=";">Semi-colon (;)</option>
102 [% IF selected_separator == '#' %]
103 <option value="#" selected="selected">Sharp (#)</option>
105 <option value="#">Sharp (#)</option>
107 [% IF selected_separator == ' ' %]
108 <option value=" " selected="selected">Space ( )</option>
110 <option value=" ">Space ( )</option>
112 [% IF selected_separator == '\t' %]
113 <option value="\t" selected="selected">Tabulation (\t)</option>
115 <option value="\t">Tabulation (\t)</option>
117 [% IF selected_separator == '\n' %]
118 <option value="\n" selected="selected">New line (\n)</option>
120 <option value="\n">New line (\n)</option>
124 [% BLOCK type_description %]
125 [% IF type_code == 'marc' %] <span>MARC</span>
126 [% ELSIF type_code == 'sql' %] <span>SQL</span>
127 [% ELSE %] <span>Unknown type</span>
131 [% BLOCK used_for_description %]
132 [% IF used_for_code == 'export_records' %] <span>Export records</span>
133 [% ELSIF used_for_code == 'late_issues' %] <span>Late serial issues claims</span>
134 [% ELSIF used_for_code == 'late_orders' %] <span>Export late orders</span>
135 [% ELSIF used_for_code == 'export_basket' %] <span>Basket export in acquisition</span>
136 [% ELSIF used_for_code == 'export_lost_items' %] <span>Export lost items in report</span>
137 [% ELSE %] <span>Unknown usage</span>
141 [% IF op == 'add_form' %]
143 <h1>Modify a CSV profile</h1>
145 <h1>New CSV profile</h1>
148 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
149 <input type="hidden" name="op" value="add_validate" />
150 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
151 <fieldset class="rows">
154 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
157 <label for="profile" class="required">Profile name: </label>
158 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
159 <span class="required">Required</span>
162 <label for="type" class="required">Profile type: </label>
163 <select id="type" name="type">
164 [% FOREACH type IN [ 'marc' 'sql'] %]
165 [% IF csv_profile.type == type %]
166 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
168 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
172 <span class="required">Required</span>
174 <li class="sql_specific">
175 <label for="used_for_sql">Usage: </label>
176 <select id="used_for_sql" name="used_for_sql">
177 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
178 [% IF csv_profile.used_for == used_for %]
179 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
181 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
186 <li class="marc_specific">
187 <label for="used_for_marc">Usage: </label>
188 <select id="used_for_marc" name="used_for_marc">
189 [% FOREACH used_for IN [ 'export_records' ] %]
190 [% IF csv_profile.used_for == used_for %]
191 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
193 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
199 <label for="description">Profile description: </label>
200 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
203 <label for="csv_separator">CSV separator: </label>
204 <select name="csv_separator" id="csv_separator">
205 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
209 <li class="marc_specific">
210 <label for="field_separator">Field separator: </label>
211 <select name="field_separator" id="field_separator">
212 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
216 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
217 <select name="subfield_separator" id="subfield_separator">
218 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
222 <li class="marc_specific"><label for="encoding">Encoding: </label>
223 <select name="encoding" id="encoding">
224 [% FOREACH encoding IN encodings %]
225 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
226 <option selected="selected">[% encoding | html %]</option>
228 <option>[% encoding | html %]</option>
234 <li class="marc_specific">
235 <label for="staff_only">Only available on the staff interface: </label>
236 [% IF csv_profile.staff_only %]
237 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
239 <input type="checkbox" name="staff_only" id="staff_only" value="1">
243 <li class="marc_specific">
244 <label for="marc_content" class="required">Profile MARC fields: </label>
245 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
246 <span class="required">Required</span>
247 <p>You have to define which fields or subfields 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 number with an header, followed by the equal sign.</p>
249 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
250 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
253 <li class="sql_specific">
254 <label for="sql_content" class="required">Profile SQL fields: </label>
255 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
256 <p>You have to define which fields you want to export, separated by pipes.</p>
257 <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>
258 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
259 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
260 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
261 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
265 <fieldset class="action">
266 <input type="submit" class="btn btn-primary" value="Submit" />
267 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
272 [% IF op == 'delete_confirm' %]
273 <div class="dialog alert">
275 <h1>Delete CSV Profile "[% csv_profile.profile | html %]?"</h1>
276 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
277 <input type="hidden" name="op" value="delete_confirmed" />
278 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
279 <input type="submit" class="approve" value="Yes, delete" />
281 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
282 <input type="submit" class="deny" value="No, do not Delete" />
285 This CSV Profile does not exist.
290 [% IF op == 'list' %]
292 <div id="toolbar" class="btn-toolbar">
293 <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>
296 <h1>CSV profiles</h1>
298 [% IF csv_profiles %]
299 <div class="page-section">
300 <table id="table_csv_profiles">
302 <th>CSV profile ID</th>
306 <th>CSV separator</th>
309 <th class="noExport">Actions</th>
312 [% FOREACH csv_profile IN csv_profiles %]
314 <td>[% csv_profile.export_format_id | html %]</td>
315 <td>[% csv_profile.profile | html %]</td>
316 <td>[% csv_profile.description | html %]</td>
317 <td>[% csv_profile.content | html | html_line_break %]</td>
318 <td>[% csv_profile.csv_separator | html %]</td>
319 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
320 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
322 <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>
323 <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>
331 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
336 </div> <!-- /.col-sm-10.col-sm-push-2 -->
338 <div class="col-sm-2 col-sm-pull-10">
340 [% INCLUDE 'tools-menu.inc' %]
342 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
343 </div> <!-- /.row -->
345 [% MACRO jsinclude BLOCK %]
346 [% Asset.js("js/tools-menu.js") | $raw %]
348 function reloadPage(p) {
350 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
352 $(document).ready(function() {
353 $("#type").change(function(){
354 if ( $(this).find("option:selected").val() == "marc" ) {
355 $("li.marc_specific").show();
356 $("#marc_content").attr("required", "required");
357 $("li.sql_specific").hide();
358 $("#sql_content").removeAttr("required");
360 $("li.marc_specific").hide();
361 $("#marc_content").removeAttr("required");
362 $("li.sql_specific").show();
363 $("#sql_content").attr("required", "required");
371 [% INCLUDE 'intranet-bottom.inc' %]