Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt
Slava Shishkin a104722b9d
Bug 33590: Fix DOM id name for tabs after WRAPPER code added to export.tt
The list of CSV profiles was not displayed if the CSV format was selected in the output format settings.

To test:
1. Go to /cgi-bin/koha/tools/export.pl
2. At the bottom of the page in the Output format, select CSV format.
  *If CSV format is not active in the drop-down File format menu, create
   any profile to Usage export records on the link /cgi-bin/koha/tools/csv-profiles.pl
3. Note that the list of CSV profiles is not displayed.
4. Apply the patch.
5. Restart the page and repeat steps 2.
6. Verify that when you select the CSV format, the list of CSV profiles appears.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:17 -03:00

378 lines
17 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Export data &rsaquo; Cataloging &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
fieldset.rows fieldset.rows {
width: 90%;
}
</style>
</head>
<body id="tools_export" class="tools">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
[% WRAPPER breadcrumbs %]
[% WRAPPER breadcrumb_item %]
<a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
<span>Export data</span>
[% END %]
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<h1>Export data</h1>
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'invalid_mimetype' %]<span>The file used does not have a valid format. Only csv and txt are allowed.</span>
[% CASE %][% m.code | html %]
[% END %]
</div>
[% END %]
[% WRAPPER tabs id= "exporttype" %]
[% WRAPPER tabs_nav %]
[% WRAPPER tab_item tabname= "bibs" bt_active= 1 %] <span>Export bibliographic records</span> [% END %]
[% WRAPPER tab_item tabname= "auths" %] <span>Export authority records</span> [% END %]
[% IF ( allow_db_export ) %]
[% WRAPPER tab_item tabname= "db" %] <span>Export database</span> [% END %]
[% END %]
[% IF ( allow_conf_export ) %]
[% WRAPPER tab_item tabname= "conf" %] <span>Export configuration</span> [% END %]
[% END %]
[% END # /WRAPPER tabs_nav %]
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="bibs" bt_active= 1 %]
<p>
<strong>Note : The items are exported by this tool unless specified.</strong>
</p>
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
<fieldset class="rows">
<legend> Select records to export </legend>
<ol>
<li>
<label for="start">From biblionumber: </label>
<input id="start" type="text" name="StartingBiblionumber" size="5" />
</li>
<li>
<label for="end">To biblionumber: </label>
<input id="end" type="text" name="EndingBiblionumber" size="5" />
</li>
<li>
<label for="itemtype">Item type: </label>
<select name="itemtype" id="itemtype" multiple>
<option value="">-- All --</option>
[% FOREACH itemtype IN itemtypes %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
[% END %]
</select>
</li>
<li>
<label>With items owned by the following libraries: </label>
[% INCLUDE 'branch-selector.inc' branches = libraries %]
</li>
</ol>
<fieldset class="rows">
<legend>Call number range</legend>
<ol>
<li>
<label for="startcn">From item call number: </label>
<input id="startcn" type="text" name="start_callnumber" size="15" />
</li>
<li>
<label for="endcn">To item call number: </label>
<input id="endcn" type="text" name="end_callnumber" size="15" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Accession date (inclusive)</legend>
<ol>
<li>
<label for="from">Start date:</label>
<input type="text" size="10" id="from" name="start_accession" value="[% from | html %]" class="flatpickr" data-date_to="to" />
</li>
<li>
<label for="to">End date:</label>
<input size="10" id="to" name="end_accession" value="[% end_accession | html %]" type="text" class="flatpickr" />
</li>
</ol>
</fieldset>
</fieldset>
<fieldset class="rows">
<legend>
Use a file
</legend>
<ol>
<li>
File containing a list of biblionumbers with one biblionumber per line. This list works as a filter: it is compatible with other parameters. (File types accepted: .csv and .txt)
</li>
<li>
<label for="id_list_file">File: </label> <input type="file" id="id_list_file" name="id_list_file" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend> Options</legend>
<ol>
<li>
<label for="dont_export_item">Don't export items:</label>
<input id="dont_export_item" type="checkbox" name="dont_export_item" />
</li>
<li>
<label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label>
<input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" />
</li>
<li>
<label for="export_remove_fields">Don't export fields:</label>
<input id="export_remove_fields" type="text" name="export_remove_fields" value="[% export_remove_fields | html %]" />
separate by a blank. (e.g., 100a 200 606)
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>
Output format
</legend>
<ol>
<li>
<label for="output_format">File format: </label>
<select id="output_format" name="output_format">
<option value="iso2709">MARC</option>
<option value="xml">XML</option>
[% IF csv_profiles %]
<option value="csv">CSV</option>
[% ELSE %]
<option value="csv" disabled data-toggle="tooltip" data-placement="left" title="You must create a CSV profile for MARC exports to use this option.">CSV</option>
[% END %]
</select>
</li>
<li class="csv_profiles">
<label for="bibs_csv_profile">CSV profile: </label>
<select id="bibs_csv_profile" name="csv_profile_id">
[% FOR csv_profile IN csv_profiles %]
<option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option>
[% END %]
</select>
</li>
<li>
<label for="filename">File name:</label><input id="filename" type="text" name="filename" value="koha.mrc" />
</li>
</ol>
</fieldset>
<input type="hidden" name="op" value="export" />
<input type="hidden" name="record_type" value="bibs" />
<fieldset class="action">
<input type="submit" class="btn btn-primary" value="Export bibliographic records" />
</fieldset>
</form>
[% END # /tab_panel#bibs %]
[% WRAPPER tab_panel tabname="auths" %]
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
<fieldset class="rows">
<legend> Select records to export </legend>
<ol>
<li>
<label for="start">From authid: </label>
<input id="start" type="text" name="starting_authid" size="6" />
</li>
<li>
<label for="end">To authid: </label>
<input id="end" type="text" name="ending_authid" size="6" />
</li>
<li>
<label for="authtype">Authority type: </label>
<select name="authtype" id="authtype">
<option value="">-- All --</option>
[% FOREACH authority_type IN authority_types %]
<option value="[% authority_type.authtypecode | html %]">[% authority_type.authtypetext | html %]</option>
[% END %]
</select>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>
Use a file
</legend>
<ol>
<li>
File containing a list of authids with one authid per line. This list works as a filter: it is compatible with other parameters. (File types accepted: .csv and .txt)
</li>
<li>
<label for="id_list_file">File:</label> <input type="file" id="id_list_file" name="id_list_file" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Options</legend>
<ol>
<li>
<label for="export_remove_fields">Don't export fields:</label>
<input id="export_remove_fields" type="text" name="export_remove_fields" />
<div class="hint">separate by a blank. (e.g., 100a 200 606)</div>
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Output format</legend>
<ol>
<li>
<label for="output_format">File format: </label>
<select id="output_format_auth" name="output_format">
<option value="marc">MARC</option>
<option value="xml">XML</option>
</select>
</li>
<li>
<label for="filename_auth">File name:</label>
<input id="filename_auth" type="text" name="filename_auth" value="koha.mrc" />
</li>
</ol>
</fieldset>
<input type="hidden" name="op" value="export" />
<input type="hidden" name="record_type" value="auths" />
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Export authority records" /></fieldset>
</form>
[% END # /tab_panel#auths %]
[% IF ( allow_db_export ) %]
[% WRAPPER tab_panel tabname="db" %]
<form method="post" class="clearfix" action="/cgi-bin/koha/tools/export.pl">
<p><strong>Note : This export file will be very large, and is generated nightly.</strong></p>
<fieldset class="rows">
<legend> Choose a file </legend>
[% IF ( dbfiles && (dbfiles.size > 0) ) %]
<ul>
[% FOREACH dbfile IN dbfiles %]
<li><input type="radio" name="filename" value="[% dbfile | html %]" />[% dbfile | html %]</li>
[% END %]
</ul>
[% ELSE %]
<p style="clear:both">Unfortunately, no backups are available.</p>
[% END %]
</fieldset>
[% IF ( dbfiles && (dbfiles.size > 0) ) %]
<input type="hidden" name="op" value="export" />
<input type="hidden" name="record_type" value="db" />
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Download database" /></fieldset>
[% END %]
</form>
[% END # /tab_panel#db %]
[% END # /IF allow_db_export %]
[% IF ( allow_conf_export ) %]
[% WRAPPER tab_panel tabname="conf" %]
<form method="post" class="clearfix" action="/cgi-bin/koha/tools/export.pl">
<p><strong>Note : This export file will be very large, and is generated nightly.</strong></p>
<fieldset class="rows">
<legend> Choose a file </legend>
[% IF ( conffiles && (conffiles.size > 0) ) %]
<ul>
[% FOREACH conffile IN conffiles %]
<li><input type="radio" name="filename" value="[% conffile | html %]">[% conffile | html %]</input></li>
[% END %]
</ul>
[% ELSE %]
<p style="clear:both">Unfortunately, no backups are available.</p>
[% END %]
</fieldset>
[% IF ( conffiles && (conffiles.size > 0) ) %]
<input type="hidden" name="op" value="export" />
<input type="hidden" name="record_type" value="conf" />
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Download configuration" /></fieldset>
[% END %]
</form>
[% END # /tab_panel#conf %]
[% END # /IF allow_conf_export %]
[% END # /WRAPPER tab_panels %]
[% END # /WRAPPER tabs %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'cat-menu.inc' %]
</aside>
</div> <!-- .col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function() {
$("li.csv_profiles").hide();
$("#bibs_panel select[name='output_format']").on('change', function(){
var format = $(this).val();
if ( format == 'csv' ) {
$("#bibs_panel li.csv_profiles").show();
} else {
$("#bibs_panel li.csv_profiles").hide();
}
});
$("#checkall").on("click",function(e){
e.preventDefault();
$(".branch_select").prop("checked",1);
});
$("#checknone").on("click",function(e){
e.preventDefault();
$(".branch_select").prop("checked",0);
});
$('#output_format').change(function(){
var filename = $('#filename').val();
var file_name = filename.split(".");
var extension = $(this).val();
if (extension == "iso2709") {
extension = "mrc";
}
$('#filename').val(file_name[0] + "." + extension);
});
$('#output_format_auth').change(function(){
var filename_auth = $('#filename_auth').val();
var file_name_auth = filename_auth.split(".");
var extension = $(this).val();
if (extension == "marc") {
extension = "mrc";
}
$('#filename_auth').val(file_name_auth[0] + "." + extension);
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]