Koha-clms/koha-tmpl/intranet-tmpl/lib
Martin Renvoize 995bfe2083
Bug 40633: Open fixed-length field helpers from the advanced editor
The advanced cataloging editor lets users hand-edit MARC records as
text but offers no equivalent of the basic editor's value_builder
popups for the fixed-length fields (Leader, 006, 007 and 008).
Catalogers have to type those byte strings by hand, which is error
prone.

This patch wires the 'open_helper_plugin' shortcut (added in the
preceding atomic update) to a new handler in the advanced editor
which:

 - inspects the line under the cursor;
 - if it is a Leader, 006, 007 or 008 control field, opens the
   corresponding marc21_*.pl plugin from cataloguing/value_builder/
   in a popup window, pre-populated with the current value;
 - splices the plugin's returned value back into the CodeMirror buffer
   when the popup closes.

The plugin templates are reused unchanged: a hidden
<input id="adv_editor_fixedfield_buffer"> on the editor page satisfies
the existing report() callback contract, and the editor polls
window.closed to detect submission. The 008 plugin is given the
current Leader value via &leader= so its material-type byte map
matches the record being edited.

The shortcut description is added to keyboard_shortcuts.inc so it
appears with a meaningful label in the in-editor "show shortcuts"
popover and in Administration > Keyboard shortcuts.

Test plan:
1. Apply this patch on top of the preceding atomic update.
2. Visit Administration > Keyboard shortcuts and confirm
   'open_helper_plugin' is listed with description "Open fixed-length
   field helper (Leader, 006, 007, 008)" and that the key combination
   can be edited.
3. Open the advanced cataloging editor on any record:
   a. Place the cursor on the 000 (Leader) line and press Shift-Ctrl-H.
      The marc21_leader popup should open with the current Leader
      value. Make a change, click OK, and confirm the Leader line
      updates in the editor and is marked modified in the gutter.
   b. Repeat for 006, 007 and 008. For 008, change the Leader's
      material-type byte first and confirm the 008 popup form adapts.
   c. Place the cursor on a 245 (or any non-fixed-length field) line
      and press Shift-Ctrl-H. Nothing should happen.
   d. Open a popup, then close it without saving. The editor line
      should remain unchanged.
4. Save the record and confirm the new fixed-field values round-trip
   correctly when the record is reloaded.
5. Confirm the basic editor's value_builder popups still work
   unchanged on Leader / 006 / 007 / 008.

Sponsored-by: Main Library Alliance <https://www.mainlib.org/>
Signed-off-by: Jeanne Mauriello <jeanne.mauriello@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-23 16:04:00 -06:00
..
Chocolat Bug 35633: (follow-up) Custom style updates 2024-03-22 10:35:26 +01:00
bootstrap Bug 35402: Update the OPAC and staff interface to Bootstrap 5 2024-08-23 15:58:41 +02:00
codemirror
…
d3c3
…
datatables Bug 42003: Remove !important from css files 2026-04-23 09:24:55 -06:00
dayjs Bug 34440: Add isSameOrBefore dayjs plugin 2024-08-30 16:41:28 +02:00
filesaver Bug 35640: Upgrade FileSaver JS library to v2.0.4 2024-03-22 10:35:27 +01:00
flatpickr
…
fontawesome
…
jquery Bug 41964: Upgrade the Multiple Select plugin in the staff interface to 2.3.1 2026-04-23 09:25:00 -06:00
js-cookie
…
jsdiff Bug 40030: Escape values when displaying action logs comparison 2025-06-30 08:30:52 -06:00
keyboard
…
koha/cateditor Bug 40633: Open fixed-length field helpers from the advanced editor 2026-04-23 16:04:00 -06:00
leaflet Bug 36151: Update leaflet.js 2024-05-07 15:53:50 +02:00
linters
…
maskito Bug 33703: Add Masikto core/kit for date masking 2024-04-26 17:06:08 +02:00
select2
…
shortcut
…
sortable
…
tiny_mce
…
vis-timeline
…
require.js
…