|
Lines 16-22
Link Here
|
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
use Test::More tests => 7; |
19 |
use Test::More tests => 8; |
| 20 |
use Data::Dumper qw( Dumper ); |
20 |
use Data::Dumper qw( Dumper ); |
| 21 |
use utf8; |
21 |
use utf8; |
| 22 |
|
22 |
|
|
Lines 298-303
subtest 'subfields_to_allow & ignore_not_allowed_subfields' => sub {
Link Here
|
| 298 |
is( $subfield, undef, "subfield that is not in the allow list is not returned" ); |
298 |
is( $subfield, undef, "subfield that is not in the allow list is not returned" ); |
| 299 |
}; |
299 |
}; |
| 300 |
|
300 |
|
|
|
301 |
subtest 'ignore_invisible_subfields' => sub { |
| 302 |
plan tests => 2; |
| 303 |
|
| 304 |
my $biblio = |
| 305 |
$builder->build_sample_biblio( { value => { frameworkcode => '' } } ); |
| 306 |
my $item = $builder->build_sample_item( |
| 307 |
{ |
| 308 |
issues => 42, |
| 309 |
} |
| 310 |
); |
| 311 |
|
| 312 |
# items.issues is mapped with 952$l |
| 313 |
my $subfields = Koha::UI::Form::Builder::Item->new( |
| 314 |
{ |
| 315 |
biblionumber => $biblio->biblionumber, |
| 316 |
item => $item->unblessed, |
| 317 |
} |
| 318 |
)->edit_form; |
| 319 |
( my $subfield ) = grep { $_->{subfield} eq 'l' } @$subfields; |
| 320 |
is( $subfield->{marc_value}->{value}, 42, 'items.issues copied' ); |
| 321 |
|
| 322 |
$subfields = Koha::UI::Form::Builder::Item->new( |
| 323 |
{ |
| 324 |
biblionumber => $biblio->biblionumber, |
| 325 |
item => $item->unblessed, |
| 326 |
} |
| 327 |
)->edit_form( |
| 328 |
{ |
| 329 |
ignore_invisible_subfields => 1 |
| 330 |
} |
| 331 |
); |
| 332 |
($subfield) = grep { $_->{subfield} eq 'l' } @$subfields; |
| 333 |
is( $subfield->{marc_value}->{value}, |
| 334 |
undef, 'items.issues not copied if ignore_invisible_subfields is passed' ); |
| 335 |
}; |
| 301 |
|
336 |
|
| 302 |
$cache->clear_from_cache("MarcStructure-0-"); |
337 |
$cache->clear_from_cache("MarcStructure-0-"); |
| 303 |
$cache->clear_from_cache("MarcStructure-1-"); |
338 |
$cache->clear_from_cache("MarcStructure-1-"); |
| 304 |
- |
|
|