Bugzilla – Attachment 165803 Details for
Bug 32565
Holds placed when all libraries are closed do not get added to holds queue if HoldsQueueSkipClosed and RealTimeHoldsQueue are enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32565: (follow-up) Tidy
Bug-32565-follow-up-Tidy.patch (text/plain), 6.32 KB, created by
Tomás Cohen Arazi
on 2024-04-29 18:46:04 UTC
(
hide
)
Description:
Bug 32565: (follow-up) Tidy
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2024-04-29 18:46:04 UTC
Size:
6.32 KB
patch
obsolete
>From 677cf7dc8f5293cc195714907d32d701fe2ce783 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 19 Apr 2024 11:25:58 +0000 >Subject: [PATCH] Bug 32565: (follow-up) Tidy > >--- > C4/HoldsQueue.pm | 31 ++++++++++++------------ > misc/cronjobs/holds/build_holds_queue.pl | 14 +++++------ > t/db_dependent/HoldsQueue.t | 4 +-- > 3 files changed, 25 insertions(+), 24 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index c7754210543..56e07cbbca1 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -168,12 +168,12 @@ Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets > =cut > > sub CreateQueue { >- my $params = shift; >+ my $params = shift; > my $unallocated = $params->{unallocated}; >- my $dbh = C4::Context->dbh; >+ my $dbh = C4::Context->dbh; > >- unless( $unallocated ){ >- $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info >+ unless ($unallocated) { >+ $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info > $dbh->do("DELETE FROM hold_fill_targets"); > } > >@@ -202,7 +202,8 @@ sub CreateQueue { > $total_bibs++; > > my $result = update_queue_for_biblio( >- { biblio_id => $biblionumber, >+ { >+ biblio_id => $biblionumber, > branches_to_use => $branches_to_use, > transport_cost_matrix => $transport_cost_matrix, > unallocated => $unallocated >@@ -245,7 +246,7 @@ sub GetBibsWithPendingHoldRequests { > > =head2 GetPendingHoldRequestsForBib > >- my $requests = GetPendingHoldRequestsForBib({ biblionumber => $biblionumber, unallocated => $unallocated }); >+ my $requests = GetPendingHoldRequestsForBib( { biblionumber => $biblionumber, unallocated => $unallocated } ); > > Returns an arrayref of hashrefs to pending, unfilled hold requests > on the bib identified by $biblionumber. Optionally returns only unallocated holds. The following keys >@@ -265,9 +266,9 @@ The arrayref is sorted in order of increasing priority. > =cut > > sub GetPendingHoldRequestsForBib { >- my $params = shift; >+ my $params = shift; > my $biblionumber = $params->{biblionumber}; >- my $unallocated = $params->{unallocated}; >+ my $unallocated = $params->{unallocated}; > > my $dbh = C4::Context->dbh; > >@@ -280,8 +281,8 @@ sub GetPendingHoldRequestsForBib { > AND priority > 0 > AND reservedate <= CURRENT_DATE() > AND suspend = 0 "; >- $request_query .= "AND reserve_id NOT IN (SELECT reserve_id FROM hold_fill_targets) " if $unallocated; >- $request_query .= "ORDER BY priority"; >+ $request_query .= "AND reserve_id NOT IN (SELECT reserve_id FROM hold_fill_targets) " if $unallocated; >+ $request_query .= "ORDER BY priority"; > my $sth = $dbh->prepare($request_query); > $sth->execute($biblionumber); > >@@ -315,17 +316,17 @@ sub GetItemsAvailableToFillHoldRequestsForBib { > my $items_query = "SELECT items.itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype > FROM items "; > >- if (C4::Context->preference('item-level_itypes')) { >- $items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; >+ if ( C4::Context->preference('item-level_itypes') ) { >+ $items_query .= "LEFT JOIN itemtypes ON (itemtypes.itemtype = items.itype) "; > } else { >- $items_query .= "JOIN biblioitems USING (biblioitemnumber) >+ $items_query .= "JOIN biblioitems USING (biblioitemnumber) > LEFT JOIN itemtypes USING (itemtype) "; > } >- $items_query .= " LEFT JOIN branchtransfers ON ( >+ $items_query .= " LEFT JOIN branchtransfers ON ( > items.itemnumber = branchtransfers.itemnumber > AND branchtransfers.datearrived IS NULL AND branchtransfers.datecancelled IS NULL > )"; >- $items_query .= " WHERE items.notforloan = 0 >+ $items_query .= " WHERE items.notforloan = 0 > AND holdingbranch IS NOT NULL > AND itemlost = 0 > AND withdrawn = 0"; >diff --git a/misc/cronjobs/holds/build_holds_queue.pl b/misc/cronjobs/holds/build_holds_queue.pl >index 06b02041e5b..600d0091bde 100755 >--- a/misc/cronjobs/holds/build_holds_queue.pl >+++ b/misc/cronjobs/holds/build_holds_queue.pl >@@ -59,17 +59,17 @@ This script builds or rebuilds the entire holds queue. > > =cut > >-my $help = 0; >-my $man = 0; >-my $force = 0; >+my $help = 0; >+my $man = 0; >+my $force = 0; > my $unallocated = 0; > > my $command_line_options = join( " ", @ARGV ); > > GetOptions( >- 'h|help' => \$help, >- 'm|man' => \$man, >- 'f|force' => \$force, >+ 'h|help' => \$help, >+ 'm|man' => \$man, >+ 'f|force' => \$force, > 'u|unallocated' => \$unallocated > ); > pod2usage(1) if $help; >@@ -85,6 +85,6 @@ if ( $rthq && !$force ) { > > cronlogaction( { info => $command_line_options } ); > >-CreateQueue({ unallocated => $unallocated }); >+CreateQueue( { unallocated => $unallocated } ); > > cronlogaction( { action => 'End', info => "COMPLETED" } ); >diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t >index 987aba21ee3..11bcad4156c 100755 >--- a/t/db_dependent/HoldsQueue.t >+++ b/t/db_dependent/HoldsQueue.t >@@ -2254,14 +2254,14 @@ subtest "Test unallocated option" => sub { > > my $original_timestamp = $hold->timestamp; > >- sleep 2; # Allow time to pass after first hold was placed >+ sleep 2; # Allow time to pass after first hold was placed > C4::HoldsQueue::CreateQueue(); > $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); > $hold = $queue_rs->next; > isnt( $hold->timestamp, $original_timestamp, "Hold was reallocated when queue fully rebuilt" ); > my $after_rebuild_timestamp = $hold->timestamp; > >- sleep 2; # Allow time to pass after first full rebuild >+ sleep 2; # Allow time to pass after first full rebuild > C4::HoldsQueue::CreateQueue( { unallocated => 1 } ); > $queue_rs = $schema->resultset('TmpHoldsqueue')->search( { biblionumber => $item1->biblionumber } ); > $hold = $queue_rs->next; >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32565
:
147659
|
161231
|
161232
|
161393
|
161394
|
161679
|
161680
|
162269
|
162297
|
164272
|
164273
|
164274
|
165166
|
165167
|
165168
|
165169
|
165800
|
165801
|
165802
| 165803