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

(-)a/C4/Biblio.pm (-1 / +2 lines)
Lines 923-934 Return the ISBD view which can be included in opac and intranet Link Here
923
sub GetISBDView {
923
sub GetISBDView {
924
    my ( $biblionumber, $template ) = @_;
924
    my ( $biblionumber, $template ) = @_;
925
    my $record   = GetMarcBiblio($biblionumber, 1);
925
    my $record   = GetMarcBiblio($biblionumber, 1);
926
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
926
    return unless defined $record;
927
    return unless defined $record;
927
    my $itemtype = &GetFrameworkCode($biblionumber);
928
    my $itemtype = &GetFrameworkCode($biblionumber);
928
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
929
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
929
    my $tagslib = &GetMarcStructure( 1, $itemtype );
930
    my $tagslib = &GetMarcStructure( 1, $itemtype );
930
931
931
    my $ISBD = C4::Context->preference('isbd');
932
    my $ISBD = C4::Context->preference($sysprefname);
932
    my $bloc = $ISBD;
933
    my $bloc = $ISBD;
933
    my $res;
934
    my $res;
934
    my $blocres;
935
    my $blocres;
(-)a/t/Biblio/Isbd.t (-1 / +50 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
use t::lib::Mocks qw( mock_preference );
24
25
BEGIN {
26
        use_ok('C4::Biblio');
27
}
28
29
my $dbh = C4::Context->dbh;
30
# Start transaction
31
$dbh->{AutoCommit} = 0;
32
$dbh->{RaiseError} = 1;
33
34
my $template = '#200|<h2>Title : |{200a}{ by 200f}|</h2>';
35
my $opac_template = '#200|<h2>Title : |{200a}{ (200f)}|</h2>';
36
t::lib::Mocks::mock_preference('isbd', $template);
37
t::lib::Mocks::mock_preference('opacisbd', $opac_template);
38
39
my $record = MARC::Record->new();
40
$record->append_fields(
41
    MARC::Field->new('200', '', '', 'a' => 'Montains'),
42
    MARC::Field->new('200', '', '', 'f' => 'Keith Lye'),
43
);
44
my ($bibnum, $title, $bibitemnum) = AddBiblio($record, '');
45
46
my $isbd = GetISBDView($bibnum);
47
is($isbd, '<h2>Title : Montains by Keith Lye</h2>', 'ISBD is correct');
48
49
my $opacisbd = GetISBDView($bibnum, 'opac');
50
is($opacisbd, '<h2>Title : Montains (Keith Lye)</h2>', 'OPAC ISBD is correct');

Return to bug 5979