From b10d07912e1e61d8c1c30665a0f83977694a2b7d Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 27 Aug 2024 03:50:44 +0000 Subject: [PATCH] Bug 37742: Fix error display This change fixes the display of the error message on "My virtual card" on the OPAC. Test plan: 0. Apply the patch and enable syspref "OPACVirtualCard" 1. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl ?op=edit_form&destination=circ&borrowernumber=51 2. Add an asterisk (*) to the end of the card number 3. Go to http://localhost:8080/cgi-bin/koha/opac-virtual-card.pl 4. Note that the error message appears as follows: Code 39 must contain only digits, capital letters, spaces and the symbols -.$/+% --- koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js index 97628ba7fa..0ff0f6c49b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/barcode-generator.js @@ -22,6 +22,14 @@ document.addEventListener("DOMContentLoaded", function() { const errorMessage = match ? match[1] : error.message; console.error(error); - document.getElementById('barcode-container').innerHTML = "

" + __("Error:") + " ${errorMessage}

"; + if (errorMessage){ + const para = document.createElement('p'); + const strong = document.createElement('strong'); + strong.textContent = __("Error: "); + let err_msg = document.createTextNode(errorMessage); + para.appendChild(strong); + para.appendChild(err_msg); + document.getElementById('barcode-container').replaceChildren(para); + } } }); -- 2.39.2