Bug 14647: Make the file name extension dynamic on exporting records

Test -
1. go to cgi-bin/koha/tools/export.pl
2. Check that both tabs ("Export bibliographic records & Rxport authority records") do the following
3. In Output format
4. When changing "File format" from dropdown it update "file name"
5. Still works with user inputted names

Works as expected.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Gus 2016-01-19 23:33:14 +00:00 committed by Martin Renvoize
parent bf0f6a2b8f
commit ebb57cd6c5
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 22 additions and 3 deletions

View File

@ -210,14 +210,14 @@
<fieldset class="rows">
<legend>Output format</legend>
<ol><li>
<label for="output_format">File format: </label>
<select id="output_format" name="output_format">
<label for="output_format_auth">File format: </label>
<select id="output_format_auth" name="output_format_auth">
<option value="marc">marc</option>
<option value="xml">xml</option>
</select>
</li>
<li>
<label for="filename">File name:</label><input id="filename" type="text" name="filename" value="koha.mrc" />
<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" />
@ -316,6 +316,25 @@
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 == "iso2709") {
extension = "mrc";
}
$('#filename_auth').val(file_name_auth[0] + "." + extension);
});
});
</script>
[% END %]