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 id="doc3" class="yui-t2">
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 == 'export_basket' %] Basket export in acquisition
96 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
97 [% ELSE %] Unknown usage
101 [% IF op == 'add_form' %]
103 <h1>Modify a CSV profile</h1>
105 <h1>New CSV profile</h1>
108 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
109 <input type="hidden" name="op" value="add_validate" />
110 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
111 <fieldset class="rows">
114 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id | html %]</li>
117 <label for="profile" class="required">Profile name: </label>
118 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
119 <span class="required">Required</span>
122 <label for="type" class="required">Profile type: </label>
123 <select id="type" name="type">
124 [% FOREACH type IN [ 'marc' 'sql'] %]
125 [% IF csv_profile.type == type %]
126 <option value="[% type | html %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
128 <option value="[% type | html %]">[% PROCESS type_description type_code = type %]</option>
132 <span class="required">Required</span>
134 <li class="sql_specific">
135 <label for="used_for_sql">Usage: </label>
136 <select id="used_for_sql" name="used_for_sql">
137 [% FOREACH used_for IN [ 'late_issues' 'export_basket' 'export_lost_items' ] %]
138 [% IF csv_profile.used_for == used_for %]
139 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
141 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
146 <li class="marc_specific">
147 <label for="used_for_marc">Usage: </label>
148 <select id="used_for_marc" name="used_for_marc">
149 [% FOREACH used_for IN [ 'export_records' ] %]
150 [% IF csv_profile.used_for == used_for %]
151 <option value="[% used_for | html %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
153 <option value="[% used_for | html %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
159 <label for="description">Profile description: </label>
160 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
163 <label for="csv_separator">CSV separator: </label>
164 <select name="csv_separator" id="csv_separator">
165 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
169 <li class="marc_specific">
170 <label for="field_separator">Field separator: </label>
171 <select name="field_separator" id="field_separator">
172 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
176 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
177 <select name="subfield_separator" id="subfield_separator">
178 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
182 <li class="marc_specific"><label for="encoding">Encoding: </label>
183 <select name="encoding" id="encoding">
184 [% FOREACH encoding IN encodings %]
185 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
186 <option selected="selected">[% encoding | html %]</option>
188 <option>[% encoding | html %]</option>
194 <li class="marc_specific">
195 <label for="marc_content" class="required">Profile MARC fields: </label>
196 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content | html %]</textarea>
197 <span class="required">Required</span>
198 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
199 <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>
200 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
201 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
204 <li class="sql_specific">
205 <label for="late_issues_content" class="required">Profile SQL fields: </label>
206 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content | html %]</textarea>
207 <p>You have to define which fields you want to export, separated by pipes.</p>
208 <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>
209 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
210 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
211 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
215 <fieldset class="action">
216 <input type="submit" value="Submit" />
217 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
222 [% IF op == 'delete_confirm' %]
223 <div class="dialog alert">
225 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
226 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
227 <input type="hidden" name="op" value="delete_confirmed" />
228 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id | html %]" />
229 <input type="submit" class="approve" value="Yes, delete" />
231 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
232 <input type="submit" class="deny" value="No, do not Delete" />
235 This CSV Profile does not exist.
240 [% IF op == 'list' %]
242 <div id="toolbar" class="btn-toolbar">
243 <a class="btn btn-default btn-sm" id="newcsvprofile" href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form"><i class="fa fa-plus"></i> New CSV profile</a>
246 <h2>CSV profiles</h2>
248 [% IF csv_profiles %]
249 <table id="table_csv_profiles">
251 <th>CSV profile ID</th>
255 <th>CSV separator</th>
261 [% FOREACH csv_profile IN csv_profiles %]
263 <td>[% csv_profile.export_format_id | html %]</td>
264 <td>[% csv_profile.profile | html %]</td>
265 <td>[% csv_profile.description | html %]</td>
266 <td>[% csv_profile.content | html %]</td>
267 <td>[% csv_profile.csv_separator | html %]</td>
268 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
269 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
271 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id | html %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
272 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id | html %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
279 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
285 <div class="yui-b noprint">
286 [% INCLUDE 'tools-menu.inc' %]
290 [% MACRO jsinclude BLOCK %]
291 [% Asset.js("js/tools-menu.js") | $raw %]
292 <script type="text/javascript">
293 function reloadPage(p) {
295 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
297 $(document).ready(function() {
298 $("#type").change(function(){
299 if ( $(this).find("option:selected").val() == "marc" ) {
300 $("li.marc_specific").show();
301 $("#marc_content").attr("required", "required");
302 $("li.sql_specific").hide();
303 $("#sql_content").removeAttr("required");
305 $("li.marc_specific").hide();
306 $("#marc_content").removeAttr("required");
307 $("li.sql_specific").show();
308 $("#sql_content").attr("required", "required");
316 [% INCLUDE 'intranet-bottom.inc' %]