Bug 38466

Summary: Kbart import fails silently if file extension is wrong
Product: Koha Reporter: Mathieu Saby <mathsabypro>
Component: ERMAssignee: Matt Blenkinsop <matt.blenkinsop>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, jonathan.field, martin.renvoize, matt.blenkinsop, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 34788    
Bug Blocks:    
Attachments: example of KBART file not imported
Bug 38466: Fix error messages in KBART import
Bug 38466: Fix error messages in KBART import

Description Mathieu Saby 2024-11-17 17:37:59 UTC
Created attachment 174646 [details]
example of KBART file not imported

Tested today in PTFS MARC21 Sandbox

- eHoldings > Local > Packages: create a local package
- eHoldings > Local > Titles > Import from KBART
> import a kbart file (I tested with several from https://bacon.abes.fr/exporter.html site)
> To the following local package: select the local package created before
> Keep unchecked the checkbox "Create linked bibliographic record:" (the same issue is present if it checked)

Submit

During a few second the message "Submitting" appears, and that is all, the records are not imported

I can see this error in Console : 

EHoldingsLocalTitlesKBARTImport.vue:159 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'invalid_columns')
    at EHoldingsLocalTitlesā€¦RTImport.vue:159:42
Comment 1 Mathieu Saby 2024-11-17 17:40:41 UTC
note that the file has an extra column "bestppn", but even if I remove this column the error persists
Comment 2 Matt Blenkinsop 2024-11-18 11:54:39 UTC
Created attachment 174680 [details] [review]
Bug 38466: Fix error messages in KBART import

Test plan:
1) Download the file attached to this bug and save it as a .txt file
2) In the ERM module, create a local package
3) Go to the local titles page and click Import from KBART file
4) Select your package and the saved file and click import
5) The import will fail with just a console error
6) Apply patch and run a restart_all and a yarn js:build
7) Repeat step 4, it should now display an error saying the file must be either TSV or CSV
8) Convert the file to either of those two formats and repeat step 4
9) The file should now import successfully, with a message saying that there is an additional column "bestppn" that will not be imported
Comment 3 Mathieu Saby 2024-11-18 12:18:50 UTC
ok, I thought the CSV or TSV filetype was checked against the structure of the file, not it's extension.

I am testing
Comment 4 Matt Blenkinsop 2024-11-18 12:25:38 UTC
In bug 36831 there is some work to make the filetype irrelevant but it needs a bit more work done to be ready
Comment 5 Mathieu Saby 2024-11-18 12:37:51 UTC
Indeed the import is working well if the file have an extension ".tsv". So the title of the bug is wrong. I suppose it should be something like "Missing warning if the import of a KBART file fails because of wrong extension" ?
Comment 6 Biblibre Sandboxes 2024-11-18 16:20:28 UTC
Created attachment 174737 [details] [review]
Bug 38466: Fix error messages in KBART import

Test plan:
1) Download the file attached to this bug and save it as a .txt file
2) In the ERM module, create a local package
3) Go to the local titles page and click Import from KBART file
4) Select your package and the saved file and click import
5) The import will fail with just a console error
6) Apply patch and run a restart_all and a yarn js:build
7) Repeat step 4, it should now display an error saying the file must be either TSV or CSV
8) Convert the file to either of those two formats and repeat step 4
9) The file should now import successfully, with a message saying that there is an additional column "bestppn" that will not be imported

Signed-off-by: msaby <mathsabypro@gmail.com>
Comment 7 Mathieu Saby 2024-11-18 16:23:27 UTC
Thanks, I tested on a sandbox, everything is ok