|
Lines 24-29
use C4::Branch;
Link Here
|
| 24 |
use Koha::Database; |
24 |
use Koha::Database; |
| 25 |
|
25 |
|
| 26 |
use t::lib::Mocks; |
26 |
use t::lib::Mocks; |
|
|
27 |
use t::lib::TestBuilder; |
| 27 |
|
28 |
|
| 28 |
use Test::More tests => 9; |
29 |
use Test::More tests => 9; |
| 29 |
|
30 |
|
|
Lines 34-43
BEGIN {
Link Here
|
| 34 |
use_ok('Koha::Items'); |
35 |
use_ok('Koha::Items'); |
| 35 |
} |
36 |
} |
| 36 |
|
37 |
|
| 37 |
my $schema = Koha::Database->new->schema; |
38 |
my $schema = Koha::Database->new->schema; |
| 38 |
|
|
|
| 39 |
my $branches = GetBranches; |
| 40 |
my ($branch1, $branch2) = keys %$branches; |
| 41 |
my $location = 'My Location'; |
39 |
my $location = 'My Location'; |
| 42 |
|
40 |
|
| 43 |
subtest 'General Add, Get and Del tests' => sub { |
41 |
subtest 'General Add, Get and Del tests' => sub { |
|
Lines 46-57
subtest 'General Add, Get and Del tests' => sub {
Link Here
|
| 46 |
|
44 |
|
| 47 |
$schema->storage->txn_begin; |
45 |
$schema->storage->txn_begin; |
| 48 |
|
46 |
|
|
|
47 |
my $builder = t::lib::TestBuilder->new; |
| 48 |
my $library = $builder->build({ |
| 49 |
source => 'Branch', |
| 50 |
}); |
| 51 |
|
| 49 |
# Create a biblio instance for testing |
52 |
# Create a biblio instance for testing |
| 50 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
53 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
| 51 |
my ($bibnum, $bibitemnum) = get_biblio(); |
54 |
my ($bibnum, $bibitemnum) = get_biblio(); |
| 52 |
|
55 |
|
| 53 |
# Add an item. |
56 |
# Add an item. |
| 54 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch1, location => $location } , $bibnum); |
57 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location } , $bibnum); |
| 55 |
cmp_ok($item_bibnum, '==', $bibnum, "New item is linked to correct biblionumber."); |
58 |
cmp_ok($item_bibnum, '==', $bibnum, "New item is linked to correct biblionumber."); |
| 56 |
cmp_ok($item_bibitemnum, '==', $bibitemnum, "New item is linked to correct biblioitemnumber."); |
59 |
cmp_ok($item_bibitemnum, '==', $bibitemnum, "New item is linked to correct biblioitemnumber."); |
| 57 |
|
60 |
|
|
Lines 72-78
subtest 'General Add, Get and Del tests' => sub {
Link Here
|
| 72 |
my $getdeleted = GetItem($itemnumber); |
75 |
my $getdeleted = GetItem($itemnumber); |
| 73 |
is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected."); |
76 |
is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected."); |
| 74 |
|
77 |
|
| 75 |
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch1, location => $location, permanent_location => 'my permanent location' } , $bibnum); |
78 |
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location' } , $bibnum); |
| 76 |
$getitem = GetItem($itemnumber); |
79 |
$getitem = GetItem($itemnumber); |
| 77 |
is( $getitem->{location}, $location, "The location should not have been modified" ); |
80 |
is( $getitem->{location}, $location, "The location should not have been modified" ); |
| 78 |
is( $getitem->{permanent_location}, 'my permanent location', "The permanent_location should not have modified" ); |
81 |
is( $getitem->{permanent_location}, 'my permanent location', "The permanent_location should not have modified" ); |
|
Lines 98-125
subtest 'GetHiddenItemnumbers tests' => sub {
Link Here
|
| 98 |
|
101 |
|
| 99 |
$schema->storage->txn_begin; |
102 |
$schema->storage->txn_begin; |
| 100 |
|
103 |
|
|
|
104 |
my $builder = t::lib::TestBuilder->new; |
| 105 |
my $library1 = $builder->build({ |
| 106 |
source => 'Branch', |
| 107 |
}); |
| 108 |
|
| 109 |
my $library2 = $builder->build({ |
| 110 |
source => 'Branch', |
| 111 |
}); |
| 112 |
|
| 101 |
# Create a new biblio |
113 |
# Create a new biblio |
| 102 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
114 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
| 103 |
my ($biblionumber, $biblioitemnumber) = get_biblio(); |
115 |
my ($biblionumber, $biblioitemnumber) = get_biblio(); |
| 104 |
|
116 |
|
| 105 |
# Add branches if they don't exist |
|
|
| 106 |
if (not defined GetBranchDetail('CPL')) { |
| 107 |
ModBranch({add => 1, branchcode => 'CPL', branchname => 'Centerville'}); |
| 108 |
} |
| 109 |
if (not defined GetBranchDetail('MPL')) { |
| 110 |
ModBranch({add => 1, branchcode => 'MPL', branchname => 'Midway'}); |
| 111 |
} |
| 112 |
|
| 113 |
# Add two items |
117 |
# Add two items |
| 114 |
my ($item1_bibnum, $item1_bibitemnum, $item1_itemnumber) = AddItem( |
118 |
my ($item1_bibnum, $item1_bibitemnum, $item1_itemnumber) = AddItem( |
| 115 |
{ homebranch => $branch1, |
119 |
{ homebranch => $library1->{branchcode}, |
| 116 |
holdingbranch => $branch1, |
120 |
holdingbranch => $library1->{branchcode}, |
| 117 |
withdrawn => 1 }, |
121 |
withdrawn => 1 }, |
| 118 |
$biblionumber |
122 |
$biblionumber |
| 119 |
); |
123 |
); |
| 120 |
my ($item2_bibnum, $item2_bibitemnum, $item2_itemnumber) = AddItem( |
124 |
my ($item2_bibnum, $item2_bibitemnum, $item2_itemnumber) = AddItem( |
| 121 |
{ homebranch => $branch2, |
125 |
{ homebranch => $library2->{branchcode}, |
| 122 |
holdingbranch => $branch2, |
126 |
holdingbranch => $library2->{branchcode}, |
| 123 |
withdrawn => 0 }, |
127 |
withdrawn => 0 }, |
| 124 |
$biblionumber |
128 |
$biblionumber |
| 125 |
); |
129 |
); |
|
Lines 160-171
subtest 'GetHiddenItemnumbers tests' => sub {
Link Here
|
| 160 |
# Two variables, a value each |
164 |
# Two variables, a value each |
| 161 |
$opachiddenitems = " |
165 |
$opachiddenitems = " |
| 162 |
withdrawn: [1] |
166 |
withdrawn: [1] |
| 163 |
homebranch: [$branch2] |
167 |
homebranch: [$library2->{branchcode}] |
| 164 |
"; |
168 |
"; |
| 165 |
C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems ); |
169 |
C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems ); |
| 166 |
@hidden = GetHiddenItemnumbers( @items ); |
170 |
@hidden = GetHiddenItemnumbers( @items ); |
| 167 |
ok( scalar @hidden == 2, "Two items hidden"); |
171 |
ok( scalar @hidden == 2, "Two items hidden"); |
| 168 |
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and homebranch=MPL hidden"); |
172 |
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and homebranch library2 hidden"); |
| 169 |
|
173 |
|
| 170 |
# Valid OpacHiddenItems, empty list |
174 |
# Valid OpacHiddenItems, empty list |
| 171 |
@items = (); |
175 |
@items = (); |
|
Lines 181-200
subtest 'GetItemsInfo tests' => sub {
Link Here
|
| 181 |
|
185 |
|
| 182 |
$schema->storage->txn_begin; |
186 |
$schema->storage->txn_begin; |
| 183 |
|
187 |
|
|
|
188 |
my $builder = t::lib::TestBuilder->new; |
| 189 |
my $library1 = $builder->build({ |
| 190 |
source => 'Branch', |
| 191 |
}); |
| 192 |
my $library2 = $builder->build({ |
| 193 |
source => 'Branch', |
| 194 |
}); |
| 195 |
|
| 184 |
# Add a biblio |
196 |
# Add a biblio |
| 185 |
my ($biblionumber, $biblioitemnumber) = get_biblio(); |
197 |
my ($biblionumber, $biblioitemnumber) = get_biblio(); |
| 186 |
# Add an item |
198 |
# Add an item |
| 187 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) |
199 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) |
| 188 |
= AddItem({ |
200 |
= AddItem({ |
| 189 |
homebranch => $branch1, |
201 |
homebranch => $library1->{branchcode}, |
| 190 |
holdingbranch => $branch2 |
202 |
holdingbranch => $library2->{branchcode}, |
| 191 |
}, $biblionumber ); |
203 |
}, $biblionumber ); |
| 192 |
|
204 |
|
| 193 |
my $branch = GetBranchDetail( $branch1 ); |
205 |
my $branch = GetBranchDetail( $library1->{branchcode} ); |
| 194 |
$branch->{ opac_info } = "homebranch OPAC info"; |
206 |
$branch->{ opac_info } = "homebranch OPAC info"; |
| 195 |
ModBranch($branch); |
207 |
ModBranch($branch); |
| 196 |
|
208 |
|
| 197 |
$branch = GetBranchDetail( $branch2 ); |
209 |
$branch = GetBranchDetail( $library2->{branchcode} ); |
| 198 |
$branch->{ opac_info } = "holdingbranch OPAC info"; |
210 |
$branch->{ opac_info } = "holdingbranch OPAC info"; |
| 199 |
ModBranch($branch); |
211 |
ModBranch($branch); |
| 200 |
|
212 |
|
|
Lines 259-288
subtest 'SearchItems test' => sub {
Link Here
|
| 259 |
|
271 |
|
| 260 |
$schema->storage->txn_begin; |
272 |
$schema->storage->txn_begin; |
| 261 |
my $dbh = C4::Context->dbh; |
273 |
my $dbh = C4::Context->dbh; |
|
|
274 |
my $builder = t::lib::TestBuilder->new; |
| 275 |
|
| 276 |
my $library1 = $builder->build({ |
| 277 |
source => 'Branch', |
| 278 |
}); |
| 279 |
my $library2 = $builder->build({ |
| 280 |
source => 'Branch', |
| 281 |
}); |
| 262 |
|
282 |
|
| 263 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
283 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
| 264 |
my $cpl_items_before = SearchItemsByField( 'homebranch', 'CPL'); |
284 |
my $cpl_items_before = SearchItemsByField( 'homebranch', $library1->{branchcode}); |
| 265 |
|
285 |
|
| 266 |
my ($biblionumber) = get_biblio(); |
286 |
my ($biblionumber) = get_biblio(); |
| 267 |
|
287 |
|
| 268 |
# Add branches if they don't exist |
|
|
| 269 |
if (not defined GetBranchDetail('CPL')) { |
| 270 |
ModBranch({add => 1, branchcode => 'CPL', branchname => 'Centerville'}); |
| 271 |
} |
| 272 |
if (not defined GetBranchDetail('MPL')) { |
| 273 |
ModBranch({add => 1, branchcode => 'MPL', branchname => 'Midway'}); |
| 274 |
} |
| 275 |
|
| 276 |
my (undef, $initial_items_count) = SearchItems(undef, {rows => 1}); |
288 |
my (undef, $initial_items_count) = SearchItems(undef, {rows => 1}); |
| 277 |
|
289 |
|
| 278 |
# Add two items |
290 |
# Add two items |
| 279 |
my (undef, undef, $item1_itemnumber) = AddItem({ |
291 |
my (undef, undef, $item1_itemnumber) = AddItem({ |
| 280 |
homebranch => 'CPL', |
292 |
homebranch => $library1->{branchcode}, |
| 281 |
holdingbranch => 'CPL', |
293 |
holdingbranch => $library1->{branchcode}, |
| 282 |
}, $biblionumber); |
294 |
}, $biblionumber); |
| 283 |
my (undef, undef, $item2_itemnumber) = AddItem({ |
295 |
my (undef, undef, $item2_itemnumber) = AddItem({ |
| 284 |
homebranch => 'MPL', |
296 |
homebranch => $library2->{branchcode}, |
| 285 |
holdingbranch => 'MPL', |
297 |
holdingbranch => $library2->{branchcode}, |
| 286 |
}, $biblionumber); |
298 |
}, $biblionumber); |
| 287 |
|
299 |
|
| 288 |
my ($items, $total_results); |
300 |
my ($items, $total_results); |
|
Lines 298-311
subtest 'SearchItems test' => sub {
Link Here
|
| 298 |
# Search all items where homebranch = 'CPL' |
310 |
# Search all items where homebranch = 'CPL' |
| 299 |
my $filter = { |
311 |
my $filter = { |
| 300 |
field => 'homebranch', |
312 |
field => 'homebranch', |
| 301 |
query => 'CPL', |
313 |
query => $library1->{branchcode}, |
| 302 |
operator => '=', |
314 |
operator => '=', |
| 303 |
}; |
315 |
}; |
| 304 |
($items, $total_results) = SearchItems($filter); |
316 |
($items, $total_results) = SearchItems($filter); |
| 305 |
ok($total_results > 0, "There is at least one CPL item"); |
317 |
ok($total_results > 0, "There is at least one CPL item"); |
| 306 |
my $all_items_are_CPL = 1; |
318 |
my $all_items_are_CPL = 1; |
| 307 |
foreach my $item (@$items) { |
319 |
foreach my $item (@$items) { |
| 308 |
if ($item->{homebranch} ne 'CPL') { |
320 |
if ($item->{homebranch} ne $library1->{branchcode}) { |
| 309 |
$all_items_are_CPL = 0; |
321 |
$all_items_are_CPL = 0; |
| 310 |
last; |
322 |
last; |
| 311 |
} |
323 |
} |
|
Lines 315-328
subtest 'SearchItems test' => sub {
Link Here
|
| 315 |
# Search all items where homebranch != 'CPL' |
327 |
# Search all items where homebranch != 'CPL' |
| 316 |
$filter = { |
328 |
$filter = { |
| 317 |
field => 'homebranch', |
329 |
field => 'homebranch', |
| 318 |
query => 'CPL', |
330 |
query => $library1->{branchcode}, |
| 319 |
operator => '!=', |
331 |
operator => '!=', |
| 320 |
}; |
332 |
}; |
| 321 |
($items, $total_results) = SearchItems($filter); |
333 |
($items, $total_results) = SearchItems($filter); |
| 322 |
ok($total_results > 0, "There is at least one non-CPL item"); |
334 |
ok($total_results > 0, "There is at least one non-CPL item"); |
| 323 |
my $all_items_are_not_CPL = 1; |
335 |
my $all_items_are_not_CPL = 1; |
| 324 |
foreach my $item (@$items) { |
336 |
foreach my $item (@$items) { |
| 325 |
if ($item->{homebranch} eq 'CPL') { |
337 |
if ($item->{homebranch} eq $library1->{branchcode}) { |
| 326 |
$all_items_are_not_CPL = 0; |
338 |
$all_items_are_not_CPL = 0; |
| 327 |
last; |
339 |
last; |
| 328 |
} |
340 |
} |
|
Lines 350-356
subtest 'SearchItems test' => sub {
Link Here
|
| 350 |
}, |
362 |
}, |
| 351 |
{ |
363 |
{ |
| 352 |
field => 'homebranch', |
364 |
field => 'homebranch', |
| 353 |
query => 'CPL', |
365 |
query => $library1->{branchcode}, |
| 354 |
operator => '=', |
366 |
operator => '=', |
| 355 |
}, |
367 |
}, |
| 356 |
], |
368 |
], |
|
Lines 411-417
subtest 'SearchItems test' => sub {
Link Here
|
| 411 |
($items, $total_results) = SearchItems($filter); |
423 |
($items, $total_results) = SearchItems($filter); |
| 412 |
ok(scalar @$items == 1, 'found 1 item with itemnotes = "foobar"'); |
424 |
ok(scalar @$items == 1, 'found 1 item with itemnotes = "foobar"'); |
| 413 |
|
425 |
|
| 414 |
my $cpl_items_after = SearchItemsByField( 'homebranch', 'CPL'); |
426 |
my $cpl_items_after = SearchItemsByField( 'homebranch', $library1->{branchcode}); |
| 415 |
is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItemsByField should return something' ); |
427 |
is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItemsByField should return something' ); |
| 416 |
|
428 |
|
| 417 |
$schema->storage->txn_rollback; |
429 |
$schema->storage->txn_rollback; |
|
Lines 423-432
subtest 'Koha::Item(s) tests' => sub {
Link Here
|
| 423 |
|
435 |
|
| 424 |
$schema->storage->txn_begin(); |
436 |
$schema->storage->txn_begin(); |
| 425 |
|
437 |
|
|
|
438 |
my $builder = t::lib::TestBuilder->new; |
| 439 |
my $library1 = $builder->build({ |
| 440 |
source => 'Branch', |
| 441 |
}); |
| 442 |
my $library2 = $builder->build({ |
| 443 |
source => 'Branch', |
| 444 |
}); |
| 445 |
|
| 426 |
# Create a biblio and item for testing |
446 |
# Create a biblio and item for testing |
| 427 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
447 |
C4::Context->set_preference('marcflavour', 'MARC21'); |
| 428 |
my ($bibnum, $bibitemnum) = get_biblio(); |
448 |
my ($bibnum, $bibitemnum) = get_biblio(); |
| 429 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch1, holdingbranch => $branch2 } , $bibnum); |
449 |
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library1->{branchcode}, holdingbranch => $library2->{branchcode} } , $bibnum); |
| 430 |
|
450 |
|
| 431 |
# Get item. |
451 |
# Get item. |
| 432 |
my $item = Koha::Items->find( $itemnumber ); |
452 |
my $item = Koha::Items->find( $itemnumber ); |
|
Lines 434-444
subtest 'Koha::Item(s) tests' => sub {
Link Here
|
| 434 |
|
454 |
|
| 435 |
my $homebranch = $item->home_branch(); |
455 |
my $homebranch = $item->home_branch(); |
| 436 |
is( ref($homebranch), 'Koha::Branch', "Got Koha::Branch from home_branch method" ); |
456 |
is( ref($homebranch), 'Koha::Branch', "Got Koha::Branch from home_branch method" ); |
| 437 |
is( $homebranch->branchcode(), $branch1, "Home branch code matches homebranch" ); |
457 |
is( $homebranch->branchcode(), $library1->{branchcode}, "Home branch code matches homebranch" ); |
| 438 |
|
458 |
|
| 439 |
my $holdingbranch = $item->holding_branch(); |
459 |
my $holdingbranch = $item->holding_branch(); |
| 440 |
is( ref($holdingbranch), 'Koha::Branch', "Got Koha::Branch from holding_branch method" ); |
460 |
is( ref($holdingbranch), 'Koha::Branch', "Got Koha::Branch from holding_branch method" ); |
| 441 |
is( $holdingbranch->branchcode(), $branch2, "Home branch code matches holdingbranch" ); |
461 |
is( $holdingbranch->branchcode(), $library2->{branchcode}, "Home branch code matches holdingbranch" ); |
|
|
462 |
|
| 463 |
$schema->storage->txn_rollback; |
| 442 |
}; |
464 |
}; |
| 443 |
|
465 |
|
| 444 |
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { |
466 |
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { |
|
Lines 446-465
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
Link Here
|
| 446 |
|
468 |
|
| 447 |
$schema->storage->txn_begin(); |
469 |
$schema->storage->txn_begin(); |
| 448 |
|
470 |
|
|
|
471 |
my $builder = t::lib::TestBuilder->new; |
| 472 |
my $library1 = $builder->build({ |
| 473 |
source => 'Branch', |
| 474 |
}); |
| 475 |
my $library2 = $builder->build({ |
| 476 |
source => 'Branch', |
| 477 |
}); |
| 478 |
|
| 449 |
my ( $biblionumber, $biblioitemnumber ) = get_biblio(); |
479 |
my ( $biblionumber, $biblioitemnumber ) = get_biblio(); |
| 450 |
my $item_infos = [ |
480 |
my $item_infos = [ |
| 451 |
{ homebranch => 'CPL', holdingbranch => 'CPL' }, |
481 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library1->{branchcode} }, |
| 452 |
{ homebranch => 'CPL', holdingbranch => 'CPL' }, |
482 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library1->{branchcode} }, |
| 453 |
{ homebranch => 'CPL', holdingbranch => 'CPL' }, |
483 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library1->{branchcode} }, |
| 454 |
{ homebranch => 'MPL', holdingbranch => 'MPL' }, |
484 |
{ homebranch => $library2->{branchcode}, holdingbranch => $library2->{branchcode} }, |
| 455 |
{ homebranch => 'MPL', holdingbranch => 'MPL' }, |
485 |
{ homebranch => $library2->{branchcode}, holdingbranch => $library2->{branchcode} }, |
| 456 |
{ homebranch => 'CPL', holdingbranch => 'MPL' }, |
486 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library2->{branchcode} }, |
| 457 |
{ homebranch => 'CPL', holdingbranch => 'MPL' }, |
487 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library2->{branchcode} }, |
| 458 |
{ homebranch => 'CPL', holdingbranch => 'MPL' }, |
488 |
{ homebranch => $library1->{branchcode}, holdingbranch => $library2->{branchcode} }, |
| 459 |
]; |
489 |
]; |
| 460 |
my $number_of_items = scalar @$item_infos; |
490 |
my $number_of_items = scalar @$item_infos; |
| 461 |
my $number_of_items_with_homebranch_is_CPL = |
491 |
my $number_of_items_with_homebranch_is_CPL = |
| 462 |
grep { $_->{homebranch} eq 'CPL' } @$item_infos; |
492 |
grep { $_->{homebranch} eq $library1->{branchcode} } @$item_infos; |
| 463 |
|
493 |
|
| 464 |
my @itemnumbers; |
494 |
my @itemnumbers; |
| 465 |
for my $item_info (@$item_infos) { |
495 |
for my $item_info (@$item_infos) { |
|
Lines 497-503
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
Link Here
|
| 497 |
is( scalar @items, $number_of_items, 'Should return all items for opac' ); |
527 |
is( scalar @items, $number_of_items, 'Should return all items for opac' ); |
| 498 |
|
528 |
|
| 499 |
my $opachiddenitems = " |
529 |
my $opachiddenitems = " |
| 500 |
homebranch: ['CPL']"; |
530 |
homebranch: ['$library1->{branchcode}']"; |
| 501 |
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems ); |
531 |
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems ); |
| 502 |
|
532 |
|
| 503 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber ); |
533 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber ); |
|
Lines 515-521
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
Link Here
|
| 515 |
); |
545 |
); |
| 516 |
|
546 |
|
| 517 |
$opachiddenitems = " |
547 |
$opachiddenitems = " |
| 518 |
homebranch: ['CPL', 'MPL']"; |
548 |
homebranch: ['$library1->{branchcode}', '$library2->{branchcode}']"; |
| 519 |
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems ); |
549 |
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems ); |
| 520 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 ); |
550 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 ); |
| 521 |
@items = $record->field($itemfield); |
551 |
@items = $record->field($itemfield); |
|
Lines 524-529
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
Link Here
|
| 524 |
0, |
554 |
0, |
| 525 |
'For OPAC, If all items are hidden, no item should have been embeded' |
555 |
'For OPAC, If all items are hidden, no item should have been embeded' |
| 526 |
); |
556 |
); |
|
|
557 |
|
| 558 |
$schema->storage->txn_rollback; |
| 527 |
}; |
559 |
}; |
| 528 |
|
560 |
|
| 529 |
# Helper method to set up a Biblio. |
561 |
# Helper method to set up a Biblio. |