Bug 37321 - CSV import framework breaks on fields with double quotes on its field/subfield name
Summary: CSV import framework breaks on fields with double quotes on its field/subfiel...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-11 01:36 UTC by Pablo AB
Modified: 2024-07-11 01:36 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pablo AB 2024-07-11 01:36:32 UTC
Steps to reproduce the issue:

1. Create a framework with double quotes on its field/subfield name. For e.g.:

   $ grep 501 export_MON.csv # double quotes not escaped :S

   "501","NOTA DE "CON"","NOTA DE "CON"","1","0","0","","","","MON"
   "501","5","Institución que aplica el campo","Institución que aplica el campo","0","0","0","","5","","","","0","-6","MON","","","","9999","0"
   "501","6","Enlace","Enlace","0","0","0","","5","","","","0","-6","MON","","","","9999","0"
   "501","8","Enlace entre campo y número de secuencia","Enlace entre campo y número de secuencia","1","0","0","","5","","","","0","-6","MON","","","","9999","0"
   "501","a","Nota de "con"","Nota de "con"","0","0","0","","5","","","","0","0","MON","","","","9999","0"

2. Export it to a CSV (works fine with ODS)
3. Try to import it.

Without showing any errors to the user, will import until field 500.

Then, change the "con" to «con» (Spanish quotes, AKA guillemets), repeat the procedure. Will hopefully import successfully.

On `plack-intranet-error.log` we get a warning (instead of an error)

    [WARN] Error _processRow_DB C4::ImportExportFramework::_processRow_DB(): DBI Exception: DBD::mysql::st execute failed: called with 12 bind variables when 14 are needed at /usr/share/koha/lib/C4/ImportExportFramework.pm line 1032

https://git.koha-community.org/Koha-community/Koha/src/tag/v24.05.01/C4/ImportExportFramework.pm#L1032
https://translate.koha-community.org/translate/koha/24-05/installer-MARC21/es/?checksum=add04a7091c7769f