Return the copy status name when a copy is not available
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 1 Dec 2010 19:11:41 +0000 (19:11 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 1 Dec 2010 19:11:41 +0000 (19:11 +0000)
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

index 5b8f7b2..385e12b 100644 (file)
@@ -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 */ :