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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-3 / +7 lines)
Lines 919-932 Link Here
919
                    var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
919
                    var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
920
                    $( '#numresults' ) .append( ' ' )
920
                    $( '#numresults' ) .append( ' ' )
921
                        .append( $overdrive_results );
921
                        .append( $overdrive_results );
922
                    KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", querystring, 1, 0, function( data ) {
922
                    //Clean querystring, first we remove CCL entities, then decode HTML entities, then swap double quotes for single quotes
923
                    //as the overdrive API treats double quotes as a search term and returns extra results
924
                    od_querystring = querystring.replace(/(?:^|\W)([\w-]+)(,[\w-]+)*([:=])/g,' ');
925
                    od_querystring = new DOMParser().parseFromString( od_querystring, 'text/html').body.innerText;
926
                    od_querystring = od_querystring.replace(/\"/g,"'");
927
                    KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", od_querystring, 1, 0, function( data ) {
923
                        if ( data.error ) {
928
                        if ( data.error ) {
924
                            $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') );
929
                            $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') );
925
                            return;
930
                            return;
926
                        }
931
                        }
927
932
928
                        if ( data.totalItems ) {
933
                        if ( data.totalItems ) {
929
                            $overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' );
934
                            $overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( od_querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' );
930
                        } else {
935
                        } else {
931
                            $overdrive_results.remove();
936
                            $overdrive_results.remove();
932
                        }
937
                        }
933
- 

Return to bug 26578