Bug 37321

Summary: CSV import framework breaks on fields with double quotes on its field/subfield name
Product: Koha Reporter: Pablo AB <pablo.bianchi>
Component: System AdministrationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt
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:

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