2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Tools › CSV export profiles</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="tools_csv-profiles" class="tools">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'cat-search.inc' %]
11 <div id="breadcrumbs">
12 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
13 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
14 › CSV export profiles
17 <div id="doc3" class="yui-t2">
22 [% FOR m IN messages %]
23 <div class="dialog [% m.type %]">
25 [% CASE 'error_on_update' %]
26 An error occurred when updating this CSV profile. Perhaps it already exists.
27 [% CASE 'error_on_insert' %]
28 An error occurred when adding this CSV profile.
29 [% CASE 'error_on_delete' %]
30 An error occurred when deleting this CSV profile. Check the logs.
31 [% CASE 'success_on_update' %]
32 CSV profile updated successfully.
33 [% CASE 'success_on_insert' %]
34 CSV profile added successfully.
35 [% CASE 'success_on_delete' %]
36 CSV profile deleted successfully.
37 [% CASE 'already_exists' %]
38 This CSV profile already exists.
45 [% BLOCK list_separator_options %]
46 [% IF selected_separator == ',' %]
47 <option value="," selected="selected">Comma (,)</option>
49 <option value=",">Comma (,)</option>
51 [% IF selected_separator == '|' %]
52 <option value="|" selected="selected">Pipe (|)</option>
54 <option value="|">Pipe (|)</option>
56 [% IF selected_separator == ';' %]
57 <option value=";" selected="selected">Semi-colon (;)</option>
59 <option value=";">Semi-colon (;)</option>
61 [% IF selected_separator == '#' %]
62 <option value="#" selected="selected">Sharp (#)</option>
64 <option value="#">Sharp (#)</option>
66 [% IF selected_separator == ' ' %]
67 <option value=" " selected="selected">Space ( )</option>
69 <option value=" ">Space ( )</option>
71 [% IF selected_separator == '\t' %]
72 <option value="\t" selected="selected">Tabulation (\t)</option>
74 <option value="\t">Tabulation (\t)</option>
76 [% IF selected_separator == '\n' %]
77 <option value="\n" selected="selected">New line (\n)</option>
79 <option value="\n">New line (\n)</option>
83 [% BLOCK type_description %]
84 [% IF type_code == 'marc' %] MARC
85 [% ELSIF type_code == 'sql' %] SQL
86 [% ELSE %] Unknown type
90 [% BLOCK used_for_description %]
91 [% IF used_for_code == 'export_records' %] Export records
92 [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
93 [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
94 [% ELSIF used_for_code == 'export_lost_items' %] Export lost items in report
95 [% ELSE %] Unknown usage
99 [% IF op == 'add_form' %]
101 <h1>Modify a CSV profile</h1>
103 <h1>New CSV profile</h1>
106 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
107 <input type="hidden" name="op" value="add_validate" />
108 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
109 <fieldset class="rows">
112 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id %]</li>
115 <label for="profile" class="required">Profile name: </label>
116 <input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
117 <span class="required">Required</span>
120 <label for="type" class="required">Profile type: </label>
121 <select id="type" name="type">
122 [% FOREACH type IN [ 'marc' 'sql'] %]
123 [% IF csv_profile.type == type %]
124 <option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
126 <option value="[% type %]">[% PROCESS type_description type_code = type %]</option>
130 <span class="required">Required</span>
132 <li class="sql_specific">
133 <label for="used_for_sql">Usage: </label>
134 <select id="used_for_sql" name="used_for_sql">
135 [% FOREACH used_for IN [ 'late_issues' 'export_basket' 'export_lost_items' ] %]
136 [% IF csv_profile.used_for == used_for %]
137 <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
139 <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
144 <li class="marc_specific">
145 <label for="used_for_marc">Usage: </label>
146 <select id="used_for_marc" name="used_for_marc">
147 [% FOREACH used_for IN [ 'export_records' ] %]
148 [% IF csv_profile.used_for == used_for %]
149 <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
151 <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
157 <label for="description">Profile description: </label>
158 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
161 <label for="csv_separator">CSV separator: </label>
162 <select name="csv_separator" id="csv_separator">
163 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
167 <li class="marc_specific">
168 <label for="field_separator">Field separator: </label>
169 <select name="field_separator" id="field_separator">
170 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
174 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
175 <select name="subfield_separator" id="subfield_separator">
176 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
180 <li class="marc_specific"><label for="encoding">Encoding: </label>
181 <select name="encoding" id="encoding">
182 [% FOREACH encoding IN encodings %]
183 [% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
184 <option selected="selected">[% encoding %]</option>
186 <option>[% encoding %]</option>
192 <li class="marc_specific">
193 <label for="marc_content" class="required">Profile MARC fields: </label>
194 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content %]</textarea>
195 <span class="required">Required</span>
196 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
197 <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>
198 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
199 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
202 <li class="sql_specific">
203 <label for="late_issues_content" class="required">Profile SQL fields: </label>
204 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content %]</textarea>
205 <p>You have to define which fields you want to export, separated by pipes.</p>
206 <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>
207 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
208 <p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
209 <p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
213 <fieldset class="action">
214 <input type="submit" value="Submit" />
215 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
220 [% IF op == 'delete_confirm' %]
221 <div class="dialog alert">
223 <h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
224 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
225 <input type="hidden" name="op" value="delete_confirmed" />
226 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
227 <input type="submit" class="approve" value="Yes, delete" />
229 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
230 <input type="submit" class="deny" value="No, do not Delete" />
233 This CSV Profile does not exist.
238 [% IF op == 'list' %]
240 <div id="toolbar" class="btn-toolbar">
241 <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>
244 <h2>CSV profiles</h2>
246 [% IF csv_profiles %]
247 <table id="table_csv_profiles">
249 <th>CSV profile ID</th>
253 <th>CSV separator</th>
259 [% FOREACH csv_profile IN csv_profiles %]
261 <td>[% csv_profile.export_format_id %]</td>
262 <td>[% csv_profile.profile |html %]</td>
263 <td>[% csv_profile.description |html %]</td>
264 <td>[% csv_profile.content |html %]</td>
265 <td>[% csv_profile.csv_separator %]</td>
266 <td>[% PROCESS type_description type_code = csv_profile.type %]</td>
267 <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
269 <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>
270 <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>
277 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
283 <div class="yui-b noprint">
284 [% INCLUDE 'tools-menu.inc' %]
288 [% MACRO jsinclude BLOCK %]
289 <script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu_[% KOHA_VERSION %].js"></script>
290 <script type="text/javascript">
291 function reloadPage(p) {
293 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
295 $(document).ready(function() {
296 $("#type").change(function(){
297 if ( $(this).find("option:selected").val() == "marc" ) {
298 $("li.marc_specific").show();
299 $("#marc_content").attr("required", "required");
300 $("li.sql_specific").hide();
301 $("#sql_content").removeAttr("required");
303 $("li.marc_specific").hide();
304 $("#marc_content").removeAttr("required");
305 $("li.sql_specific").show();
306 $("#sql_content").attr("required", "required");
314 [% INCLUDE 'intranet-bottom.inc' %]