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

(-)a/Koha/Patron.pm (+3 lines)
Lines 2150-2155 sub to_api { Link Here
2150
                                    ? Mojo::JSON->true
2150
                                    ? Mojo::JSON->true
2151
                                    : Mojo::JSON->false;
2151
                                    : Mojo::JSON->false;
2152
2152
2153
    # FIXME: introduced by Koha::Patrons->filter_by_amount_owed
2154
    delete $json_patron->{outstanding};
2155
2153
    return $json_patron;
2156
    return $json_patron;
2154
}
2157
}
2155
2158
(-)a/Koha/REST/V1/Patrons.pm (-5 / +17 lines)
Lines 46-66 sub list { Link Here
46
46
47
    return try {
47
    return try {
48
48
49
        my $query = {};
49
        my $query      = {};
50
        my $restricted = $c->param('restricted');
50
        my $restricted = $c->param('restricted');
51
        $c->req->params->remove('restricted');
51
        $c->req->params->remove('restricted');
52
        $query->{debarred} = { '!=' => undef }
52
        $query->{debarred} = { '!=' => undef }
53
            if $restricted;
53
            if $restricted;
54
54
55
        my $owes_less_than = $c->param('owes_less_than');
56
        my $owes_more_than = $c->param('owes_more_than');
57
        $c->req->params->remove('owes_less_than')->remove('owes_more_than');
58
55
        my $patrons_rs = Koha::Patrons->search($query);
59
        my $patrons_rs = Koha::Patrons->search($query);
56
        my $patrons    = $c->objects->search( $patrons_rs );
60
61
        if ( defined $owes_less_than || defined $owes_more_than ) {
62
63
            $patrons_rs = $patrons_rs->filter_by_amount_owed(
64
                {
65
                    less_than => $owes_less_than,
66
                    more_than => $owes_more_than,
67
                }
68
            );
69
        }
57
70
58
        return $c->render(
71
        return $c->render(
59
            status  => 200,
72
            status  => 200,
60
            openapi => $patrons
73
            openapi => $c->objects->search($patrons_rs),
61
        );
74
        );
62
    }
75
    } catch {
63
    catch {
64
        $c->unhandled_exception($_);
76
        $c->unhandled_exception($_);
65
    };
77
    };
66
}
78
}
(-)a/api/v1/swagger/paths/patrons.yaml (-1 / +10 lines)
Lines 339-344 Link Here
339
        description: Search on login_attempts
339
        description: Search on login_attempts
340
        required: false
340
        required: false
341
        type: string
341
        type: string
342
      - name: owes_less_than
343
        in: query
344
        description: Pick patrons owing less than the passed amount
345
        type: number
346
        required: false
347
      - name: owes_more_than
348
        in: query
349
        description: Pick patrons owing more than the passed amount
350
        type: number
351
        required: false
342
      - $ref: "../swagger.yaml#/parameters/match"
352
      - $ref: "../swagger.yaml#/parameters/match"
343
      - $ref: "../swagger.yaml#/parameters/order_by"
353
      - $ref: "../swagger.yaml#/parameters/order_by"
344
      - $ref: "../swagger.yaml#/parameters/page"
354
      - $ref: "../swagger.yaml#/parameters/page"
345
- 

Return to bug 34277