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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-1 / +1 lines)
Lines 885-891 $(document).ready(function(){ Link Here
885
        $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
885
        $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
886
        $("#highlight_toggle_off").show().click(function() {highlightOff();});
886
        $("#highlight_toggle_off").show().click(function() {highlightOff();});
887
    [% END %]
887
    [% END %]
888
    [% IF ( OverDriveEnabled ) %]
888
    [% IF ( OverDriveEnabled ) && Koha.Preference('SearchEngine') != 'Elasticsearch' %]
889
        var $overdrive_results = $( '<div id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
889
        var $overdrive_results = $( '<div id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
890
        $( '#numresults' ) .append( ' ' )
890
        $( '#numresults' ) .append( ' ' )
891
            .append( $overdrive_results );
891
            .append( $overdrive_results );
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (+1 lines)
Lines 414-419 Link Here
414
                </xsl:with-param>
414
                </xsl:with-param>
415
            </xsl:call-template>
415
            </xsl:call-template>
416
            <xsl:value-of select="$biblionumber"/>
416
            <xsl:value-of select="$biblionumber"/>
417
            <xsl:if test="marc:datafield[@tag=999]/marc:subfield[@code='a']='ExtOverdrive'">&amp;externalsource=overdrive</xsl:if>
417
        </xsl:attribute>
418
        </xsl:attribute>
418
        <xsl:attribute name="class">title</xsl:attribute>
419
        <xsl:attribute name="class">title</xsl:attribute>
419
420
(-)a/opac/opac-detail.pl (-10 / +53 lines)
Lines 74-93 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
74
);
74
);
75
75
76
my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
76
my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
77
$biblionumber = int($biblionumber);
78
77
79
my @all_items = GetItemsInfo($biblionumber);
78
my $external = $query->param('externalsource'); #is this record present in the db, or has come from external
79
80
my $record;
81
my @all_items;
80
my @hiddenitems;
82
my @hiddenitems;
81
if (scalar @all_items >= 1) {
82
    push @hiddenitems, GetHiddenItemnumbers(@all_items);
83
83
84
    if (scalar @hiddenitems == scalar @all_items ) {
84
# Move this to a module
85
        print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
85
sub convert_od_marc {
86
        exit;
86
    # neeeds to work for other than marc21 too
87
    }
87
    my $data = shift;
88
    my $marc = MARC::Record->new();
89
    $marc->add_fields(
90
        [ 245, "1", " ", a => $data->{title}, b => $data->{subtitle} ],
91
        [ 100, "",  "",  a => $data->{'author'} ],
92
        [ 260, "",  "",  a => $data->{'publisher'} ],
93
        [ 999, "", "", c => $data->{'id'} ],
94
        [ 999, "", "", d => $data->{'id'} ],
95
    );
96
    return $marc;
97
}
98
99
if ( $external && $external eq 'overdrive' ) {
100
# We are looking at a record from overdrive, not a marc record in Koha
101
    require Koha::ExternalContent::OverDrive;
102
    import Koha::ExternalContent::OverDrive;
103
    require WebService::ILS::OverDrive::Library;
104
    import WebService::ILS::OverDrive::Library;
105
    my $client_id     = C4::Context->preference('OverDriveClientKey');
106
    my $client_secret = C4::Context->preference('OverDriveClientSecret');
107
    my $library_id    = C4::Context->preference('OverDriveLibraryID');
108
    my $od_client = WebService::ILS::OverDrive::Library->new(
109
        {
110
                test          => 1,
111
                client_id     => $client_id,
112
                client_secret => $client_secret,
113
                library_id    => $library_id
114
        }
115
    );
116
    my $data = $od_client->item_metadata($biblionumber);
117
    $record = convert_od_marc($data);
88
}
118
}
119
else {
120
# Normal record in Koha
121
    $biblionumber = int($biblionumber);
122
    @all_items = GetItemsInfo($biblionumber);
123
    @hiddenitems;
124
    if (scalar @all_items >= 1) {
125
        push @hiddenitems, GetHiddenItemnumbers(@all_items);
126
127
        if (scalar @hiddenitems == scalar @all_items ) {
128
            print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
129
            exit;
130
        }
131
    }
89
132
90
my $record = GetMarcBiblio($biblionumber);
133
    my $record = GetMarcBiblio($biblionumber);
134
}
91
if ( ! $record ) {
135
if ( ! $record ) {
92
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
136
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
93
    exit;
137
    exit;
94
- 

Return to bug 18514