From 08824f927bd952501140ea1a81b2367c7a777c3a Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 14 Aug 2017 14:08:39 -0700 Subject: [PATCH] LP#1673870: ebook checkout fails on error message, not on empty due date Previously, a successful ebook checkout would appear to fail if the checkout response from the vendor API did not include a due date. With this commit, the checkout failure message is displayed only if Evergreen returns an error message to the browser (i.e. the response object contains an "error_msg" attribute). Signed-off-by: Jeff Davis --- Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js b/Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js index 1eacdcd108..f003b66d32 100644 --- a/Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js +++ b/Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js @@ -257,7 +257,10 @@ function cleanupAfterAction() { // check out our active ebook function doCheckout() { active_ebook.checkout(authtoken, patron_id, function(resp) { - if (resp.due_date) { + if (resp.error_msg) { + console.log('Checkout failed: ' + resp.error_msg); + dojo.removeClass('ebook_checkout_failed', "hidden"); + } else { console.log('Checkout succeeded!'); dojo.destroy('checkout-button'); dojo.destroy('checkout-format'); // remove optional format selector @@ -283,9 +286,6 @@ function doCheckout() { } xacts.checkouts.unshift(new_xact); cleanupAfterAction(); - } else { - console.log('Checkout failed: ' + resp.error_msg); - dojo.removeClass('ebook_checkout_failed', "hidden"); } // When we switch to jQuery, we can use .one() instead of .on(), // obviating the need for an explicit disconnect here. -- 2.11.0