From: miker Date: Thu, 10 Jun 2010 19:15:55 +0000 (+0000) Subject: Patch from James Fournie of SITKA: X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=666424bc1418fbd769a1593e0e08899d76736b41;p=working%2FEvergreen.git Patch from James Fournie of SITKA: There was some discussion about problems with holds fulfillment at the holds roundtable at EG2010. I am pleased to share this patch with the community which has been thoroughly tested by the folks at Thompson-Nicola Regional District Library. (thanks guys!) Background: Evergreen's default out-of-the-box behaviour for holds fulfillment is a gas-saving method. Holds are fulfilled by proximity. In a multibranch library, holds are fulfilled at the local branch first. Many libraries, particularly single branch libraries may be ok with this, but it may be problematic for other libraries. Imagine a scenario where you have a large central branch and a small rural branch of the same library system. At the large branch, there are many copies of Popular New DVD with lots of holds. There are no copies at the rural branch. Patrons at the small rural branch who want to pick up Popular New DVD at their home branch may never get their hold fulfilled because the copies will stay at the large branch as long as there are holds for pickup there. This patch adds an org unit setting that changes the opportunistic check-in so that items checked in will be assigned to holds by request date first, rather than proximity. This setting can be applied to any level of the org tree, so in some situations you may even want to activate FIFO for large libraries, but leave the original setting for smaller libraries with less traffic who want to keep their copies more local. Also credit to Jeff Godin who thought of the same patch and contributed the setting name "holds FIFO" for the setting [ NOTE: Implications of mixed FIFO and non-FIFO environments that are not sufficiently segregated by the use of Hard Boundaries for Holds present a potenial for user confusion. Beware that mixing FIFO and non-FIFO settings within a resource-sharing group will likely result in severe imbalance of hold fulfillment, though further configuration, development, tuning and testing may be able to mitigate these issues. --miker ] git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@16660 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 60c2a8b014..99a274e5eb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -1574,10 +1574,12 @@ sub find_nearest_permitted_hold { $logger->info("circulator: searching for best hold at org ".$user->ws_ou. " and copy $bc with a hold stalling interval of ". ($hold_stall_interval || "(none)")); + my $fifo = $U->ou_ancestor_setting_value($user->ws_ou, 'circ.hold_fifo'); + # search for what should be the best holds for this copy to fulfill my $best_holds = $U->storagereq( "open-ils.storage.action.hold_request.nearest_hold.atomic", - $user->ws_ou, $copy->id, 10, $hold_stall_interval ); + $user->ws_ou, $copy->id, 10, $hold_stall_interval, $fifo ); unless(@$best_holds) { diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 4e1e06a575..5b633eb372 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -283,6 +283,9 @@ sub nearest_hold { my $cp = shift; my $limit = int(shift()) || 10; my $age = shift() || '0 seconds'; + my $fifo = shift(); + + my $holdsort = $fifo ? "h.request_time, h.selection_depth DESC, p.prox " : "p.prox, h.selection_depth DESC, h.request_time "; my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $here, $cp, $age); SELECT h.id @@ -295,10 +298,7 @@ sub nearest_hold { AND h.cancel_time IS NULL AND (h.expire_time IS NULL OR h.expire_time > NOW()) AND h.frozen IS FALSE - ORDER BY - p.prox, - h.selection_depth DESC, - h.request_time + ORDER BY $holdsort LIMIT $limit SQL diff --git a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml index 46fd0e4b12..96d5a8dc4f 100644 --- a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml @@ -225,6 +225,11 @@ desc : '&staff.server.admin.org_settings.opac.allow_pending_address.desc;', type : 'bool' }, + 'circ.holds_fifo' : { + label : 'Holds: FIFO', + desc : 'Force holds to a more strict First-In, First-Out capture', + type : 'bool' + }, /* 'ui.circ.show_billing_tab_on_bills' : { label : '&staff.server.admin.org_settings.ui.circ.show_billing_tab_on_bills;',