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

(-)a/Koha/Biblio.pm (+21 lines)
Lines 61-66 sub store { Link Here
61
    return $self->SUPER::store;
61
    return $self->SUPER::store;
62
}
62
}
63
63
64
=head3 marc
65
66
my @marc = $biblio->marc($params);
67
68
Returns a MARC::Record object for a record.
69
70
This method accepts the same paramters as C4::Biblio::GetMarcBiblio,
71
but does not require the 'biblionumber' parameter.
72
73
=cut
74
75
sub marc {
76
    my ( $self, $params ) = @_;
77
78
    $params->{biblionumber} = $self->id;
79
80
    my $marc = C4::Biblio::GetMarcBiblio($params);
81
82
    return $marc;
83
}
84
64
=head3 subtitles
85
=head3 subtitles
65
86
66
my @subtitles = $biblio->subtitles();
87
my @subtitles = $biblio->subtitles();
(-)a/t/db_dependent/Koha/Biblio.t (-1 / +57 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 3;
21
use Test::MockModule;
22
use MARC::Record;
23
24
use t::lib::TestBuilder;
25
26
use C4::Biblio;
27
use Koha::Database;
28
29
BEGIN {
30
    use_ok('Koha::Biblio');
31
    use_ok('Koha::Biblios');
32
}
33
34
my $schema = Koha::Database->new->schema;
35
$schema->storage->txn_begin;
36
my $dbh = C4::Context->dbh;
37
38
subtest 'MarcFieldForCreatorAndModifier' => sub {
39
    plan tests => 3;
40
41
    my $title = 'Oranges and Peaches';
42
43
    my $record = MARC::Record->new();
44
    my $field = MARC::Field->new('245','','','a' => $title);
45
    $record->append_fields( $field );
46
    my ($biblionumber) = C4::Biblio::AddBiblio($record, '');
47
48
    my $biblio = Koha::Biblios->find( $biblionumber );
49
    is( ref $biblio, 'Koha::Biblio', 'Found a Koha::Biblio object' );
50
51
    my $marc = $biblio->marc();
52
    is( ref $marc, 'MARC::Record', 'Method marc() returned a MARC::Record object' );
53
54
    is( $marc->field('245')->subfield("a"), $title, 'Title in 245$a matches title from original record object' );
55
};
56
57
$schema->storage->txn_rollback;

Return to bug 22144