From 00d8cda7bd43542d3a9a81bc0dd11131f243e22f Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 15 Jan 2025 13:08:19 +0000 Subject: [PATCH] Bug 38895: In advanced editor, the fixed data helpers put '#' instead of space in record content When editing a bibliographic record in advanced editor, there are helpers for fixed data coded fields (like 008). Like in the standard editor, empty value (space) is represented by a hash sign. But unlike in the standard editor, the hash sign is not converted into a space but remains as '#' in the saved record. This is obviously wrong. Test plan: ========== 1. Ensure to have EnableAdvancedCatalogingEditor set to 'enable'. 2. Create of edit a record, choosing for one of one-letter codes an empty value (represented by '#' in the helper). 3. Save the record, control in 'MARC preview' that you got a hash sign in the 008 field instead of a space. 4. Apply the patch ; restart all. 5. Open a record in advanced editor, refresh the page to reload the java script (Shift+Ctrl+R or another appropriate shortcut). Edit the 008 field again choosing for one of one-letter codes an empty value. 6. Save the record, control in 'MARC preview' that there is a space and not the hash sign. Sponsored-by: Ignatianum University in Cracow --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js index 70981c183a..d545df26db 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/widget.js @@ -69,7 +69,9 @@ define( [ 'resources' ], function( Resources ) { function show() { $collapsed.hide(); - $node.val( widget.getFixed( start, end ).replace(/\s+$/, '') ); + if ( end - start > 1 ) { + $node.val( widget.getFixed( start, end ).replace(/\s+$/, '') ); + } $node.show(); $node[0].focus(); } @@ -161,7 +163,7 @@ define( [ 'resources' ], function( Resources ) { $input = $( '' ); $values.each( function() { - $input.append( '' ); + $input.append( '' ); } ); } -- 2.39.5