Lines 4-10
use strict;
Link Here
|
4 |
use warnings; |
4 |
use warnings; |
5 |
use C4::Branch; |
5 |
use C4::Branch; |
6 |
|
6 |
|
7 |
use Test::More tests => 4; |
7 |
use Test::More tests => 7; |
8 |
use MARC::Record; |
8 |
use MARC::Record; |
9 |
use C4::Biblio; |
9 |
use C4::Biblio; |
10 |
use C4::Items; |
10 |
use C4::Items; |
Lines 21-28
diag("\nCreating biblio instance for testing.");
Link Here
|
21 |
my ($bibnum, $title, $bibitemnum) = create_helper_biblio(); |
21 |
my ($bibnum, $title, $bibitemnum) = create_helper_biblio(); |
22 |
|
22 |
|
23 |
# Helper item for that biblio. |
23 |
# Helper item for that biblio. |
|
|
24 |
my @branches = GetBranchesLoop(); |
25 |
my $branch = $branches[0][0]{value}; |
24 |
diag("Creating item instance for testing."); |
26 |
diag("Creating item instance for testing."); |
25 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); |
27 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch||'CPL', holdingbranch => $branch||'CPL' } , $bibnum); |
26 |
|
28 |
|
27 |
# Modify item; setting barcode. |
29 |
# Modify item; setting barcode. |
28 |
my $testbarcode = '97531'; |
30 |
my $testbarcode = '97531'; |
Lines 50-58
my $notes = '';
Link Here
|
50 |
my $checkitem = undef; |
52 |
my $checkitem = undef; |
51 |
my $found = undef; |
53 |
my $found = undef; |
52 |
|
54 |
|
53 |
my @branches = GetBranchesLoop(); |
|
|
54 |
my $branch = $branches[0][0]{value}; |
55 |
|
56 |
AddReserve($branch, $borrowernumber, $biblionumber, |
55 |
AddReserve($branch, $borrowernumber, $biblionumber, |
57 |
$constraint, $bibitems, $priority, $resdate, $expdate, $notes, |
56 |
$constraint, $bibitems, $priority, $resdate, $expdate, $notes, |
58 |
$title, $checkitem, $found); |
57 |
$title, $checkitem, $found); |
Lines 66-71
ok($status eq "Reserved", "CheckReserves Test 2");
Link Here
|
66 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
65 |
($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); |
67 |
ok($status eq "Reserved", "CheckReserves Test 3"); |
66 |
ok($status eq "Reserved", "CheckReserves Test 3"); |
68 |
|
67 |
|
|
|
68 |
#tests for mandatory hold notes |
69 |
my $shownotes=C4::Context->preference('OPACShowHoldNotes'); |
70 |
my $mandnotes=C4::Context->preference('OPACMandatoryHoldNotes'); |
71 |
C4::Context->set_preference('OPACShowHoldNotes', 1); |
72 |
C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2'); |
73 |
my $record=GetMarcBiblio($bibnum); |
74 |
my $retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); |
75 |
ok($retval==1, "Mandatory hold notes test 1"); |
76 |
C4::Context->set_preference('OPACMandatoryHoldNotes', '4'); |
77 |
$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); |
78 |
ok($retval==0, "Mandatory hold notes test 2"); |
79 |
C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2'); |
80 |
C4::Context->set_preference('OPACShowHoldNotes', 0); |
81 |
$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record); |
82 |
ok($retval==0, "Mandatory hold notes test 3"); |
83 |
#reset prefs |
84 |
C4::Context->set_preference('OPACShowHoldNotes', $shownotes); |
85 |
C4::Context->set_preference('OPACMandatoryHoldNotes', $mandnotes); |
86 |
|
69 |
|
87 |
|
70 |
# Teardown Test--------------------- |
88 |
# Teardown Test--------------------- |
71 |
# Delete item. |
89 |
# Delete item. |
Lines 83-88
sub create_helper_biblio {
Link Here
|
83 |
$bib->append_fields( |
101 |
$bib->append_fields( |
84 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
102 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
85 |
MARC::Field->new('245', ' ', ' ', a => $title), |
103 |
MARC::Field->new('245', ' ', ' ', a => $title), |
|
|
104 |
MARC::Field->new('300', ' ', ' ', a => '2 vols for triggering notes'), |
86 |
); |
105 |
); |
87 |
return ($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); |
106 |
return ($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); |
88 |
} |
107 |
} |
89 |
- |
|
|