Bugzilla – Attachment 41952 Details for
Bug 11999
Add two checks in CanBookBeReserved and CanItemBeReserved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11999: Check for age restriction in CanBookBeReserved
Bug-11999-Check-for-age-restriction-in-CanBookBeRe.patch (text/plain), 2.35 KB, created by
Julian Maurice
on 2015-08-26 08:04:29 UTC
(
hide
)
Description:
Bug 11999: Check for age restriction in CanBookBeReserved
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2015-08-26 08:04:29 UTC
Size:
2.35 KB
patch
obsolete
>From 62c731244e05b4f4d16bdb7156a0d177062edf04 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 23 Apr 2015 11:54:40 +0200 >Subject: [PATCH] Bug 11999: Check for age restriction in CanBookBeReserved > >+ improve t/db_dependent/Reserves.t to make tests pass on UNIMARC >installation >--- > C4/Reserves.pm | 6 ++++++ > t/db_dependent/Reserves.t | 12 ++++++++---- > 2 files changed, 14 insertions(+), 4 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index bc1af9e..36098de 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -477,6 +477,12 @@ sub CanBookBeReserved{ > return 'tooManyReserves'; > } > >+ # Check for the age restriction >+ my $biblioData = C4::Biblio::GetBiblioData( $biblionumber ); >+ my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber); >+ my ($ageRestriction, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower ); >+ return 'ageRestricted' if $daysToAgeRestriction && $daysToAgeRestriction > 0; >+ > my $items = GetItemnumbersForBiblio($biblionumber); > #get items linked via host records > my @hostitems = get_hostitemnumbers_of($biblionumber); >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 3ed904c..d1da5e6 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -18,6 +18,7 @@ > use Modern::Perl; > > use Test::More tests => 65; >+use Test::MockModule; > > use MARC::Record; > use DateTime::Duration; >@@ -38,9 +39,8 @@ BEGIN { > } > > # a very minimal mack of userenv for use by the test of DelItemCheck >-*C4::Context::userenv = sub { >- return {}; >-}; >+my $c4_context = Test::MockModule->new('C4::Context'); >+$c4_context->mock('userenv', sub { return { flags => 1 } }); > > my $dbh = C4::Context->dbh; > >@@ -49,7 +49,11 @@ $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; > > # Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached >-$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a'"); >+$dbh->do(q| >+ INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield) >+ VALUES ('', '521', 'a', 'biblioitems.agerestriction') >+ ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield) >+|); > > # Setup Test------------------------ > >-- >1.9.1
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 11999
:
26589
|
28986
|
31524
|
35697
|
36358
|
36404
|
36630
|
38397
|
41951
|
41952
|
44631
|
44632
|
46262
|
46263
|
50224
|
50225
|
58741
|
58742
|
58743
|
63593
|
63594
|
63595
|
66267
|
66268
|
66269
|
66270
|
88300
|
88301
|
88302
|
88303
|
90142
|
90143
|
90144
|
90146
|
90147
|
91046
|
91402
|
91403
|
91479
|
91481
|
91494
|
91580
|
91581
|
91582
|
91590
|
91591
|
91592
|
91593
|
99927
|
99928
|
106481
|
106494
|
111687
|
111688
|
111689
|
112871
|
112872
|
112873
|
112874
|
120776
|
120777
|
120778
|
120779
|
120780
|
121531
|
121612