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

(-)a/Koha/Biblio.pm (-2 / +2 lines)
Lines 595-606 sub get_components_query { Link Here
595
595
596
            if ( !defined($pf003) ) {
596
            if ( !defined($pf003) ) {
597
                # search for 773$w='Host001'
597
                # search for 773$w='Host001'
598
                $searchstr .= "rcn:" . $pf001->data();
598
                $searchstr .= "rcn:\"" . $pf001->data()."\"";
599
            }
599
            }
600
            else {
600
            else {
601
                $searchstr .= "(";
601
                $searchstr .= "(";
602
                # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001'
602
                # search for (773$w='Host001' and 003='Host003') or 773$w='(Host003)Host001'
603
                $searchstr .= "(rcn:" . $pf001->data() . " AND cni:" . $pf003->data() . ")";
603
                $searchstr .= "(rcn:\"" . $pf001->data() . "\" AND cni:\"" . $pf003->data() . "\")";
604
                $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\"";
604
                $searchstr .= " OR rcn:\"" . $pf003->data() . " " . $pf001->data() . "\"";
605
                $searchstr .= ")";
605
                $searchstr .= ")";
606
            }
606
            }
(-)a/t/db_dependent/Koha/Biblio.t (-3 / +2 lines)
Lines 586-592 subtest 'get_components_query' => sub { Link Here
586
        $biblio = Koha::Biblios->find( $biblio->biblionumber);
586
        $biblio = Koha::Biblios->find( $biblio->biblionumber);
587
587
588
        ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query;
588
        ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query;
589
        is($comp_query_str, "(rcn:$biblionumber AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled without MarcOrgCode");
589
        is($comp_query_str, "(rcn:\"$biblionumber\" AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled without MarcOrgCode");
590
        is($comp_sort, "author_az", "$engine: UseControlNumber enabled without MarcOrgCode sort is correct");
590
        is($comp_sort, "author_az", "$engine: UseControlNumber enabled without MarcOrgCode sort is correct");
591
591
592
        my $marc_003_field = MARC::Field->new('003', 'OSt');
592
        my $marc_003_field = MARC::Field->new('003', 'OSt');
Lines 597-603 subtest 'get_components_query' => sub { Link Here
597
        t::lib::Mocks::mock_preference( 'ComponentSortField', 'title' );
597
        t::lib::Mocks::mock_preference( 'ComponentSortField', 'title' );
598
        t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'asc' );
598
        t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'asc' );
599
        ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query;
599
        ( $comp_query, $comp_query_str, $comp_sort ) = $biblio->get_components_query;
600
        is($comp_query_str, "(((rcn:$biblionumber AND cni:OSt) OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled with MarcOrgCode");
600
        is($comp_query_str, "(((rcn:\"$biblionumber\" AND cni:\"OSt\") OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "$engine: UseControlNumber enabled with MarcOrgCode");
601
        is($comp_sort, "title_asc", "$engine: UseControlNumber enabled with MarcOrgCode sort if correct");
601
        is($comp_sort, "title_asc", "$engine: UseControlNumber enabled with MarcOrgCode sort if correct");
602
        $record->delete_field($marc_003_field);
602
        $record->delete_field($marc_003_field);
603
    }
603
    }
604
- 

Return to bug 31326