Bug 14647

Summary: When exporting records, the file name extension should match the selected export format
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: ToolsAssignee: Gus Ellerm <ellermaugustus>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: 1joynelson, chris, david, ellermaugustus, jonathan.druart, katrin.fischer, martin.renvoize, veron
Version: masterKeywords: Academy
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17395
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement to the catalog export data tool automatically changes the file extension in the file name to the selected export format (such as as CSV, or XML), rather than leaving it as .mrc.
Version(s) released in:
20.05.00
Attachments: 14647 - Make the file name extension dynamic on exporting records Test - 1. Go to /cgi-bin/koha/tools/export.pl and locate the Output format form 2. Change the file format from dropdown and notice the change in the 'File name' 3. Type a random name into '
14647 - Make the file name extension dynamic on exporting records
14647 - Make the file name extension dynamic on exporting records
14647 - Make the file name extension dynamic on exporting records
14647 - Make the file name extension dynamic on exporting records
Bug 14647: [FOLLOW-UP] Changes to script
Bug 14647: Make the file name extension dynamic on exporting records
Bug 14647: (follow-up) Changes to script
Bug 14647: (follow-up) Fix script not detecting XML output format
Bug 14647: Make the file name extension dynamic on exporting records
Bug 14647: (follow-up) Changes to script
Bug 14647: (follow-up) Fix script not detecting XML output format
Bug 14647: Make the file name extension dynamic on exporting records
Bug 14647: (follow-up) Changes to script
Bug 14647: (follow-up) Fix script not detecting XML output format
Bug 14647: Make spelling in file format pull downs match

Description Aleisha Amohia 2015-08-05 04:13:33 UTC
Tools --> Export Data (or /cgi-bin/koha/tools/export.pl)

Under the Output format sections (on both the bibliographic and authority records tabs) there is a drop-down menu to select the file format of the exported file.

The default file format is marc and default file name is 'koha.mrc', but I think it would be a good idea to make the extension dynamic so that when the user selects a different file format (xml or csv) the file name changes respectively (ie to 'koha.xml' or 'koha.csv'). 

Makes the system more efficient for users and teaches them about correct filenames and extensions without having to actually teach them anything.
Comment 1 Gus Ellerm 2016-01-19 22:53:54 UTC Comment hidden (obsolete)
Comment 2 Gus Ellerm 2016-01-19 23:36:51 UTC Comment hidden (obsolete)
Comment 3 Gus Ellerm 2016-01-20 20:17:13 UTC Comment hidden (obsolete)
Comment 4 Gus Ellerm 2016-01-20 20:31:18 UTC Comment hidden (obsolete)
Comment 5 Aleisha Amohia 2016-01-20 20:37:00 UTC
Have tested and this works perfectly! Can someone else please sign off :)
Comment 6 Marc Véron 2016-01-25 18:56:50 UTC
Created attachment 47275 [details] [review]
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: Marc Véron <veron@veron.ch>
Comment 7 Jonathan Druart 2016-01-27 11:21:56 UTC
It does not work: you are modifying a param in the template, but not in the script (output_format_auth).
When I export authorities, I always get an empty file named "koha.mrc".
Comment 8 Aleisha Amohia 2017-07-10 02:09:27 UTC
Created attachment 64943 [details] [review]
Bug 14647: [FOLLOW-UP] Changes to script

This patch adds the necessary changes to the script so that the filename
extensions works for exporting authorities.

To test:
1) Attempt to export with all filetypes for biblios and authorities
2) Confirm the extension for the exported file (after clicking the
    Export button) is correct for each one

Sponsored-by: Catalyst IT
Comment 9 Katrin Fischer 2017-10-07 13:51:04 UTC
Patch doesn't apply, please rebase!
Comment 10 Aleisha Amohia 2020-02-06 22:41:32 UTC
Created attachment 98541 [details] [review]
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.
Comment 11 Aleisha Amohia 2020-02-06 22:42:26 UTC
Created attachment 98542 [details] [review]
Bug 14647: (follow-up) Changes to script

This patch adds the necessary changes to the script so that the filename
extensions works for exporting authorities.

To test:
1) Attempt to export with all filetypes for biblios and authorities
2) Confirm the extension for the exported file (after clicking the
    Export button) is correct for each one

Sponsored-by: Catalyst IT
Comment 12 David Nind 2020-02-07 08:50:21 UTC
This all works as expected for the file name changes - with the default of marc, and when changing the file name.

However, the content when authority records are exported as XML is in MARC format, rather than XML (this works correctly before the patch is applied).
Comment 13 Aleisha Amohia 2020-02-09 21:33:22 UTC
Created attachment 98627 [details] [review]
Bug 14647: (follow-up) Fix script not detecting XML output format
Comment 14 David Nind 2020-02-10 01:07:01 UTC
Created attachment 98631 [details] [review]
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>
Comment 15 David Nind 2020-02-10 01:07:05 UTC
Created attachment 98632 [details] [review]
Bug 14647: (follow-up) Changes to script

This patch adds the necessary changes to the script so that the filename
extensions works for exporting authorities.

To test:
1) Attempt to export with all filetypes for biblios and authorities
2) Confirm the extension for the exported file (after clicking the
    Export button) is correct for each one

Sponsored-by: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>
Comment 16 David Nind 2020-02-10 01:07:09 UTC
Created attachment 98633 [details] [review]
Bug 14647: (follow-up) Fix script not detecting XML output format

Signed-off-by: David Nind <david@davidnind.com>
Comment 17 Katrin Fischer 2020-02-19 22:45:57 UTC
Created attachment 99287 [details] [review]
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>
Comment 18 Katrin Fischer 2020-02-19 22:46:01 UTC
Created attachment 99288 [details] [review]
Bug 14647: (follow-up) Changes to script

This patch adds the necessary changes to the script so that the filename
extensions works for exporting authorities.

To test:
1) Attempt to export with all filetypes for biblios and authorities
2) Confirm the extension for the exported file (after clicking the
    Export button) is correct for each one

Sponsored-by: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Katrin Fischer 2020-02-19 22:46:05 UTC
Created attachment 99289 [details] [review]
Bug 14647: (follow-up) Fix script not detecting XML output format

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 20 Katrin Fischer 2020-02-19 22:46:09 UTC
Created attachment 99290 [details] [review]
Bug 14647: Make spelling in file format pull downs match

While bibliographic had XML and MARC, authorities had xml and marc
in the pull down. This just makes both the same.

To test:
- Look at the pull downs on both tabs and verify they are
  now using the same spelling

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 21 Martin Renvoize 2020-02-20 09:11:06 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 22 Joy Nelson 2020-03-13 00:47:24 UTC
enhancement not backported to 19.11.x