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

(-)a/Koha/Biblio.pm (-1 / +2 lines)
Lines 642-648 sub get_coins { Link Here
642
                push @authors, $au;
642
                push @authors, $au;
643
            }
643
            }
644
        }
644
        }
645
        $title = $record->field('245')->as_string('ab');
645
        $title = $record->field('245');
646
        $title &&= $title->as_string('ab');
646
        if ($titletype eq 'a') {
647
        if ($titletype eq 'a') {
647
            $pubyear   = $record->field('008') || '';
648
            $pubyear   = $record->field('008') || '';
648
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
649
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
(-)a/t/db_dependent/Koha/Biblio.t (-3 / +11 lines)
Lines 118-124 subtest 'items() tests' => sub { Link Here
118
118
119
subtest 'get_coins and get_openurl' => sub {
119
subtest 'get_coins and get_openurl' => sub {
120
120
121
    plan tests => 3;
121
    plan tests => 4;
122
122
123
    $schema->storage->txn_begin;
123
    $schema->storage->txn_begin;
124
124
Lines 127-139 subtest 'get_coins and get_openurl' => sub { Link Here
127
            title => 'Title 1',
127
            title => 'Title 1',
128
            author => 'Author 1'
128
            author => 'Author 1'
129
        });
129
        });
130
131
    is(
130
    is(
132
        $biblio->get_coins,
131
        $biblio->get_coins,
133
        'ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title%201&rft.au=Author%201',
132
        'ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title%201&rft.au=Author%201',
134
        'GetCOinsBiblio returned right metadata'
133
        'GetCOinsBiblio returned right metadata'
135
    );
134
    );
136
135
136
    my $record = MARC::Record->new();
137
    $record->append_fields( MARC::Field->new('100','','','a' => 'Author 2'), MARC::Field->new('880','','','a' => 'Something') );
138
    my $biblionumber = C4::Biblio::AddBiblio($record, '');
139
    my $biblio_no_title = Koha::Biblios->find($biblionumber);
140
    is(
141
        $biblio_no_title->get_coins,
142
        'ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.au=Author%202',
143
        'GetCOinsBiblio returned right metadata if biblio does not have a title'
144
    );
145
137
    t::lib::Mocks::mock_preference("OpenURLResolverURL", "https://koha.example.com/");
146
    t::lib::Mocks::mock_preference("OpenURLResolverURL", "https://koha.example.com/");
138
    is(
147
    is(
139
        $biblio->get_openurl,
148
        $biblio->get_openurl,
140
- 

Return to bug 25913