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 583-589 subtest 'get_components_query' => sub { Link Here
583
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
583
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
584
584
585
    ( $comp_q, $comp_s ) = $biblio->get_components_query;
585
    ( $comp_q, $comp_s ) = $biblio->get_components_query;
586
    is($comp_q, "(rcn:$biblionumber AND (bib-level:a OR bib-level:b))", "UseControlNumber enabled without MarcOrgCode");
586
    is($comp_q, "(rcn:\"$biblionumber\" AND (bib-level:a OR bib-level:b))", "UseControlNumber enabled without MarcOrgCode");
587
    is($comp_s, "author_az", "UseControlNumber enabled without MarcOrgCode sort is correct");
587
    is($comp_s, "author_az", "UseControlNumber enabled without MarcOrgCode sort is correct");
588
588
589
    my $marc_003_field = MARC::Field->new('003', 'OSt');
589
    my $marc_003_field = MARC::Field->new('003', 'OSt');
Lines 594-600 subtest 'get_components_query' => sub { Link Here
594
    t::lib::Mocks::mock_preference( 'ComponentSortField', 'title' );
594
    t::lib::Mocks::mock_preference( 'ComponentSortField', 'title' );
595
    t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'asc' );
595
    t::lib::Mocks::mock_preference( 'ComponentSortOrder', 'asc' );
596
    ( $comp_q, $comp_s ) = $biblio->get_components_query;
596
    ( $comp_q, $comp_s ) = $biblio->get_components_query;
597
    is($comp_q, "(((rcn:$biblionumber AND cni:OSt) OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "UseControlNumber enabled with MarcOrgCode");
597
    is($comp_q, "(((rcn:\"$biblionumber\" AND cni:\"OSt\") OR rcn:\"OSt $biblionumber\") AND (bib-level:a OR bib-level:b))", "UseControlNumber enabled with MarcOrgCode");
598
    is($comp_s, "title_asc", "UseControlNumber enabled with MarcOrgCode sort if correct");
598
    is($comp_s, "title_asc", "UseControlNumber enabled with MarcOrgCode sort if correct");
599
};
599
};
600
600
601
- 

Return to bug 31326