From 1cb5f0b3199f8cde20754299d442fcbf9b9ba01f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 19 Mar 2013 01:49:01 -0700 Subject: [PATCH] Bug 8562 - RandomizeHoldsQueueWeight ignored if StaticHoldsQueueWeight is empty. If StaticHoldsQueueWeight is empty, but RandomizeHoldsQueueWeight is enabled, the script build_holds_queue.pl should select branches for fulfillment requests at random. Instead, it will select them in alphabetical order. Test Plan: 1) Apply patch 2) Set the system preference StaticHoldsQueueWeight to empty 3) Create a hold on an record with items at multiple libraries 4) Run build_holds_queue.pl 5) Look at the holds queue report from the circulation home page 6) Run build_holds_queue.pl again 7) Look at the holds queue report again, note the library chosen for fulfillment of the hold has likely changed. 8) Repeat steps 6-7 until you are satisfied the library to fulfill the hold is chosen at random. --- C4/HoldsQueue.pm | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 7d38963..dcfcc4c 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -570,13 +570,14 @@ sub _trim { } sub load_branches_to_pull_from { - my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight") - or return; + my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight"); my @branches_to_use = map _trim($_), split /,/, $static_branch_list; @branches_to_use = shuffle(@branches_to_use) if C4::Context->preference("RandomizeHoldsQueueWeight"); + @branches_to_use = shuffle keys %{GetBranches()}; + return \@branches_to_use; } -- 1.7.2.5