From 6d10cba03ab97b84f8f6ac0409481ad4fc9a6365 Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 1 Dec 2010 19:11:41 +0000 Subject: [PATCH] Return the copy status name when a copy is not available It looks like the checkout operation used to return a fleshed config.copy_status object, but that changed and we now get a raw ccs ID back. Retrieve the status name using the ccs ID and present that to the users. Also, in case problems like this happen in the future, provide a more specific error message and var name so that it will be (hopefully!) a little clearer what payload was expected in the first place :) Resolves https://bugs.launchpad.net/evergreen/+bug/680575 Thanks to Jason Etheridge for a major assist with this bug. git-svn-id: svn://svn.open-ils.org/ILS/trunk@18897 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/circ/checkout.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index 5b8f7b20a5..385e12b832 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -641,9 +641,10 @@ circ.checkout.prototype = { }, '7004' : function(r) { try { - return r.payload.status().name(); + status_name = obj.data.hash.ccs[ r.payload.status() ].name(); + return status_name; } catch (E) { - return "copy not available: (Unexpected error: payload not available)"; // XXX + return "Could not retrieve the name of the current status for the copy"; // XXX } }, '7010' : function(r) { @@ -800,7 +801,7 @@ circ.checkout.prototype = { found_handled = true; break; case 7004 /* COPY_NOT_AVAILABLE */ : - msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.copy_status', [test_permit[i].payload.status().name()]) + '\n'; + msg += test_permit[i].desc + '\n' + document.getElementById('circStrings').getFormattedString('staff.circ.checkout.copy_status', [obj.data.hash.ccs [test_permit[i].payload.status() ].name()]) + '\n'; found_handled = true; break; case 7006 /* COPY_IS_REFERENCE */ : -- 2.11.0