Bugzilla – Attachment 47233 Details for
Bug 14695
Add ability to place multiple item holds on a given record per patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14695 [QA Followup] - Make existing unit tests pass
Bug-14695-QA-Followup---Make-existing-unit-tests-p.patch (text/plain), 5.29 KB, created by
Nick Clemens (kidclamp)
on 2016-01-22 22:29:56 UTC
(
hide
)
Description:
Bug 14695 [QA Followup] - Make existing unit tests pass
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2016-01-22 22:29:56 UTC
Size:
5.29 KB
patch
obsolete
>From 42579ed7f095fec4d0f5391834171410f15d6757 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 19 Jan 2016 17:49:44 +0000 >Subject: [PATCH] Bug 14695 [QA Followup] - Make existing unit tests pass > >* Removes tests no longer needed >* Updates rules to work with existing tests >* Fixes code issues revealed by unit tests > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Reserves.pm | 6 +++--- > t/db_dependent/Holds.t | 24 ++++++++++++------------ > t/db_dependent/Reserves.t | 10 +--------- > 3 files changed, 16 insertions(+), 24 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index fb22c0b..e25d0a2 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -551,16 +551,16 @@ sub CanItemBeReserved { > } > > my $circ_control_branch = >- C4::Circulation::_GetCircControlBranch( $item, $borrower ); >+ C4::Circulation::_GetCircControlBranch( $item->unblessed(), $borrower ); > my $branchitemrule = >- C4::Circulation::GetBranchItemRule( $circ_control_branch, $item->{itype} ); >+ C4::Circulation::GetBranchItemRule( $circ_control_branch, $item->itype ); > > if ( $branchitemrule->{holdallowed} == 0 ) { > return 'notReservable'; > } > > if ( $branchitemrule->{holdallowed} == 1 >- && $borrower->{branchcode} ne $item->{homebranch} ) >+ && $borrower->{branchcode} ne $item->homebranch ) > { > return 'cannotReserveFromOtherBranches'; > } >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 8767223..1ad8401 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -216,16 +216,16 @@ my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber) > = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_bibnum); > $dbh->do('DELETE FROM issuingrules'); > $dbh->do( >- q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >- VALUES (?, ?, ?, ?)}, >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) >+ VALUES (?, ?, ?, ?, ?)}, > {}, >- '*', '*', '*', 25 >+ '*', '*', '*', 25, 99 > ); > $dbh->do( >- q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >- VALUES (?, ?, ?, ?)}, >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) >+ VALUES (?, ?, ?, ?, ?)}, > {}, >- '*', '*', 'CANNOT', 0 >+ '*', '*', 'CANNOT', 0, 99 > ); > > # make sure some basic sysprefs are set >@@ -316,7 +316,7 @@ is( $reserve3->{priority}, 1, "After ModReserve, the 3rd reserve becomes the fir > > ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); > C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 1 ); >-ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); >+is( CanItemBeReserved( $borrowernumbers[0], $itemnumber), 'OK', "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); > ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); > C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 0 ); > ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); >@@ -332,8 +332,8 @@ AddReserve( > '', > 1, > ); >-ok( >- CanItemBeReserved( $borrowernumbers[0], $itemnumber) eq 'tooManyReserves', >+is( >+ CanItemBeReserved( $borrowernumbers[0], $itemnumber), 'tooManyReserves', > "cannot request item if policy that matches on item-level item type forbids it" > ); > ModItem({ itype => 'CAN' }, $item_bibnum, $itemnumber); >@@ -439,10 +439,10 @@ $dbh->do('DELETE FROM biblio'); > = AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $bibnum ); > > $dbh->do( >- q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) >- VALUES (?, ?, ?, ?)}, >+ q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record) >+ VALUES (?, ?, ?, ?, ?)}, > {}, >- '*', '*', 'ONLY1', 1 >+ '*', '*', 'ONLY1', 1, 99 > ); > is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ), > 'OK', 'Patron can reserve item with hold limit of 1, no holds placed' ); >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 8a6ab1c..74bb8f2 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 73; >+use Test::More tests => 71; > use Test::Warn; > > use MARC::Record; >@@ -448,14 +448,6 @@ $p = C4::Reserves::CalculatePriority($bibnum, $resdate); > is($p, 3, 'CalculatePriority should now return priority 3'); > # End of tests for bug 8918 > >-# Test for bug 5144 >-warning_is { >- $reserve_id = AddReserve('CPL', $requesters{'CPL3'}, $bibnum, >- $bibitems, $p, output_pref($resdate), $expdate, $notes, >- $title, $checkitem, $found) >-} "AddReserve: borrower $requesters{CPL3} already has a hold for biblionumber $bibnum"; >-is( $reserve_id, undef, 'Attempt to add a second reserve on a given record for the same patron fails.' ); >- > # Tests for cancel reserves by users from OPAC. > $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, >-- >2.1.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 14695
:
44143
|
44144
|
44145
|
45058
|
45059
|
45060
|
45061
|
45063
|
45064
|
46548
|
46549
|
46550
|
46551
|
46552
|
46553
|
46554
|
46555
|
46556
|
46557
|
46914
|
46915
|
46916
|
46917
|
46918
|
46919
|
46920
|
47183
|
47184
|
47185
|
47186
|
47187
|
47188
|
47189
|
47190
|
47191
|
47196
|
47227
|
47228
|
47229
|
47230
|
47231
|
47232
|
47233
|
47234
|
47355
|
47372
|
47606
|
47607
|
47608
|
47609
|
47610
|
47611
|
47612
|
47613
|
47614
|
47615
|
48792
|
48795
|
48796
|
48797
|
48798
|
48799
|
48800
|
48801
|
48802
|
48803
|
50056
|
50057
|
50058
|
50059
|
50060
|
50061
|
50062
|
50063
|
50064
|
50065
|
50327
|
50391
|
51006
|
51007
|
51008
|
51009
|
51010
|
51011
|
51012
|
51013
|
51014
|
51015
|
51016
|
51017
|
51027
|
51030
|
51031
|
51032
|
51033
|
51034
|
51035
|
51036
|
51037
|
51038
|
51039
|
51040
|
51041
|
51042
|
51277
|
51278
|
51279
|
51280
|
51281
|
51282
|
51283
|
51284
|
51285
|
51286
|
51287
|
51288
|
51289
|
52457
|
54546
|
54547
|
54548
|
54549
|
54550
|
54551
|
54552
|
54553
|
54554
|
54555
|
54556
|
54557
|
54558
|
54559
|
55114
|
55115
|
55116
|
55117
|
55118
|
55119
|
55120
|
55121
|
55122
|
55123
|
55124
|
55125
|
55126
|
55127
|
55128
|
55148
|
55149
|
55150
|
55151
|
55152
|
55153
|
55154
|
55155
|
55156
|
55157
|
55158
|
55159
|
55160
|
55161
|
55162
|
55163
|
55299
|
55332
|
55730
|
55731