3 [% PROCESS 'i18n.inc' %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7 [% IF op == 'add_form' %]
9 [% tx("Modify CSV profile '{csv_profile_name}'", {csv_profile_name = csv_profile.profile }) | html %] ›
11 [% t("New CSV profile") | html %] ›
13 [% ELSIF ( op == 'delete_confirm' ) %]
14 [% tx("Confirm deletion of CSV profile '{csv_profile_name}'", {csv_profile_name = csv_profile.profile }) | html %] ›
16 [% t("CSV profiles") | html %] ›
17 [% t("Tools") | html %] ›
18 [% t("Koha") | html %]
20 [% INCLUDE 'doc-head-close.inc' %]
23 <body id="tools_csv-profiles" class="tools">
24 [% WRAPPER 'header.inc' %]
25 [% INCLUDE 'cat-search.inc' %]
28 [% WRAPPER 'sub-header.inc' %]
29 [% WRAPPER breadcrumbs %]
30 [% WRAPPER breadcrumb_item %]
31 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
33 [% IF op == 'add_form' || op == 'delete_confirm' %]
34 [% WRAPPER breadcrumb_item %]
35 <a href="/cgi-bin/koha/tools/csv-profiles.pl">CSV profiles</a>
38 [% IF op == 'add_form' %]
40 [% WRAPPER breadcrumb_item bc_active= 1 %]
41 [% tx("Modify CSV profile '{csv_profile_name}'", {csv_profile_name = csv_profile.profile }) | html %]
44 [% WRAPPER breadcrumb_item bc_active= 1 %]
45 <span>New CSV profile</span>
48 [% ELSIF ( op == 'delete_confirm') %]
49 [% WRAPPER breadcrumb_item bc_active= 1 %]
50 [% tx("Confirm deletion of CSV profile '{csv_profile_name}'", {csv_profile_name = csv_profile.profile }) | html %]
53 [% WRAPPER breadcrumb_item bc_active= 1 %]
54 <span>CSV profiles</span>
57 [% END #/ WRAPPER breadcrumbs %]
58 [% END #/ WRAPPER sub-header.inc %]
60 <div class="main container-fluid">
62 <div class="col-sm-10 col-sm-push-2">
65 [% FOR m IN messages %]
66 <div class="dialog [% m.type | html %]">
68 [% CASE 'error_on_update' %]
69 <span>An error occurred when updating this CSV profile. Perhaps it already exists</span>
70 [% CASE 'error_on_insert' %]
71 <span>An error occurred when adding this CSV profile</span>
72 [% CASE 'error_on_delete' %]
73 <span>An error occurred when deleting this CSV profile. Check the logs</span>
74 [% CASE 'success_on_update' %]
75 <span>CSV profile updated successfully</span>
76 [% CASE 'success_on_insert' %]
77 <span>CSV profile added successfully</span>
78 [% CASE 'success_on_delete' %]
79 <span>CSV profile deleted successfully</span>
80 [% CASE 'already_exists' %]
81 <span>This CSV profile already exists</span>
83 <span>[% m.code | html %]</span>
88 [% BLOCK list_separator_options %]
89 [% IF selected_separator == ',' %]
90 <option value="," selected="selected">Comma (,)</option>
92 <option value=",">Comma (,)</option>
94 [% IF selected_separator == '|' %]
95 <option value="|" selected="selected">Pipe (|)</option>
97 <option value="|">Pipe (|)</option>
99 [% IF selected_separator == ';' %]
100 <option value=";" selected="selected">Semi-colon (;)</option>
102 <option value=";">Semi-colon (;)</option>
104 [% IF selected_separator == '#' %]
105 <option value="#" selected="selected">Sharp (#)</option>
107 <option value="#">Sharp (#)</option>
109 [% IF selected_separator == ' ' %]
110 <option value=" " selected="selected">Space ( )</option>
112 <option value=" ">Space ( )</option>
114 [% tab_char = '\t' %]
115 [% IF selected_separator == '\t' %]
116 <option value="\t" selected="selected">Tabulation ([% tab_char | html %])</option>
118 <option value="\t">Tabulation ([% tab_char | html %])</option>
120 [% new_line_char = '\n' %]
121 [% IF selected_separator == '\n' %]
122 <option value="\n" selected="selected">New line ([% new_line_char | html %])</option>
124 <option value="\n">New line ([% new_line_char | html %])</option>
128 [% BLOCK type_description %]
129 [% IF type_code == 'marc' %] <span>MARC</span>
130 [% ELSIF type_code == 'sql' %] <span>SQL</span>
131 [% ELSE %] <span>Unknown type</span>
135 [% BLOCK used_for_description %]
136 [% IF used_for_code == 'export_records' %] <span>Export records</span>
137 [% ELSIF used_for_code == 'late_issues' %] <span>Late serial issues claims</span>
138 [% ELSIF used_for_code == 'late_orders' %] <span>Export late orders</span>
139 [% ELSIF used_for_code == 'export_basket' %] <span>Basket export in acquisition</span>
140 [% ELSIF used_for_code == 'export_lost_items' %] <span>Export lost items in report</span>
141 [% ELSE %] <span>Unknown usage</span>
145 [% IF op == 'add_form' %]
147 <h1>[% tx("Modify CSV profile '{csv_profile_name}'", {csv_profile_name = csv_profile.profile }) | html %]</h1>
149 <h1>New CSV profile</h1>
152 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
153 <input type="hidden" name="op" value="add_validate" />
154 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
155 <fieldset class="rows">
158 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
161 <label for="profile" class="required">Profile name: </label>
162 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
163 <span class="required">Required</span>
166 <label for="type" class="required">Profile type: </label>
167 <select id="type" name="type">
168 [% FOREACH type IN [ 'marc' 'sql'] %]
169 [% IF csv_profile.type == type %]
170 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
172 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
176 <span class="required">Required</span>
178 <li class="sql_specific">
179 <label for="used_for_sql">Usage: </label>
180 <select id="used_for_sql" name="used_for_sql">
181 [% FOREACH used_for IN [ 'late_issues' 'late_orders', 'export_basket' 'export_lost_items' ] %]
182 [% IF csv_profile.used_for == used_for %]
183 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
185 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
190 <li class="marc_specific">
191 <label for="used_for_marc">Usage: </label>
192 <select id="used_for_marc" name="used_for_marc">
193 [% FOREACH used_for IN [ 'export_records' ] %]
194 [% IF csv_profile.used_for == used_for %]
195 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
197 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
203 <label for="description">Profile description: </label>
204 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
207 <label for="csv_separator">CSV separator: </label>
208 <select name="csv_separator" id="csv_separator">
209 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
213 <li class="marc_specific">
214 <label for="field_separator">Field separator: </label>
215 <select name="field_separator" id="field_separator">
216 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
220 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
221 <select name="subfield_separator" id="subfield_separator">
222 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
226 <li class="marc_specific"><label for="encoding">Encoding: </label>
227 <select name="encoding" id="encoding">
228 [% FOREACH encoding IN encodings %]
229 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
230 <option selected="selected">[% encoding | html %]</option>
232 <option>[% encoding | html %]</option>
238 <li class="marc_specific">
239 <label for="staff_only">Only available on the staff interface: </label>
240 [% IF csv_profile.staff_only %]
241 <input type="checkbox" name="staff_only" id="staff_only" value="1" checked="checked">
243 <input type="checkbox" name="staff_only" id="staff_only" value="1">
247 <li class="marc_specific">
248 <label for="marc_content" class="required">Profile MARC fields: </label>
249 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
250 <span class="required">Required</span>
251 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
252 <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>
253 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
254 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
257 <li class="sql_specific">
258 <label for="sql_content" class="required">Profile SQL fields: </label>
259 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
260 <p>You have to define which fields you want to export, separated by pipes.</p>
261 <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>
262 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
263 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
264 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
265 <p>For exporting late orders you must provide a profile in Template Toolkit syntax to generate the CSV file.</p>
269 <fieldset class="action">
270 <input type="submit" class="btn btn-primary" value="Submit" />
271 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
276 [% IF op == 'delete_confirm' %]
277 <div class="dialog alert">
279 <h1>[% tx("Delete CSV profile '{csv_profile_name}'?", {csv_profile_name = csv_profile.profile }) | html %]</h1>
280 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
281 <input type="hidden" name="op" value="delete_confirmed" />
282 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
283 <button type="submit" class="approve"><i class="fa fa-check" aria-hidden="true"></i> Yes, delete</button>
285 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
286 <button type="submit" class="deny"><i class="fa fa-remove" aria-hidden="true"></i> No, do not delete</button>
289 This CSV Profile does not exist.
294 [% IF op == 'list' %]
296 <div id="toolbar" class="btn-toolbar">
297 <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>
300 <h1>CSV profiles</h1>
302 [% IF csv_profiles %]
303 <div class="page-section">
304 <table id="table_csv_profiles">
306 <th>CSV profile ID</th>
310 <th>CSV separator</th>
313 <th class="noExport">Actions</th>
316 [% FOREACH csv_profile IN csv_profiles %]
318 <td>[% csv_profile.export_format_id | html %]</td>
319 <td>[% csv_profile.profile | html %]</td>
320 <td>[% csv_profile.description | html %]</td>
321 <td>[% csv_profile.content | html | html_line_break %]</td>
322 <td>[% csv_profile.csv_separator | html %]</td>
323 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
324 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
326 <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-solid fa-pencil" aria-hidden="true"></i> Edit</a>
327 <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>
335 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
340 </div> <!-- /.col-sm-10.col-sm-push-2 -->
342 <div class="col-sm-2 col-sm-pull-10">
344 [% INCLUDE 'tools-menu.inc' %]
346 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
347 </div> <!-- /.row -->
349 [% MACRO jsinclude BLOCK %]
350 [% Asset.js("js/tools-menu.js") | $raw %]
352 function reloadPage(p) {
354 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
356 $(document).ready(function() {
357 $("#type").change(function(){
358 if ( $(this).find("option:selected").val() == "marc" ) {
359 $("li.marc_specific").show();
360 $("#marc_content").attr("required", "required");
361 $("li.sql_specific").hide();
362 $("#sql_content").removeAttr("required");
364 $("li.marc_specific").hide();
365 $("#marc_content").removeAttr("required");
366 $("li.sql_specific").show();
367 $("#sql_content").attr("required", "required");
375 [% INCLUDE 'intranet-bottom.inc' %]