Bugzilla – Attachment 19563 Details for
Bug 9743
Allow customization for making hold notes required
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9743: Unit test for mandatory hold notes
Bug-9743-Unit-test-for-mandatory-hold-notes.patch (text/plain), 3.37 KB, created by
Marcel de Rooy
on 2013-07-11 12:18:43 UTC
(
hide
)
Description:
Bug 9743: Unit test for mandatory hold notes
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-07-11 12:18:43 UTC
Size:
3.37 KB
patch
obsolete
>From aa428a0583bcfa4bd1ff7444c69d0b92c26a9d70 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 6 Mar 2013 14:58:29 +0100 >Subject: [PATCH] Bug 9743: Unit test for mandatory hold notes >Content-Type: text/plain; charset=utf-8 > >Test plan: >Export PERL5LIB and KOHA_CONF to your test database. >Run t/db_dependent/Reserves.t. >--- > t/db_dependent/Reserves.t | 37 +++++++++++++++++++++++++++++++------ > 1 files changed, 31 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 0e0852a..8669ea6 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 7; > use MARC::Record; > > use C4::Branch; >@@ -28,12 +28,15 @@ my $title = 'Silence in the library'; > $bib->append_fields( > MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), > MARC::Field->new('245', ' ', ' ', a => $title), >+ MARC::Field->new('300', ' ', ' ', a => '2 vols.'), > ); > my ($bibnum, $bibitemnum); > ($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); > # Helper item for that biblio. >+my @branches = GetBranchesLoop(); >+my $branch = $branches[0][0]{value}; > diag("Creating item instance for testing."); >-my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); >+my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch||'CPL', holdingbranch => $branch||'CPL' } , $bibnum); > > # Modify item; setting barcode. > my $testbarcode = '97531'; >@@ -44,7 +47,8 @@ my %data = ( > firstname => 'my firstname', > surname => 'my surname', > categorycode => 'S', >- branchcode => 'CPL', >+ #TODO: Hardcoded staff category may fail? >+ branchcode => $branch||'CPL', > ); > my $borrowernumber = AddMember(%data); > my $borrower = GetMember( borrowernumber => $borrowernumber ); >@@ -60,9 +64,6 @@ my $notes = ''; > my $checkitem = undef; > my $found = undef; > >-my @branches = GetBranchesLoop(); >-my $branch = $branches[0][0]{value}; >- > AddReserve($branch, $borrowernumber, $biblionumber, > $constraint, $bibitems, $priority, $resdate, $expdate, $notes, > $title, $checkitem, $found); >@@ -76,3 +77,27 @@ is($status, "Reserved", "CheckReserves Test 2"); > > ($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); > is($status, "Reserved", "CheckReserves Test 3"); >+ >+#tests for mandatory hold notes >+my $shownotes=C4::Context->preference('OPACHoldNotes'); >+my $mandnotes=C4::Context->preference('OPACMandatoryHoldNotes'); >+C4::Context->set_preference('OPACHoldNotes', 1); >+C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2'); >+ >+my $record=GetMarcBiblio($bibnum); >+ >+my $retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); >+is($retval, 1, "Mandatory hold notes test 1"); >+ >+C4::Context->set_preference('OPACMandatoryHoldNotes', '4'); >+$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); >+is($retval, 0, "Mandatory hold notes test 2"); >+ >+C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2'); >+C4::Context->set_preference('OPACHoldNotes', 0); >+$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); >+is($retval, 0, "Mandatory hold notes test 3"); >+ >+#reset prefs >+C4::Context->set_preference('OPACHoldNotes', $shownotes); >+C4::Context->set_preference('OPACMandatoryHoldNotes', $mandnotes); >-- >1.7.7.6
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 9743
:
15842
|
15843
|
15910
|
17720
|
17721
|
17722
|
19561
|
19562
|
19563
|
21233
|
21236
|
21240
|
21741
|
21742
|
21743
|
21744
|
34422
|
34526