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 -.$/+% Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
94ce572755
commit
3237baeb0b
1 changed files with 10 additions and 5 deletions
|
@ -17,11 +17,16 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
}
|
||||
document.getElementById('barcode-container').innerHTML = svg
|
||||
} catch (error) {
|
||||
// Use regex to find error message
|
||||
const match = error.message.match(/: (.+)$/);
|
||||
const errorMessage = match ? match[1] : error.message;
|
||||
|
||||
console.error(error);
|
||||
document.getElementById('barcode-container').innerHTML = "<p><strong>" + __("Error:") + " </strong>${errorMessage}</p>";
|
||||
|
||||
const p_node = document.createElement('p');
|
||||
const strong_node = document.createElement('strong');
|
||||
strong_node.textContent = __("Error: ");
|
||||
const span_node = document.createElement('span');
|
||||
span_node.textContent = __("Unable to generate barcode");
|
||||
span_node.setAttribute('id','barcode-gen-error');
|
||||
p_node.appendChild(strong_node);
|
||||
p_node.appendChild(span_node);
|
||||
document.getElementById('barcode-container').replaceChildren(p_node);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue