View | Details | Raw Unified | Return to bug 9743
Collapse All | Expand All

(-)a/t/db_dependent/Reserves.t (-6 / +22 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 17;
5
use Test::More tests => 20;
6
use MARC::Record;
6
use MARC::Record;
7
use DateTime::Duration;
7
use DateTime::Duration;
8
8
Lines 43-48 my $title = 'Silence in the library'; Link Here
43
$bib->append_fields(
43
$bib->append_fields(
44
    MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
44
    MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
45
    MARC::Field->new('245', ' ', ' ', a => $title),
45
    MARC::Field->new('245', ' ', ' ', a => $title),
46
    MARC::Field->new('300', ' ', ' ', a => '2 vols.'),
46
);
47
);
47
my ($bibnum, $bibitemnum);
48
my ($bibnum, $bibitemnum);
48
($bibnum, $title, $bibitemnum) = AddBiblio($bib, '');
49
($bibnum, $title, $bibitemnum) = AddBiblio($bib, '');
Lines 76-85 my $notes = ''; Link Here
76
my $checkitem      = undef;
77
my $checkitem      = undef;
77
my $found          = undef;
78
my $found          = undef;
78
79
79
my @branches = GetBranchesLoop();
80
AddReserve('CPL',    $borrowernumber, $biblionumber,
80
my $branch = $branches[0][0]{value};
81
82
AddReserve($branch,    $borrowernumber, $biblionumber,
83
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
81
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
84
        $title,      $checkitem, $found);
82
        $title,      $checkitem, $found);
85
83
Lines 266-269 is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve with Link Here
266
my $letter = ReserveSlip('CPL', $requesters{'CPL'}, $bibnum);
264
my $letter = ReserveSlip('CPL', $requesters{'CPL'}, $bibnum);
267
ok(defined($letter), 'can successfully generate hold slip (bug 10949)');
265
ok(defined($letter), 'can successfully generate hold slip (bug 10949)');
268
266
267
# Tests for mandatory hold notes (bug 9743)
268
C4::Context->set_preference('OPACHoldNotes', 1);
269
C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2');
270
271
my $record=GetMarcBiblio($bibnum);
272
273
my $retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record);
274
is($retval, 1, "Mandatory hold notes test 1");
275
276
C4::Context->set_preference('OPACMandatoryHoldNotes', '4');
277
$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record);
278
is($retval, 0, "Mandatory hold notes test 2");
279
280
C4::Context->set_preference('OPACMandatoryHoldNotes', '1&2');
281
C4::Context->set_preference('OPACHoldNotes', 0);
282
$retval= C4::Reserves::GetMandatoryNoteReason($bibnum,$record);
283
is($retval, 0, "Mandatory hold notes test 3");
284
# End of mandatory hold notes tests (BZ 9743)
285
269
$dbh->rollback;
286
$dbh->rollback;
270
- 

Return to bug 9743