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

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211490
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211490&action=edit
Bug 43642: Show metadata repair warnings in the advanced cataloguing editor

The advanced (MARC21) cataloguing editor only showed a generic "Record had
encoding issues" alert when svc/bib reported a repaired record, and never
listed the faults themselves. Cataloguers had no way to see what had been
changed or to resolve the recorded faults, unlike the basic editor.

This patch shows the same "Data quality warnings" banner as the basic
editor when a record is opened in the advanced editor:

- A new GET /api/v1/biblios/{biblio_id}/metadata/errors lists the
  unresolved metadata errors recorded for the biblio. The repairs made on
  read are stored as error rows, so this covers both faults repaired just
  now and faults recorded earlier.
- The banner lists each fault with its field, problem and location, and a
  "Mark resolved" button that calls the existing
  DELETE /api/v1/biblios/{biblio_id}/metadata/errors/{error_id}. The
  banner hides once the last fault is resolved.
- The generic alert is kept only as a fallback when svc/bib reported
  repairs but no error rows could be listed, and for the duplicate
  backend, which does not show the banner.

The banner does not link to the affected field, unlike the basic editor.

To test:
1. Apply the patch and restart services (yarn build && restart_all, as
   the swagger file changed).
2. Create a biblio and insert a metadata error for it:
   INSERT INTO biblio_metadata_errors (metadata_id, error_type, tag, subfield,
message)
   SELECT id, 'nonxml_stripped', '245', 'a', '245$a: invalid char value 31
(U+001F) at position 5'
   FROM biblio_metadata WHERE biblionumber = <biblionumber>;
3. Open the record in the advanced editor
(cataloguing/editor.pl#catalog/<biblionumber>).
   Confirm the "Data quality warnings" banner lists the error.
4. Click "Mark resolved". Confirm the row goes, and the banner hides when
   the last one is gone. Check the row is removed from biblio_metadata_errors.
5. Store a record with a control character (chr(31)) in a subfield directly
   in biblio_metadata.metadata, then open it in the advanced editor. Confirm
   the banner lists the repaired fault.
6. GET /api/v1/biblios/<biblionumber>/metadata/errors returns the list, and
   a non-existent biblio returns 404.
7. Run: prove t/db_dependent/api/v1/biblios_metadata_errors.t
8. Run: npx cypress run --spec
t/cypress/integration/AdvancedEditorMetadataErrors_spec.ts

Sponsored-by: OpenFifth
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
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]
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