Bug 17278: Fix "show all items" link
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 3 Oct 2016 11:27:21 +0000 (12:27 +0100)
committerMason James <mtj@kohaaloha.com>
Wed, 22 Nov 2017 09:10:01 +0000 (22:10 +1300)
Then we need to remove the "available" part from the query.
They are really awkward patches...

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>

C4/Search.pm

index f965996..79a106c 100644 (file)
@@ -1473,6 +1473,10 @@ sub buildQuery {
         # this happens when selecting a subject on the opac-detail page
         @limits = grep {!/^$/} @limits;
         my $original_q = $q; # without available part
+        unless ( grep { /^available$/ } @limits ) {
+            $q =~ s| and \( \( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:''\) and \(lost,st-numeric=0\) \)||;
+            $original_q = $q;
+        }
         if ( @limits ) {
             if ( grep { /^available$/ } @limits ) {
                 $q .= q| and ( ( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:'') and (lost,st-numeric=0) )|;