Bugzilla – Attachment 32788 Details for
Bug 12632
Hold limits ignored for record level holds with item level itemtypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12632 - Hold limits ignored for record level holds with item level itemtypes
0001-Bug-12632-Hold-limits-ignored-for-record-level-holds.patch (text/plain), 2.88 KB, created by
Paola Rossi
on 2014-10-27 13:07:35 UTC
(
hide
)
Description:
Bug 12632 - Hold limits ignored for record level holds with item level itemtypes
Filename:
MIME Type:
Creator:
Paola Rossi
Created:
2014-10-27 13:07:35 UTC
Size:
2.88 KB
patch
obsolete
>From 259208d5172a5a939c6c96739bb2b839385eec88 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 22 Aug 2014 13:29:28 -0400 >Subject: [PATCH] Bug 12632 - Hold limits ignored for record level holds with > item level itemtypes > >The crux of the issue is that if you are using item level itemtypes, but >are allowing biblio levels holds, those holds do not have items. > >So, in CanItemBeReserved, when Koha counts the number of holds to >compare against the given rule, it will always give 0 ( except of course >for found holds, and the occasional item-level hold ). > >So the query is saying "link each of these reserves to the reserved >item, and count the number of reserves this patron where the itemtype is >DVD". However, since these are all record level reserves, there are no >items to link to, and so when it looks for all reserves this and item >whose itemtype is DVD, it finds zero reserves! > >This patch solves the problem by looking first at the item level >itemtype, and if it does not exist, then it looks at the record >level itemtype. For installations using record level itemtypes, the >behavior remains unchanged. > >Test plan: >1) Enable item level itemtypes >2) Create two records with one item each of a given itemtype >3) Create a single issuing rule and limit the holds allowed for that > itemtype to 1 >4) Place a record level hold on your first record >5) Attempt to place a record level hold for the same patron on your > second record. You should not be able to but you can! >6) Apply this patch >7) Repeat step 5, note you can no longer place the hold! > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> >--- > C4/Reserves.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 7a075a4..7e00877 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -493,7 +493,6 @@ sub CanItemBeReserved{ > my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); > > my $controlbranch = C4::Context->preference('ReservesControlBranch'); >- my $itemtypefield = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype"; > > # we retrieve user rights on this itemtype and branchcode > my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed >@@ -541,7 +540,14 @@ sub CanItemBeReserved{ > > $querycount .= "AND $branchfield = ?"; > >- $querycount .= " AND $itemtypefield = ?" if ($ruleitemtype ne "*"); >+ # If using item-level itypes, fall back to the record >+ # level itemtype if the hold has no associated item >+ $querycount .= >+ C4::Context->preference('item-level_itypes') >+ ? " AND COALESCE( itype, itemtype ) = ?" >+ : " AND itemtype = ?" >+ if ( $ruleitemtype ne "*" ); >+ > my $sthcount = $dbh->prepare($querycount); > > if($ruleitemtype eq "*"){ >-- >1.7.10.4 >
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 12632
:
31106
|
31107
|
32788
|
35255
|
35256
|
35257
|
41798
|
41799
|
41858
|
41934
|
41935
|
41950