3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Tools › CSV export profiles</title>
5 [% INCLUDE 'doc-head-close.inc' %]
8 <body id="tools_csv-profiles" class="tools">
9 [% INCLUDE 'header.inc' %]
10 [% INCLUDE 'cat-search.inc' %]
12 <div id="breadcrumbs">
13 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
15 › CSV export profiles
18 <div id="doc3" class="yui-t2">
23 [% FOR m IN messages %]
24 <div class="dialog [% m.type %]">
26 [% CASE 'error_on_update' %]
27 An error occurred when updating this CSV profile. Perhaps it already exists.
28 [% CASE 'error_on_insert' %]
29 An error occurred when adding this CSV profile.
30 [% CASE 'error_on_delete' %]
31 An error occurred when deleting this CSV profile. Check the logs.
32 [% CASE 'success_on_update' %]
33 CSV profile updated successfully.
34 [% CASE 'success_on_insert' %]
35 CSV profile added successfully.
36 [% CASE 'success_on_delete' %]
37 CSV profile deleted successfully.
38 [% CASE 'already_exists' %]
39 This CSV profile already exists.
46 [% BLOCK list_separator_options %]
47 [% IF selected_separator == ',' %]
48 <option value="," selected="selected">Comma (,)</option>
50 <option value=",">Comma (,)</option>
52 [% IF selected_separator == '|' %]
53 <option value="|" selected="selected">Pipe (|)</option>
55 <option value="|">Pipe (|)</option>
57 [% IF selected_separator == ';' %]
58 <option value=";" selected="selected">Semi-colon (;)</option>
60 <option value=";">Semi-colon (;)</option>
62 [% IF selected_separator == '#' %]
63 <option value="#" selected="selected">Sharp (#)</option>
65 <option value="#">Sharp (#)</option>
67 [% IF selected_separator == ' ' %]
68 <option value=" " selected="selected">Space ( )</option>
70 <option value=" ">Space ( )</option>
72 [% IF selected_separator == '\t' %]
73 <option value="\t" selected="selected">Tabulation (\t)</option>
75 <option value="\t">Tabulation (\t)</option>
77 [% IF selected_separator == '\n' %]
78 <option value="\n" selected="selected">New line (\n)</option>
80 <option value="\n">New line (\n)</option>
84 [% BLOCK type_description %]
85 [% IF type_code == 'marc' %] MARC
86 [% ELSIF type_code == 'sql' %] SQL
87 [% ELSE %] Unknown type
91 [% BLOCK used_for_description %]
92 [% IF used_for_code == 'export_records' %] Export records
93 [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
94 [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
95 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
96 [% ELSE %] Unknown usage
100 [% IF op == 'add_form' %]
102 <h1>Modify a CSV profile</h1>
104 <h1>New CSV profile</h1>
107 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
108 <input type="hidden" name="op" value="add_validate" />
109 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
110 <fieldset class="rows">
113 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id %]</li>
116 <label for="profile" class="required">Profile name: </label>
117 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
118 <span class="required">Required</span>
121 <label for="type" class="required">Profile type: </label>
122 <select id="type" name="type">
123 [% FOREACH type IN [ 'marc' 'sql'] %]
124 [% IF csv_profile.type == type %]
125 <option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
127 <option value="[% type %]">[% PROCESS type_description type_code = type %]</option>
131 <span class="required">Required</span>
133 <li class="sql_specific">
134 <label for="used_for_sql">Usage: </label>
135 <select id="used_for_sql" name="used_for_sql">
136 [% FOREACH used_for IN [ 'late_issues' 'export_basket' 'export_lost_items' ] %]
137 [% IF csv_profile.used_for == used_for %]
138 <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
140 <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
145 <li class="marc_specific">
146 <label for="used_for_marc">Usage: </label>
147 <select id="used_for_marc" name="used_for_marc">
148 [% FOREACH used_for IN [ 'export_records' ] %]
149 [% IF csv_profile.used_for == used_for %]
150 <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
152 <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
158 <label for="description">Profile description: </label>
159 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
162 <label for="csv_separator">CSV separator: </label>
163 <select name="csv_separator" id="csv_separator">
164 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
168 <li class="marc_specific">
169 <label for="field_separator">Field separator: </label>
170 <select name="field_separator" id="field_separator">
171 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
175 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
176 <select name="subfield_separator" id="subfield_separator">
177 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
181 <li class="marc_specific"><label for="encoding">Encoding: </label>
182 <select name="encoding" id="encoding">
183 [% FOREACH encoding IN encodings %]
184 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
185 <option selected="selected">[% encoding %]</option>
187 <option>[% encoding %]</option>
193 <li class="marc_specific">
194 <label for="marc_content" class="required">Profile MARC fields: </label>
195 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content %]</textarea>
196 <span class="required">Required</span>
197 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
198 <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>
199 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
200 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
203 <li class="sql_specific">
204 <label for="late_issues_content" class="required">Profile SQL fields: </label>
205 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content %]</textarea>
206 <p>You have to define which fields you want to export, separated by pipes.</p>
207 <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>
208 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
209 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
210 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
214 <fieldset class="action">
215 <input type="submit" value="Submit" />
216 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
221 [% IF op == 'delete_confirm' %]
222 <div class="dialog alert">
224 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
225 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
226 <input type="hidden" name="op" value="delete_confirmed" />
227 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
228 <input type="submit" class="approve" value="Yes, delete" />
230 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
231 <input type="submit" class="deny" value="No, do not Delete" />
234 This CSV Profile does not exist.
239 [% IF op == 'list' %]
241 <div id="toolbar" class="btn-toolbar">
242 <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>
245 <h2>CSV profiles</h2>
247 [% IF csv_profiles %]
248 <table id="table_csv_profiles">
250 <th>CSV profile ID</th>
254 <th>CSV separator</th>
260 [% FOREACH csv_profile IN csv_profiles %]
262 <td>[% csv_profile.export_format_id %]</td>
263 <td>[% csv_profile.profile |html %]</td>
264 <td>[% csv_profile.description |html %]</td>
265 <td>[% csv_profile.content |html %]</td>
266 <td>[% csv_profile.csv_separator %]</td>
267 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
268 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
270 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
271 <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
278 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
284 <div class="yui-b noprint">
285 [% INCLUDE 'tools-menu.inc' %]
289 [% MACRO jsinclude BLOCK %]
290 [% Asset.js("js/tools-menu.js") %]
291 <script type="text/javascript">
292 function reloadPage(p) {
294 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
296 $(document).ready(function() {
297 $("#type").change(function(){
298 if ( $(this).find("option:selected").val() == "marc" ) {
299 $("li.marc_specific").show();
300 $("#marc_content").attr("required", "required");
301 $("li.sql_specific").hide();
302 $("#sql_content").removeAttr("required");
304 $("li.marc_specific").hide();
305 $("#marc_content").removeAttr("required");
306 $("li.sql_specific").show();
307 $("#sql_content").attr("required", "required");
315 [% INCLUDE 'intranet-bottom.inc' %]