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

Return to bug 18514