Bug 17602: Handle '60+' if there are more than 60 results
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 8 Nov 2017 13:06:49 +0000 (10:06 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 1 Oct 2018 13:56:55 +0000 (13:56 +0000)
The service returns "60+" if there are more than 60 results.
Without this patch the "Found %s results in RecordedBooks collection"
line is removed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt

index 0bab09f..d22685b 100644 (file)
@@ -913,7 +913,8 @@ $(document).ready(function(){
                 return;
             }
 
-            if ( data.total > 0 ) {
+            // data.total can be either 42 or "60+"
+            if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) {
                 $recordedbooks_results.html( _( "Found %s results in RecordedBooks collection" ).format('<a href="/cgi-bin/koha/opac-recordedbooks-search.pl?q=' + escape( querystring ) + '">' + data.total + '</a>') );
             } else {
                 $recordedbooks_results.remove();