Bug 16589

Summary: Quote of the day: Fix upload with csv files associated to LibreOffice Calc
Product: Koha Reporter: Marc Véron <veron>
Component: ToolsAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: f.demians, jonathan.druart, julian.maurice, kyle
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16513
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 16589 - Quote of the day: Fix upload with csv files associated to LibreOffice Calc
Bug 16589 - Quote of the day: Fix upload with csv files associated to LibreOffice Calc
Bug 16589 - Quote of the day: Fix upload with csv files associated to LibreOffice Calc
Bug 16859: Fix wrong item field name in export.pl

Description Marc Véron 2016-05-25 14:35:30 UTC
Upload a valid CSV file to QOD results in error message.

Uploads limited to csv. Incorrect filetype: application/vnd.sun.xml.calc

Tested with a valid sample file from Bug 15684 - Fix encoding issues with quote upload
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=47405
Comment 1 Owen Leonard 2016-05-25 15:06:57 UTC
I've tried my own CSV file and those on Bug 15684 and I get no errors.
Comment 2 Marc Véron 2016-05-26 08:30:34 UTC
(In reply to Owen Leonard from comment #1)
> I've tried my own CSV file and those on Bug 15684 and I get no errors.

I think the issue is related to the fact that on my computer .csv files are associated with LibreOffice (Calc): application/vnd.sun.xml.calc

See koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt line 241:

if (!fileType.match(/comma-separated-values|csv|excel/i)) {
    alert(_("Uploads limited to csv. Incorrect filetype: %s").format(fileType));
Comment 3 Marc Véron 2016-05-28 07:59:58 UTC Comment hidden (obsolete)
Comment 4 Frédéric Demians 2016-05-28 09:04:29 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-06-10 15:06:17 UTC
Looks good but I cannot recreate the issue.
Comment 6 Jonathan Druart 2016-06-10 15:10:35 UTC
Created attachment 52244 [details] [review]
Bug 16589 - Quote of the day: Fix upload with csv files associated to LibreOffice Calc

To reproduce:
- Install LibreOffice and make sure that csv files are associated to Calc
  (Note: tested with Firefox 46.0.1 on Windows 8)
- Go to Home > Tools > Quote editor > Quote uploader
- Try to upload a valid CSV (e.g. Example from Bug 15684)
Result: File can not be uploaded
        (Incorrect filetype: application/vnd.sun.xml.calc)
To test:
- Apply patch
- Try to upload again
Expected result: Quotes are imported.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
  Can't reproduce on a Mac but get it fails on a Windows Box: fixed with this
  patch.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Can't recreate on debian but the fix looks safe.
Comment 7 Kyle M Hall 2016-06-10 17:39:29 UTC
Pushed to master for Koha 16.11, thanks Marc!
Comment 8 Frédéric Demians 2016-06-15 07:47:18 UTC
Pushed in 16.05. Will be in 16.05.01.
Comment 9 Julian Maurice 2016-06-16 09:21:10 UTC
Patch pushed to 3.22.x, will be in 3.22.8
Comment 10 Marcel de Rooy 2016-07-06 14:10:06 UTC Comment hidden (obsolete)
Comment 11 Marcel de Rooy 2016-07-06 14:12:53 UTC
Comment on attachment 53129 [details] [review]
Bug 16859: Fix wrong item field name in export.pl

Sorry, wrong bug number..