From 3b21ec5773fc571da2011a5b3a34983679242f2f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 3 Oct 2022 17:23:33 +0100 Subject: [PATCH] Bug 30979: Handle more failure cases --- .../opac-tmpl/bootstrap/js/modals/checkout.js | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js b/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js index 522f60b9ad..d5b8fcb605 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js @@ -1,33 +1,38 @@ $(document).ready(function() { - function resetResults(){ + function resetResults() { $('#checkoutResults').replaceWith('
'); $('#availabilityResult').replaceWith('
'); }; - function addResult(type, code, data){ + function addResult(type, code, data) { let result = ''; - if ( type == 'danger' ) { + if (type == 'danger') { result += '
'; - } else if ( type == 'warning' ) { + } else if (type == 'warning') { result += '
'; - } else if ( type == 'info' ) { + } else if (type == 'info') { result += '
'; } else { result += '
'; } - if ( code == 'NOT_FOUND' ) { + if (code == 'NOT_FOUND') { result += _("Item '%s' not found").format(data); - } - else if ( code == 'RENEW_ISSUE' ) { + } else if (code == 'RENEW_ISSUE') { result += _("Item will be renewed").format(data); - } - else if ( code == 'OTHER_CHARGES' ) { - result += _("Your account current has outstanding charges of '%s'").format(data); - } - else { - result += _("Message code '%s' with data '%s'").format(code,data); + } else if (code == 'OTHER_CHARGES') { + result += _("Your account currently has outstanding charges of '%s'").format(data); + } else if (code == 'ISSUED_TO_ANOTHER') { + result += _("This item appears to be checked out to another patron, please return it to the desk"); + } else if (code == 'RESERVED') { + result += _("This item appears to be reserved for another patron, please return it to the desk"); + } else if (code == 'NOT_FOR_LOAN') { + result += _("This item is not normally for loan, please select another or ask at the desk"); + } else if (code == 'WTHDRAWN') { + result += _("This item is marked withdrawn, please select another or ask at the desk"); + } else { + result += _("Message code '%s' with data '%s'").format(code, data); } result += '
'; -- 2.20.1