From 35cfa74e2f82e6297ba69751d9ce97bcd5ed53d0 Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 6 Jul 2010 15:12:04 +0000 Subject: [PATCH] Selfcheck: Show friendly error messages based on circ event fail_part field Messages lifted from opac.dtd git-svn-id: svn://svn.open-ils.org/ILS/trunk@16848 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/circ/nls/selfcheck.js | 19 ++++++++++++++- .../js/ui/default/circ/selfcheck/selfcheck.js | 23 ++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js index 63f67cbf6b..5691731c5d 100644 --- a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js +++ b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js @@ -19,6 +19,23 @@ "WORKSTATION_EXISTS" : "This workstation has already been registered. Would you like to use it for this self-check station?", "CC_PAYABLE_BALANCE" : "Total amount to pay: $${0}", "TOTAL_FINES_SELECTED" : "Selected total: $${0}", - "WELCOME_BANNER" : "Welcome, ${0}" + "WELCOME_BANNER" : "Welcome, ${0}", + "FAIL_PART_actor_usr_barred": "The patron is barred", + "FAIL_PART_asset_copy_circulate": "The item does not circulate", + "FAIL_PART_asset_copy_location_circulate": "Items from this shelving location do not circulate", + "FAIL_PART_asset_copy_status": "The item cannot circulate at this time", + "FAIL_PART_circ_holds_target_skip_me": "The item's circulation library does not fulfill holds", + "FAIL_PART_config_circ_matrix_circ_mod_test": "The patron has too many items of this type checked out", + "FAIL_PART_config_circ_matrix_test_available_copy_hold_ratio": "The available item-to-hold ratio is too low", + "FAIL_PART_config_circ_matrix_test_circulate": "Circulation rules reject this item as non-circulatable", + "FAIL_PART_config_circ_matrix_test_total_copy_hold_ratio": "The total item-to-hold ratio is too low", + "FAIL_PART_config_hold_matrix_test_holdable": "Hold rules reject this item as unholdable", + "FAIL_PART_config_hold_matrix_test_max_holds": "The patron has reached the maximum number of holds", + "FAIL_PART_config_rule_age_hold_protect_prox": "The item is too new to transit this far", + "FAIL_PART_no_item": "The system could not find this item", + "FAIL_PART_no_ultimate_items": "The system could not find any items to match this hold request", + "FAIL_PART_no_matchpoint": "System rules do not define how to handle this item", + "FAIL_PART_no_user": "The system could not find this patron", + "FAIL_PART_transit_range": "The item cannot transit this far" } diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 0925904405..2dc7c1598a 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -884,6 +884,15 @@ SelfCheckManager.prototype.checkout = function(barcode, override) { } } +SelfCheckManager.prototype.failPartMessage = function(result) { + if (result.payload && result.payload.fail_part) { + var stringKey = "FAIL_PART_" + + result.payload.fail_part.replace(/\./g, "_"); + return localeStrings[stringKey]; + } else { + return null; + } +} SelfCheckManager.prototype.handleXactResult = function(action, item, result) { @@ -1039,12 +1048,14 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) { default: console.error('Unhandled event ' + result.textcode); - if(action == 'checkout' || action == 'renew') { - displayText = dojo.string.substitute( - localeStrings.GENERIC_CIRC_FAILURE, [item]); - } else { - displayText = dojo.string.substitute( - localeStrings.UNKNOWN_ERROR, [result.textcode]); + if (!(displayText = this.failPartMessage(result))) { + if (action == 'checkout' || action == 'renew') { + displayText = dojo.string.substitute( + localeStrings.GENERIC_CIRC_FAILURE, [item]); + } else { + displayText = dojo.string.substitute( + localeStrings.UNKNOWN_ERROR, [result.textcode]); + } } } } -- 2.43.2