Bugzilla – Attachment 19606 Details for
Bug 9532
reserve rules with itemtype on biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9532: reserve rules with itemtype on biblio
Bug-9532-reserve-rules-with-itemtype-on-biblio.patch (text/plain), 3.74 KB, created by
Kyle M Hall
on 2013-07-12 16:57:53 UTC
(
hide
)
Description:
Bug 9532: reserve rules with itemtype on biblio
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-07-12 16:57:53 UTC
Size:
3.74 KB
patch
obsolete
>From e6913b45a65e8f23c681081db2fd17725641d288 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Fri, 1 Feb 2013 17:52:11 +0100 >Subject: [PATCH] Bug 9532: reserve rules with itemtype on biblio > >When itemtype is defined on biblio (item-level_itypes syspref), the method C4::Reserves::CanItemBeReserved uses item->{itemtype}. But item comes from C4::Items::GetItem and it does not have a 'itemtype' key, in this method the item type value is always in 'itype' key. > >This patch corrects it. > >Test plan: >You must have itemtype on biblio and 'item-level_itypes' syspref on biblio. >This test plan is with ReservesControlBranch on ItemHomeLibrary. >- Choose a branch, a borrower category and an item type, for example 'NYC', 'CHILD' and 'DVD' >- Set an issuing rule for 'NYC', CHILD' and 'DVD' with 'Holds allowed' on 10 >- Set an issuing rule for 'NYC', CHILD' and all item types with 'Holds allowed' on 0 >- Choose an item of a biblio with itemtype 'DVD', that can be reserved, with 'NYC' as homebranch >- Choose a borrower with category 'CHILD' >- try to reverse the item for the borrower >=> without the patch, you can >=> with the patch, you can't >You may check reserve is allowed with 'Holds allowed' > 0 on issuing rule for 'DVD'. > >Signed-off-by: Liz Rea <liz@catalyst.net.nz> >Great test plan - thanks! > >Confirmed the bug, and the fix. Looks good to me. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Reserves.pm | 20 ++++++++++---------- > 1 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5ff12e4..a68bad8 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -419,12 +419,14 @@ sub CanItemBeReserved{ > my ($borrowernumber, $itemnumber) = @_; > > my $dbh = C4::Context->dbh; >+ my $ruleitemtype; # itemtype of the matching issuing rule > my $allowedreserves = 0; > > my $controlbranch = C4::Context->preference('ReservesControlBranch'); >- my $itype = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype"; >+ my $itemtypefield = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype"; > >- # we retrieve borrowers and items informations # >+ # we retrieve borrowers and items informations >+ # item->{itype} will come for biblioitems if necessery > my $item = GetItem($itemnumber); > my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); > >@@ -450,8 +452,6 @@ sub CanItemBeReserved{ > "; > > >- my $itemtype = $item->{$itype}; >- my $categorycode = $borrower->{categorycode}; > my $branchcode = ""; > my $branchfield = "reserves.branchcode"; > >@@ -464,25 +464,25 @@ sub CanItemBeReserved{ > } > > # we retrieve rights >- $sth->execute($categorycode, $itemtype, $branchcode); >+ $sth->execute($borrower->{'categorycode'}, $item->{'itype'}, $branchcode); > if(my $rights = $sth->fetchrow_hashref()){ >- $itemtype = $rights->{itemtype}; >+ $ruleitemtype = $rights->{itemtype}; > $allowedreserves = $rights->{reservesallowed}; > }else{ >- $itemtype = '*'; >+ $ruleitemtype = '*'; > } > > # we retrieve count > > $querycount .= "AND $branchfield = ?"; > >- $querycount .= " AND $itype = ?" if ($itemtype ne "*"); >+ $querycount .= " AND $itemtypefield = ?" if ($ruleitemtype ne "*"); > my $sthcount = $dbh->prepare($querycount); > >- if($itemtype eq "*"){ >+ if($ruleitemtype eq "*"){ > $sthcount->execute($borrowernumber, $branchcode); > }else{ >- $sthcount->execute($borrowernumber, $branchcode, $itemtype); >+ $sthcount->execute($borrowernumber, $branchcode, $ruleitemtype); > } > > my $reservecount = "0"; >-- >1.7.2.5
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 9532
:
15016
|
15018
|
16419
|
18061
|
18487
|
19606
|
19607
|
24949