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

(-)a/t/db_dependent/Koha/Biblio.t (-14 / +8 lines)
Lines 718-723 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
718
718
719
    t::lib::Mocks::mock_preference( 'NotesToHide', '520' );
719
    t::lib::Mocks::mock_preference( 'NotesToHide', '520' );
720
720
721
    my $av = $builder->build_object( { class => 'Koha::AuthorisedValues' } );
722
721
    my $biblio = $builder->build_sample_biblio;
723
    my $biblio = $builder->build_sample_biblio;
722
    my $record = $biblio->metadata->record;
724
    my $record = $biblio->metadata->record;
723
    $record->append_fields(
725
    $record->append_fields(
Lines 726-746 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
726
        MARC::Field->new( '520', '', '', a => 'Note3 skipped' ),
728
        MARC::Field->new( '520', '', '', a => 'Note3 skipped' ),
727
        MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ),
729
        MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ),
728
        MARC::Field->new( '544', '', '', a => 'Note5' ),
730
        MARC::Field->new( '544', '', '', a => 'Note5' ),
729
        MARC::Field->new( '590', '', '', a => 'CODE' ),
731
        MARC::Field->new( '590', '', '', a => $av->authorised_value ),
730
        MARC::Field->new( '545', '', '', a => 'Invisible on OPAC' ),
732
        MARC::Field->new( '545', '', '', a => 'Invisible on OPAC' ),
731
    );
733
    );
732
734
733
    Koha::AuthorisedValueCategory->new({ category_name => 'TEST' })->store;
734
    Koha::AuthorisedValue->new(
735
        {
736
            category         => 'TEST',
737
            authorised_value => 'CODE',
738
            lib              => 'Description should show',
739
            lib_opac         => 'Description should show OPAC'
740
        }
741
    )->store;
742
    my $mss = Koha::MarcSubfieldStructures->find({tagfield => "590", tagsubfield => "a", frameworkcode => $biblio->frameworkcode });
735
    my $mss = Koha::MarcSubfieldStructures->find({tagfield => "590", tagsubfield => "a", frameworkcode => $biblio->frameworkcode });
743
    $mss->update({ authorised_value => "TEST" });
736
    $mss->update({ authorised_value => $av->category });
744
737
745
    $mss = Koha::MarcSubfieldStructures->find({tagfield => "545", tagsubfield => "a", frameworkcode => $biblio->frameworkcode });
738
    $mss = Koha::MarcSubfieldStructures->find({tagfield => "545", tagsubfield => "a", frameworkcode => $biblio->frameworkcode });
746
    $mss->update({ hidden => 1 });
739
    $mss->update({ hidden => 1 });
Lines 749-754 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
749
    $cache->clear_from_cache("MarcStructure-0-");
742
    $cache->clear_from_cache("MarcStructure-0-");
750
    $cache->clear_from_cache("MarcStructure-1-");
743
    $cache->clear_from_cache("MarcStructure-1-");
751
    $cache->clear_from_cache("MarcSubfieldStructure-");
744
    $cache->clear_from_cache("MarcSubfieldStructure-");
745
    $cache->clear_from_cache("MarcCodedFields-");
752
746
753
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
747
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
754
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
748
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
Lines 759-765 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
759
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
753
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
760
    is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Note shows if not opac (Hidden by Indicator)" );
754
    is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Note shows if not opac (Hidden by Indicator)" );
761
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
755
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
762
    is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
756
    is( $notes->[5]->{marcnote}, $av->lib, 'Authorised value is correctly parsed to show description rather than code' );
763
    is( $notes->[6]->{marcnote}, 'Invisible on OPAC', 'Note shows if not opac (Hidden by framework)' );
757
    is( $notes->[6]->{marcnote}, 'Invisible on OPAC', 'Note shows if not opac (Hidden by framework)' );
764
    is( @$notes, 7, 'No more notes' );
758
    is( @$notes, 7, 'No more notes' );
765
    $notes = $biblio->get_marc_notes({ opac => 1 });
759
    $notes = $biblio->get_marc_notes({ opac => 1 });
Lines 767-778 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
767
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
761
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
768
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
762
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
769
    is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' );
763
    is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' );
770
    is( $notes->[4]->{marcnote}, 'Description should show OPAC', 'Authorised value is correctly parsed for OPAC to show description rather than code' );
764
    is( $notes->[4]->{marcnote}, $av->lib_opac, 'Authorised value is correctly parsed for OPAC to show description rather than code' );
771
    is( @$notes, 5, 'No more notes' );
765
    is( @$notes, 5, 'No more notes' );
772
766
773
    $cache->clear_from_cache("MarcStructure-0-");
767
    $cache->clear_from_cache("MarcStructure-0-");
774
    $cache->clear_from_cache("MarcStructure-1-");
768
    $cache->clear_from_cache("MarcStructure-1-");
775
    $cache->clear_from_cache("MarcSubfieldStructure-");
769
    $cache->clear_from_cache("MarcSubfieldStructure-");
770
    $cache->clear_from_cache("MarcCodedFields-");
776
771
777
    $schema->storage->txn_rollback;
772
    $schema->storage->txn_rollback;
778
};
773
};
779
- 

Return to bug 33214