Owen Leonard
a6abaca8d0
This patch modifies the staff client "Additional tools" templates so that JavaScript is included in the footer instead of the header: - Calendar - CSV profiles - Log viewer - News - Task scheduler - Edit quotes for QOTD feature - Upload Note that the log viewer template has been modified so that the "interface" variable (passed to the template to provide the correct path to staff client assets) isn't overwritten by an "interface" variable required by the log viewer. To test, apply the patch and test the JavaScript-driven features of each modified template: All button controls, DataTables functionality, form validation, etc. Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
313 lines
14 KiB
Text
313 lines
14 KiB
Text
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › CSV export profiles</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="tools_csv-profiles" class="tools">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
› <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
|
|
› CSV export profiles
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
[% FOR m IN messages %]
|
|
<div class="dialog [% m.type %]">
|
|
[% SWITCH m.code %]
|
|
[% CASE 'error_on_update' %]
|
|
An error occurred when updating this CSV profile. Perhaps it already exists.
|
|
[% CASE 'error_on_insert' %]
|
|
An error occurred when adding this CSV profile.
|
|
[% CASE 'error_on_delete' %]
|
|
An error occurred when deleting this CSV profile. Check the logs.
|
|
[% CASE 'success_on_update' %]
|
|
CSV profile updated successfully.
|
|
[% CASE 'success_on_insert' %]
|
|
CSV profile added successfully.
|
|
[% CASE 'success_on_delete' %]
|
|
CSV profile deleted successfully.
|
|
[% CASE 'already_exists' %]
|
|
This CSV profile already exists.
|
|
[% CASE %]
|
|
[% m.code %]
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% BLOCK list_separator_options %]
|
|
[% IF selected_separator == ',' %]
|
|
<option value="," selected="selected">Comma (,)</option>
|
|
[% ELSE %]
|
|
<option value=",">Comma (,)</option>
|
|
[% END %]
|
|
[% IF selected_separator == '|' %]
|
|
<option value="|" selected="selected">Pipe (|)</option>
|
|
[% ELSE %]
|
|
<option value="|">Pipe (|)</option>
|
|
[% END %]
|
|
[% IF selected_separator == ';' %]
|
|
<option value=";" selected="selected">Semi-colon (;)</option>
|
|
[% ELSE %]
|
|
<option value=";">Semi-colon (;)</option>
|
|
[% END %]
|
|
[% IF selected_separator == '#' %]
|
|
<option value="#" selected="selected">Sharp (#)</option>
|
|
[% ELSE %]
|
|
<option value="#">Sharp (#)</option>
|
|
[% END %]
|
|
[% IF selected_separator == ' ' %]
|
|
<option value=" " selected="selected">Space ( )</option>
|
|
[% ELSE %]
|
|
<option value=" ">Space ( )</option>
|
|
[% END %]
|
|
[% IF selected_separator == '\t' %]
|
|
<option value="\t" selected="selected">Tabulation (\t)</option>
|
|
[% ELSE %]
|
|
<option value="\t">Tabulation (\t)</option>
|
|
[% END %]
|
|
[% IF selected_separator == '\n' %]
|
|
<option value="\n" selected="selected">New line (\n)</option>
|
|
[% ELSE %]
|
|
<option value="\n">New line (\n)</option>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% BLOCK type_description %]
|
|
[% IF type_code == 'marc' %] MARC
|
|
[% ELSIF type_code == 'sql' %] SQL
|
|
[% ELSE %] Unknown type
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% BLOCK used_for_description %]
|
|
[% IF used_for_code == 'export_records' %] Export records
|
|
[% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
|
|
[% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
|
|
[% ELSE %] Unknown usage
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
[% IF csv_profile %]
|
|
<h1>Modify a CSV profile</h1>
|
|
[% ELSE %]
|
|
<h1>New CSV profile</h1>
|
|
[% END %]
|
|
|
|
<form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
|
|
<input type="hidden" name="op" value="add_validate" />
|
|
<input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
|
|
<fieldset class="rows">
|
|
<ol>
|
|
[% IF csv_profile %]
|
|
<li><span class="label">Profile ID: </span>[% csv_profile.export_format_id %]</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="profile" class="required">Profile name: </label>
|
|
<input type="text" name="profile" id="profile" value="[% csv_profile.profile | html %]" class="required">
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="type" class="required">Profile type: </label>
|
|
<select id="type" name="type">
|
|
[% FOREACH type IN [ 'marc' 'sql'] %]
|
|
[% IF csv_profile.type == type %]
|
|
<option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
|
|
[% ELSE %]
|
|
<option value="[% type %]">[% PROCESS type_description type_code = type %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li class="sql_specific">
|
|
<label for="used_for_sql">Usage: </label>
|
|
<select id="used_for_sql" name="used_for_sql">
|
|
[% FOREACH used_for IN [ 'late_issues' 'export_basket' ] %]
|
|
[% IF csv_profile.used_for == used_for %]
|
|
<option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
|
|
[% ELSE %]
|
|
<option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li class="marc_specific">
|
|
<label for="used_for_marc">Usage: </label>
|
|
<select id="used_for_marc" name="used_for_marc">
|
|
[% FOREACH used_for IN [ 'export_records' ] %]
|
|
[% IF csv_profile.used_for == used_for %]
|
|
<option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
|
|
[% ELSE %]
|
|
<option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="description">Profile description: </label>
|
|
<textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description | html %]</textarea>
|
|
</li>
|
|
<li>
|
|
<label for="csv_separator">CSV separator: </label>
|
|
<select name="csv_separator" id="csv_separator">
|
|
[% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
|
|
</select>
|
|
</li>
|
|
|
|
<li class="marc_specific">
|
|
<label for="field_separator">Field separator: </label>
|
|
<select name="field_separator" id="field_separator">
|
|
[% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
|
|
</select>
|
|
</li>
|
|
|
|
<li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
|
|
<select name="subfield_separator" id="subfield_separator">
|
|
[% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
|
|
</select>
|
|
</li>
|
|
|
|
<li class="marc_specific"><label for="encoding">Encoding: </label>
|
|
<select name="encoding" id="encoding">
|
|
[% FOREACH encoding IN encodings %]
|
|
[% IF csv_profile.encoding == encoding OR NOT csv_profile AND encoding == 'utf8' %]
|
|
<option selected="selected">[% encoding %]</option>
|
|
[% ELSE %]
|
|
<option>[% encoding %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
|
|
<li class="marc_specific">
|
|
<label for="marc_content" class="required">Profile MARC fields: </label>
|
|
<textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content %]</textarea>
|
|
<span class="required">Required</span>
|
|
<p>You have to define which fields or subfields you want to export, separated by pipes.</p>
|
|
<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>
|
|
<p>Example: Personal name=200|Entry element=210$a|300|009</p>
|
|
<p>You can use Template Toolkit tags too. See the help page for more information.</p>
|
|
</li>
|
|
|
|
<li class="sql_specific">
|
|
<label for="late_issues_content" class="required">Profile SQL fields: </label>
|
|
<textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content %]</textarea>
|
|
<p>You have to define which fields you want to export, separated by pipes.</p>
|
|
<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>
|
|
<p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
|
|
<p>For late issues claims you can use data from following tables: serial, subscription, biblio, biblioitems and aqbookseller.</p>
|
|
<p>For basket exports you can use data from following tables: biblio, biblioitems, aqorders, aqbudgets and aqbasket.</p>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" value="Submit" />
|
|
<a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% IF op == 'delete_confirm' %]
|
|
<div class="dialog alert">
|
|
[% IF csv_profile %]
|
|
<h3>Delete CSV Profile "[% csv_profile.profile | html %]?"</h3>
|
|
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
|
|
<input type="hidden" name="op" value="delete_confirmed" />
|
|
<input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
|
|
<input type="submit" class="approve" value="Yes, delete" />
|
|
</form>
|
|
<form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
|
|
<input type="submit" class="deny" value="No, do not Delete" />
|
|
</form>
|
|
[% ELSE %]
|
|
This CSV Profile does not exist.
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<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>
|
|
</div>
|
|
|
|
<h2>CSV profiles</h2>
|
|
|
|
[% IF csv_profiles %]
|
|
<table id="table_csv_profiles">
|
|
<thead>
|
|
<th>CSV profile ID</th>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
<th>Content</th>
|
|
<th>CSV separator</th>
|
|
<th>CSV type</th>
|
|
<th>Usage</th>
|
|
<th>Actions</th>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH csv_profile IN csv_profiles %]
|
|
<tr>
|
|
<td>[% csv_profile.export_format_id %]</td>
|
|
<td>[% csv_profile.profile |html %]</td>
|
|
<td>[% csv_profile.description |html %]</td>
|
|
<td>[% csv_profile.content |html %]</td>
|
|
<td>[% csv_profile.csv_separator %]</td>
|
|
<td>[% PROCESS type_description type_code = csv_profile.type %]</td>
|
|
<td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
|
|
<td class="actions">
|
|
<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>
|
|
<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>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b noprint">
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
<script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
|
|
<script type="text/javascript">
|
|
function reloadPage(p) {
|
|
var id = p.value;
|
|
if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
|
|
}
|
|
$(document).ready(function() {
|
|
$("#type").change(function(){
|
|
if ( $(this).find("option:selected").val() == "marc" ) {
|
|
$("li.marc_specific").show();
|
|
$("#marc_content").attr("required", "required");
|
|
$("li.sql_specific").hide();
|
|
$("#sql_content").removeAttr("required");
|
|
} else {
|
|
$("li.marc_specific").hide();
|
|
$("#marc_content").removeAttr("required");
|
|
$("li.sql_specific").show();
|
|
$("#sql_content").attr("required", "required");
|
|
}
|
|
});
|
|
$("#type").change();
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|