https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43979

--- Comment #1 from Adolfo Rodríguez Taboada <[email protected]> ---
Created attachment 210194
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210194&action=edit
Bug 43979: Framework import: do not silently drop subfields with a missing
authorised value category

When a subfield in an imported MARC framework uses an authorised value
category that does not exist, the row failed on the foreign key and the
error only went to the logs. The subfield was not created, or, if it
already existed, it was deleted at the end of the import, and the import
was still reported as successful.

This patch:
- Imports the subfield without the authorised value category, as the
  foreign key does when a category is deleted (ON DELETE SET NULL).
- Keeps the existing row when a row cannot be imported for any other
  reason, instead of deleting it.
- Collects these problems in an optional parameter of ImportFramework, and
  shows them on the framework structure page after the import.

Steps to follow:
1. Go to Administration > MARC bibliographic frameworks and create a new
   framework, e.g. code TST. When asked, create its structure from the
   default framework.
2. Actions > Export for TST, as CSV. Keep that file.
3. Make a copy of the file and open the copy in a text editor. In the row
   for subfield 952$c ("952","c","Shelving location",...), replace the
   authorised value category "LOC" with "LOCX" (a category that does not
   exist). Save it.
4. Actions > Import for TST, choose the copy and confirm.
5. You are redirected to the framework structure with no message. Go to tag
   952 > Subfields: subfield c is gone.
6. Apply the patch and restart Plack.
7. Import the original file from step 2 again: 952$c is back.
8. Import the copy from step 3 again:
   - The structure page shows a warning: "The framework was imported with
     warnings", listing "952$c: LOCX".
   - Tag 952 > Subfields: subfield c is still there, with no authorised
     value.
9. Run the tests:
   prove t/db_dependent/ImportExportFramework.t

Co-Authored-By: Claude Opus 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to