Bug 17395 - exporting checkouts in CSV generates a file with wrong extension
Summary: exporting checkouts in CSV generates a file with wrong extension
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Fridolin SOMERS
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-04 10:51 UTC by Fridolin SOMERS
Modified: 2017-06-14 22:13 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension (1.76 KB, patch)
2016-10-04 10:55 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension (1.81 KB, patch)
2016-10-11 14:33 UTC, Danielle Elder
Details | Diff | Splinter Review
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension (1.87 KB, patch)
2016-11-24 13:00 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin SOMERS 2016-10-04 10:51:02 UTC
In checkouts table, the is an export form (when some exports syspref are enabled).
Export using a CSV profile will create a file with name koha.mrc (same as ISO2709 export).
It would be better with koha.csv.

Bug 14647 manages the export page, this but will only manage for export from checkouts table where file name is hard-coded.
Comment 1 Fridolin SOMERS 2016-10-04 10:55:50 UTC
Created attachment 56019 [details] [review]
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension

In checkouts table, the is an export form (when some exports syspref are enabled).
Export using a CSV profile will create a file with name koha.mrc (same as ISO2709 export).
It would be better with koha.csv.

Bug 14647 manages the export page, this but will only manage for export from checkouts table where file name is hard-coded.

Test plan :
- Enable checkouts exports by setting syspref ExportWithCsvProfile with a profile for record export
- Go to circ page of a patron with checkouts : /cgi-bin/koha/circ/circulation.pl?borrowernumber=xxx
- Show checkouts table
- Select some checkboxes in "Export" column
- Select "CSV" in export format combo-box
- Click on "Export"
=> Without patch, the generated file is koha.mrc
=> With patch, the generated file is koha.csv
- Check ISO2709 export generates a file named koha.mrc
Comment 2 Jonathan Druart 2016-10-04 11:07:12 UTC
Would not have been better to revive the patch from bug 14647?
Comment 3 Fridolin SOMERS 2016-10-06 12:15:27 UTC
(In reply to Jonathan Druart from comment #2)
> Would not have been better to revive the patch from bug 14647?

Bug 14647 manages exports made by a real user with the page form, it will not manage when export page is called from exporting checkouts : arg filename is not provided so it is then hardcoded.

Maybe we can add an hidden input for filename but its more complicated I'd say.
Comment 4 sandboxes@biblibre.com 2016-10-06 12:22:10 UTC
Patch tested with a sandbox, by Fridolin <fsomers@biblibre.com>
Comment 5 Fridolin SOMERS 2016-10-06 12:26:14 UTC
(In reply to sandboxes@biblibre.com from comment #4)
> Patch tested with a sandbox, by Fridolin <fsomers@biblibre.com>

I'm just testing our new sandboxes
Comment 6 sandboxes@biblibre.com 2016-10-06 14:03:10 UTC
Patch tested with a sandbox, by Fridolin <fsomers@biblibre.com>
Comment 7 Fridolin SOMERS 2016-10-06 14:11:08 UTC
(In reply to sandboxes@biblibre.com from comment #6)
> Patch tested with a sandbox, by Fridolin <fsomers@biblibre.com>

Aborted
Comment 8 Danielle Elder 2016-10-11 14:33:28 UTC
Created attachment 56200 [details] [review]
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension

In checkouts table, the is an export form (when some exports syspref are enabled).
Export using a CSV profile will create a file with name koha.mrc (same as ISO2709 export).
It would be better with koha.csv.

Bug 14647 manages the export page, this but will only manage for export from checkouts table where file name is hard-coded.

Test plan :
- Enable checkouts exports by setting syspref ExportWithCsvProfile with a profile for record export
- Go to circ page of a patron with checkouts : /cgi-bin/koha/circ/circulation.pl?borrowernumber=xxx
- Show checkouts table
- Select some checkboxes in "Export" column
- Select "CSV" in export format combo-box
- Click on "Export"
=> Without patch, the generated file is koha.mrc
=> With patch, the generated file is koha.csv
- Check ISO2709 export generates a file named koha.mrc

Signed-off-by: Dani Elder <dani@bywatersolutions.com>
Comment 9 Jonathan Druart 2016-10-25 09:27:31 UTC
I do not understand the test plan: the filename is automatically set to "koha.mrc".
It looks like we should do this trick using some JS code.
Comment 10 Fridolin SOMERS 2016-11-07 15:48:06 UTC
(In reply to Jonathan Druart from comment #9)
> I do not understand the test plan: the filename is automatically set to
> "koha.mrc".
> It looks like we should do this trick using some JS code.

I don't see how, but this quick fix is ok no ?
Some users may not be aware they must change the file extension, they open it directly from web-browser.
Comment 11 Jonathan Druart 2016-11-18 11:26:19 UTC
As I said previously, this has to be done in javascript to fill the "File name" input depending on the format the user picked.

Currently the behavior is:
- "File name" is "koha.mrc" by default
- User select csv as the format and pick a csv profile
- "File name" is still "koha.mrc"
- Click on export
=> File is named "koha.mrc" (expected)

What you want (I suppose):
- "File name" is "koha.mrc" by default
- User select csv as the format and pick a csv profile
- "File name" is changed to "koha.csv" (ideally you only change the extension)
- Click on export
=> File is named "koha.csv"
Comment 12 Fridolin SOMERS 2016-11-24 07:50:49 UTC
(In reply to Jonathan Druart from comment #11)
> As I said previously, this has to be done in javascript to fill the "File
> name" input depending on the format the user picked.
Mmmm this is a point of view I think.
Fixing in perl is safer in my opinion, it fixes for all calls.

> to fill the "File name" input
There is actually no such input, create an hidden one you mean ?
Comment 13 Jonathan Druart 2016-11-24 13:00:03 UTC
Created attachment 57748 [details] [review]
Bug 17395 - exporting checkouts in CVS generates a file with wrong extension

In checkouts table, the is an export form (when some exports syspref are enabled).
Export using a CSV profile will create a file with name koha.mrc (same as ISO2709 export).
It would be better with koha.csv.

Bug 14647 manages the export page, this but will only manage for export from checkouts table where file name is hard-coded.

Test plan :
- Enable checkouts exports by setting syspref ExportWithCsvProfile with a profile for record export
- Go to circ page of a patron with checkouts : /cgi-bin/koha/circ/circulation.pl?borrowernumber=xxx
- Show checkouts table
- Select some checkboxes in "Export" column
- Select "CSV" in export format combo-box
- Click on "Export"
=> Without patch, the generated file is koha.mrc
=> With patch, the generated file is koha.csv
- Check ISO2709 export generates a file named koha.mrc

Signed-off-by: Dani Elder <dani@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 14 Jonathan Druart 2016-11-24 13:01:47 UTC
Sorry Frido, I mixed it up with the export records tool.
Comment 15 Kyle M Hall 2016-11-29 17:45:13 UTC
Pushed to master for 17.05, thanks Frido!
Comment 16 Julian Maurice 2016-11-30 13:51:10 UTC
Pushed to 3.22.x, will be in 3.22.13
Comment 17 Katrin Fischer 2016-12-04 21:37:20 UTC
This patch has been pushed to 16.11.x, will be in 16.11.01.