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

            Bug ID: 43025
           Summary: Show metadata repair warnings in the cataloguing edit
                    form
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Cataloging
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
        Depends on: 35104
  Target Milestone: ---

Bug 35104 makes Koha::Biblio::Metadata->store() recover non-XML
characters and empty datafields automatically (recording what was
fixed in biblio_metadata_errors), or throw
Koha::Exceptions::Metadata::Invalid when a record's MARCXML cannot be
saved at all. This patch surfaces that in the place cataloguers
actually hit it: the cataloguing edit form.

This patch:
- Catches Koha::Exceptions::Metadata::Invalid on save in
  cataloguing/addbiblio.pl and shows a clear error instead of a raw
  exception, keeping the form populated so nothing is lost.
- Shows a "Record saved with modifications" warning when a save
  succeeded but required automatic repair.
- Lists any pre-existing, unresolved metadata errors when opening a
  record for editing, each with a quick-link to the affected field
  (where the field survived the repair) and a "Mark resolved" action.
- Adds DELETE /api/v1/biblios/{biblio_id}/metadata/errors/{error_id}
  to resolve (delete) a metadata error row, used by the "Mark
  resolved" action.

Depends on bug 35104.

Test plan:
1. Apply this patch on top of bug 35104.
2. Catalogue a new record (or edit an existing one) and add a control
   character (e.g. paste text containing a Unit Separator, 0x1F) into
   a subfield value. Save the record.
3. Confirm the record saves successfully and a "Record saved with
   modifications" warning banner appears describing what was
   automatically fixed.
4. Re-open the record for editing. Confirm a "Data quality warnings"
   banner lists the fault, with a "Go to field" link and a "Mark
   resolved" button.
5. Click "Go to field" - confirm it switches to the correct tab and
   scrolls to the affected field.
6. Click "Mark resolved" - confirm the warning disappears immediately
   and does not reappear after reloading the page.
7. Save a record that cannot be repaired at all (e.g. temporarily
   force Koha::Biblio::Metadata::store to throw
   Koha::Exceptions::Metadata::Invalid, or use a MARC::File::XML
   error you can reproduce) - confirm a clear error message is shown
   and the form is redisplayed with your data intact, rather than a
   raw exception or a 500 error.
8. prove t/db_dependent/api/v1/biblios_metadata_errors.t


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35104
[Bug 35104] We should warn when attempting to save MARC records that contain
characters invalid in XML
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to