From dcaa9c605f9af5ba183f21754cdc2d44a2fd213e Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 25 Aug 2011 15:21:01 +1200 Subject: [PATCH] Bug 5866 : Updated patch to speed up holds awaiting pickup --- circ/waitingreserves.pl | 3 +-- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 9850114..c2f868d 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -111,10 +111,9 @@ foreach my $num (@getreserves) { my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} ); # fix up item type for display $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'}; - my $getborrower = GetMemberDetails( $num->{'borrowernumber'} ); + my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype $getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} ); - my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); ( $waiting_year, $waiting_month, $waiting_day ) = Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8b84019..13fa53d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1555,6 +1555,7 @@ CREATE TABLE `reserves` ( `waitingdate` date default NULL, `expirationdate` DATE DEFAULT NULL, `lowestPriority` tinyint(1) NOT NULL, + KEY priorityfoundidx (priority,found), KEY `borrowernumber` (`borrowernumber`), KEY `biblionumber` (`biblionumber`), KEY `itemnumber` (`itemnumber`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 030897c..1085db9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4432,6 +4432,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.05.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("CREATE INDEX priorityfoundidx ON reserves (priority,found)"); + print "Create an index on reserves to speed up holds awaiting pickup report bug 5866\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 1.7.4.1