|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 62; |
20 |
use Test::More tests => 63; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Warn; |
22 |
use Test::Warn; |
| 23 |
|
23 |
|
|
Lines 61-67
my $frameworkcode = q//;
Link Here
|
| 61 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); |
61 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); |
| 62 |
|
62 |
|
| 63 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
63 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
| 64 |
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode); |
64 |
$dbh->do(q| |
|
|
65 |
INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield) |
| 66 |
VALUES ('', '521', 'a', 'biblioitems.agerestriction') |
| 67 |
ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield) |
| 68 |
|); |
| 65 |
my $cache = Koha::Caches->get_instance; |
69 |
my $cache = Koha::Caches->get_instance; |
| 66 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
70 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
| 67 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
71 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
|
Lines 1035-1040
subtest 'MoveReserve additional test' => sub {
Link Here
|
| 1035 |
|
1039 |
|
| 1036 |
}; |
1040 |
}; |
| 1037 |
|
1041 |
|
|
|
1042 |
|
| 1043 |
subtest 'check maxreserve test' => sub { |
| 1044 |
|
| 1045 |
plan tests => 2; |
| 1046 |
|
| 1047 |
t::lib::Mocks::mock_preference('maxreserves', 1); |
| 1048 |
# Create the items and patrons we need |
| 1049 |
my $biblio_1 = $builder->build_sample_biblio(); |
| 1050 |
my $biblio_2 = $builder->build_sample_biblio(); |
| 1051 |
my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); |
| 1052 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber,notforloan => 0, itype => $itype->itemtype }); |
| 1053 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype }); |
| 1054 |
my $patron = $builder->build_object({ class => "Koha::Patrons" }); |
| 1055 |
|
| 1056 |
|
| 1057 |
# Place a hold on the title for both patrons |
| 1058 |
my $reserve = AddReserve( |
| 1059 |
{ |
| 1060 |
branchcode => $item_1->homebranch, |
| 1061 |
borrowernumber => $patron->borrowernumber, |
| 1062 |
biblionumber => $biblio_1->biblionumber, |
| 1063 |
priority => 1, |
| 1064 |
itemnumber => $item_1->itemnumber, |
| 1065 |
} |
| 1066 |
); |
| 1067 |
|
| 1068 |
my $borrowernumber = $patron->borrowernumber; |
| 1069 |
|
| 1070 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_2->biblionumber)->{status} , 'tooManyReserves', "Reserving more than maxreserves is forbidden"); |
| 1071 |
is( C4::Reserves::CanItemBeReserved($borrowernumber, $item_2->itemnumber, $item_2->homebranch)->{status} , 'tooManyReserves', "Reserving more than maxreserves is forbidden"); |
| 1072 |
|
| 1073 |
}; |
| 1074 |
|
| 1038 |
sub count_hold_print_messages { |
1075 |
sub count_hold_print_messages { |
| 1039 |
my $message_count = $dbh->selectall_arrayref(q{ |
1076 |
my $message_count = $dbh->selectall_arrayref(q{ |
| 1040 |
SELECT COUNT(*) |
1077 |
SELECT COUNT(*) |
| 1041 |
- |
|
|