[Koha-bugs] [Bug 19234] Add query parameters handling helpers

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Sep 8 16:13:47 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19234

--- Comment #5 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 66992
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66992&action=edit
Bug 19234: Add query parameters handling helpers

This patch introduces a Mojolicious plugin to be used on the REST api.
It adds a helper method:

generate_dbic_query
===================

When used, it generates what's needed to perform a search on
DBIC/Koha::Objects like this:

    my $params  = $c->validation->output;
    my ($filter, $attributes) = $c->generate_dbic_query($params);
    my $patrons = Koha::Patrons->search( $filter, $attributes );

It introduces a reserved word _exact_match that controls the generated
$filter:
- Default behaviour: right truncation on the query params
- _exact_match=1: no truncation added.

All the plugin's behaviour is tested.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass!
- Sign off :-D

Sponsored-by: ByWater solutions
Sponsored-by: Camden County

Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list