Bug 32426: Throw InvalidUserid exception in Patron->store
[koha-ffzg.git] / Koha / SearchFilter.pm
index f400a8f..3683a89 100644 (file)
@@ -15,7 +15,7 @@ package Koha::SearchFilter;
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-
+use JSON qw( encode_json decode_json );
 
 use Koha::Database;
 
@@ -29,24 +29,12 @@ Koha::SearchFilter - Koha Search filter object class
 
 =head2 Class methods
 
-=head3 to_api_mapping
-
-=cut
-
-sub to_api_mapping {
-    return {
-        id                  => 'search_filter_id',
-        query               => 'filter_query',
-        limits              => 'filter_limits',
-    };
-}
-
 =head3 expand_filter
 
-    my $expanded_filter = $filter->expand_filter;
+    my ($expanded_limit, $query_limit) = $filter->expand_filter;
 
-    Returns the filter as an arrayref of limit queries suitable to
-    be passed to QueryBuilder
+    Returns the filter as an arrayref of limit queries, and the query parts combined
+    into a string suitable to be passed to QueryBuilder
 
 =cut
 
@@ -74,9 +62,7 @@ sub expand_filter {
         $query_limit .= $limit;
     }
 
-    push @$limits, "(".$query_limit.")" if $query_limit;
-
-    return $limits;
+    return ($limits, $query_limit);
 }
 
 =head2 Internal methods