---
 C4/HoldsQueue.pm |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm
index fcb3c14..05095d8 100755
--- a/C4/HoldsQueue.pm
+++ b/C4/HoldsQueue.pm
@@ -564,11 +564,18 @@ sub debug {
 #   warn @_;
 }
 
+sub _trim {
+    return $_[0] unless $_[0];
+    $_[0] =~ s/^\s+//;
+    $_[0] =~ s/\s+$//;
+    $_[0];
+}
+
 sub load_branches_to_pull_from {
     my $static_branch_list = C4::Context->preference("StaticHoldsQueueWeight")
       or return;
 
-    my @branches_to_use = map { s/^\s+//; s/\s+$//; $_; } split /,/, 
$static_branch_list;
+    my @branches_to_use = map _trim($_), split /,/, $static_branch_list;
 
     @branches_to_use = shuffle(@branches_to_use) if  
C4::Context->preference("RandomizeHoldsQueueWeight");
 
@@ -590,6 +597,7 @@ sub least_cost_branch {
         next if $cell->{disable_transfer};
 
         my $cost = $cell->{cost};
+        next unless defined $cost; # XXX should this be reported?
 
         unless (defined $least_cost) {
             $least_cost = $cost;
-- 
1.7.9.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to