From 06a35b3ab6da447f03b790629a670e60daa3d8a2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 6 Mar 2015 11:04:01 -0500 Subject: [PATCH] LP#1234220 Improve hold/copy ratio renewal messages Display friendlier messages in the TPAC and staff client client when a hold/copy ratio rule prevents a renewal. This creates top-level ILS events for total/avail hold copy ratios, since that's what best works with the staff client. The TPAC displays a simple "item is needed for a hold" message, whereas the staff client displays the raw event description, which is slightly more descriptive. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- Open-ILS/src/extras/ils_events.xml | 7 +++++++ .../lib/OpenILS/Application/Circ/Circulate.pm | 4 ++++ Open-ILS/src/templates/opac/myopac/circs.tt2 | 14 +++++++++++++- .../templates/opac/parts/hold_error_messages.tt2 | 2 -- Open-ILS/xul/staff_client/server/circ/util.js | 4 ++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml index 63385f3f82..cb860d4535 100644 --- a/Open-ILS/src/extras/ils_events.xml +++ b/Open-ILS/src/extras/ils_events.xml @@ -1037,6 +1037,13 @@ for the selected transaction + + Renewal attempt failed because the "hold / total copies" ratio exceeds the configured limit + + + + Renewal attempt failed because the "hold / available copies" ratio exceeds the configured limit + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 0aaa2c7978..7a330b2c95 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -1076,6 +1076,10 @@ my $LEGACY_CIRC_EVENT_MAP = { 'config.circ_matrix_test.max_overdue' => 'PATRON_EXCEEDS_OVERDUE_COUNT', 'config.circ_matrix_test.max_fines' => 'PATRON_EXCEEDS_FINES', 'config.circ_matrix_circ_mod_test' => 'PATRON_EXCEEDS_CHECKOUT_COUNT', + 'config.circ_matrix_test.total_copy_hold_ratio' => + 'TOTAL_HOLD_COPY_RATIO_EXCEEDED', + 'config.circ_matrix_test.available_copy_hold_ratio' => + 'AVAIL_HOLD_COPY_RATIO_EXCEEDED' }; diff --git a/Open-ILS/src/templates/opac/myopac/circs.tt2 b/Open-ILS/src/templates/opac/myopac/circs.tt2 index 4cd89ab6b8..6ca68a1fa0 100644 --- a/Open-ILS/src/templates/opac/myopac/circs.tt2 +++ b/Open-ILS/src/templates/opac/myopac/circs.tt2 @@ -121,7 +121,19 @@ [%# XXX colspan="0" does not work in IE %] - [% (circ.renewal_response.desc || circ.renewal_response.payload.fail_part || circ.renewal_response.textcode) | html %] + [% + renew_fail_msg = ''; + IF circ.renewal_response.textcode == 'TOTAL_HOLD_COPY_RATIO_EXCEEDED' OR + circ.renewal_response.textcode == 'AVAIL_HOLD_COPY_RATIO_EXCEEDED'; + # the stock hold ratio message may not be patron friendly + renew_fail_msg = l('Item is needed for a hold'); + ELSE; + renew_fail_msg = circ.renewal_response.desc || + circ.renewal_response.payload.fail_part || + circ.renewal_response.textcode; + END; + renew_fail_msg | html; + %] diff --git a/Open-ILS/src/templates/opac/parts/hold_error_messages.tt2 b/Open-ILS/src/templates/opac/parts/hold_error_messages.tt2 index 50a0ebff94..407ea52daf 100644 --- a/Open-ILS/src/templates/opac/parts/hold_error_messages.tt2 +++ b/Open-ILS/src/templates/opac/parts/hold_error_messages.tt2 @@ -14,9 +14,7 @@ "asset.copy.status" => l("The item cannot circulate at this time"), "circ.holds.target_skip_me" => l("The item's circulation library does not fulfill holds"), "config.circ_matrix_circ_mod_test" => l("The patron has too many items of this type checked out"), - "config.circ_matrix_test.available_copy_hold_ratio" => l("The available item-to-hold ratio is too low"), "config.circ_matrix_test.circulate" => l("Circulation rules reject this item as non-circulatable"), - "config.circ_matrix_test.total_copy_hold_ratio" => l("The total item-to-hold ratio is too low"), "config.hold_matrix_test.holdable" => l("Hold rules reject this item as unholdable"), "config.hold_matrix_test.max_holds" => l("The patron has reached the maximum number of holds"), "config.rule_age_hold_protect.prox" => l("The item is too new to transit this far"), diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 1331e192c2..aa497d4f81 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -3694,6 +3694,8 @@ circ.util.renew_via_barcode = function ( params, async ) { case 7009 /* CIRC_CLAIMS_RETURNED */ : break; case 7010 /* COPY_ALERT_MESSAGE */ : break; case 7013 /* PATRON_EXCEEDS_FINES */ : break; + case 11106 /* TOTAL_HOLD_COPY_RATIO_EXCEEDED */ : break; + case 11107 /* AVAIL_HOLD_COPY_RATIO_EXCEEDED */ : break; default: throw(renew); break; @@ -3773,6 +3775,8 @@ circ.util.renew_via_barcode = function ( params, async ) { 7009 /* CIRC_CLAIMS_RETURNED */, 7010 /* COPY_ALERT_MESSAGE */, 7013 /* PATRON_EXCEEDS_FINES */, + 11106 /* TOTAL_HOLD_COPY_RATIO_EXCEEDED */, + 11107 /* AVAIL_HOLD_COPY_RATIO_EXCEEDED */ ], 'text' : { '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, -- 2.43.2