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

(-)a/Koha/REST/V1/Borrowers.pm (-9 / +9 lines)
Lines 1-4 Link Here
1
package Koha::REST::V1::Borrowers;
1
package Koha::REST::V1::Patrons;
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
Lines 22-28 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use C4::Auth qw( haspermission );
22
use C4::Auth qw( haspermission );
23
use Koha::Borrowers;
23
use Koha::Borrowers;
24
24
25
sub list_borrowers {
25
sub list_patrons {
26
    my ($c, $args, $cb) = @_;
26
    my ($c, $args, $cb) = @_;
27
27
28
    my $user = $c->stash('koha.user');
28
    my $user = $c->stash('koha.user');
Lines 30-41 sub list_borrowers { Link Here
30
        return $c->$cb({error => "You don't have the required permission"}, 403);
30
        return $c->$cb({error => "You don't have the required permission"}, 403);
31
    }
31
    }
32
32
33
    my $borrowers = Koha::Borrowers->search;
33
    my $patrons = Koha::Borrowers->search;
34
34
35
    $c->$cb($borrowers->unblessed, 200);
35
    $c->$cb($patrons->unblessed, 200);
36
}
36
}
37
37
38
sub get_borrower {
38
sub get_patron {
39
    my ($c, $args, $cb) = @_;
39
    my ($c, $args, $cb) = @_;
40
40
41
    my $user = $c->stash('koha.user');
41
    my $user = $c->stash('koha.user');
Lines 47-58 sub get_borrower { Link Here
47
        return $c->$cb({error => "You don't have the required permission"}, 403);
47
        return $c->$cb({error => "You don't have the required permission"}, 403);
48
    }
48
    }
49
49
50
    my $borrower = Koha::Borrowers->find($args->{borrowernumber});
50
    my $patron = Koha::Borrowers->find($args->{borrowernumber});
51
    unless ($borrower) {
51
    unless ($patron) {
52
        return $c->$cb({error => "Borrower not found"}, 404);
52
        return $c->$cb({error => "Patron not found"}, 404);
53
    }
53
    }
54
54
55
    return $c->$cb($borrower->unblessed, 200);
55
    return $c->$cb($patron->unblessed, 200);
56
}
56
}
57
57
58
1;
58
1;
(-)a/api/v1/swagger.json (-20 / +208 lines)
Lines 14-34 Link Here
14
  },
14
  },
15
  "basePath": "/api/v1",
15
  "basePath": "/api/v1",
16
  "paths": {
16
  "paths": {
17
    "/borrowers": {
17
    "/patrons": {
18
      "get": {
18
      "get": {
19
        "x-mojo-controller": "Koha::REST::V1::Borrowers",
19
        "x-mojo-controller": "Koha::REST::V1::Patrons",
20
        "operationId": "listBorrowers",
20
        "operationId": "listPatrons",
21
        "tags": ["borrowers"],
21
        "tags": ["patrons"],
22
        "produces": [
22
        "produces": [
23
          "application/json"
23
          "application/json"
24
        ],
24
        ],
25
        "responses": {
25
        "responses": {
26
          "200": {
26
          "200": {
27
            "description": "A list of borrowers",
27
            "description": "A list of patrons",
28
            "schema": {
28
            "schema": {
29
              "type": "array",
29
              "type": "array",
30
              "items": {
30
              "items": {
31
                "$ref": "#/definitions/borrower"
31
                "$ref": "#/definitions/patron"
32
              }
32
              }
33
            }
33
            }
34
          },
34
          },
Lines 41-51 Link Here
41
        }
41
        }
42
      }
42
      }
43
    },
43
    },
44
    "/borrowers/{borrowernumber}": {
44
    "/patrons/{borrowernumber}": {
45
      "get": {
45
      "get": {
46
        "x-mojo-controller": "Koha::REST::V1::Borrowers",
46
        "x-mojo-controller": "Koha::REST::V1::Patrons",
47
        "operationId": "getBorrower",
47
        "operationId": "getPatron",
48
        "tags": ["borrowers"],
48
        "tags": ["patrons"],
49
        "parameters": [
49
        "parameters": [
50
          {
50
          {
51
            "$ref": "#/parameters/borrowernumberPathParam"
51
            "$ref": "#/parameters/borrowernumberPathParam"
Lines 56-64 Link Here
56
        ],
56
        ],
57
        "responses": {
57
        "responses": {
58
          "200": {
58
          "200": {
59
            "description": "A borrower",
59
            "description": "A patron",
60
            "schema": {
60
            "schema": {
61
              "$ref": "#/definitions/borrower"
61
              "$ref": "#/definitions/patron"
62
            }
62
            }
63
          },
63
          },
64
          "403": {
64
          "403": {
Lines 68-74 Link Here
68
            }
68
            }
69
          },
69
          },
70
          "404": {
70
          "404": {
71
            "description": "Borrower not found",
71
            "description": "Patron not found",
72
            "schema": {
72
            "schema": {
73
              "$ref": "#/definitions/error"
73
              "$ref": "#/definitions/error"
74
            }
74
            }
Lines 78-102 Link Here
78
    }
78
    }
79
  },
79
  },
80
  "definitions": {
80
  "definitions": {
81
    "borrower": {
81
    "patron": {
82
      "type": "object",
82
      "type": "object",
83
      "properties": {
83
      "properties": {
84
        "borrowernumber": {
84
        "borrowernumber": {
85
          "$ref": "#/definitions/borrowernumber"
85
          "$ref": "#/definitions/borrowernumber"
86
        },
86
        },
87
        "cardnumber": {
87
        "cardnumber": {
88
          "description": "library assigned ID number for borrowers"
88
          "description": "library assigned ID number for patrons"
89
        },
89
        },
90
        "surname": {
90
        "surname": {
91
          "description": "borrower's last name"
91
          "description": "patron's last name"
92
        },
92
        },
93
        "firstname": {
93
        "firstname": {
94
          "description": "borrower's first name"
94
          "description": "patron's first name"
95
        },
96
        "title": {
97
          "description": "patron's title"
98
        },
99
        "othernames": {
100
          "description": "any other names associated with the patron"
101
        },
102
        "initials": {
103
          "description": "initials of the patron"
104
        },
105
        "streetnumber": {
106
          "description": "street number of patron's primary address"
107
        },
108
        "streettype": {
109
          "description": "street type of patron's primary address"
110
        },
111
        "address": {
112
          "description": "first address line of patron's primary address"
113
        },
114
        "address2": {
115
          "description": "second address line of patron's primary address"
116
        },
117
        "city": {
118
          "description": "city or town of patron's primary address"
119
        },
120
        "state": {
121
          "description": "state or province of patron's primary address"
122
        },
123
        "zipcode": {
124
          "description": "zip or postal code of patron's primary address"
125
        },
126
        "country": {
127
          "description": "country of patron's primary address"
128
        },
129
        "email": {
130
          "description": "primary email address for patron's primary address"
131
        },
132
        "phone": {
133
          "description": "primary phone number for patron's primary address"
134
        },
135
        "mobile": {
136
          "description": "the other phone number for patron's primary address"
137
        },
138
        "fax": {
139
          "description": "fax number for patron's primary address"
140
        },
141
        "emailpro": {
142
          "description": "secondary email address for patron's primary address"
143
        },
144
        "phonepro": {
145
          "description": "secondary phone number for patron's primary address"
146
        },
147
        "B_streetnumber": {
148
          "description": "street number of patron's alternate address"
149
        },
150
        "B_streettype": {
151
          "description": "street type of patron's alternate address"
152
        },
153
        "B_address": {
154
          "description": "first address line of patron's alternate address"
155
        },
156
        "B_address2": {
157
          "description": "second address line of patron's alternate address"
158
        },
159
        "B_city": {
160
          "description": "city or town of patron's alternate address"
161
        },
162
        "B_state": {
163
          "description": "state or province of patron's alternate address"
164
        },
165
        "B_zipcode": {
166
          "description": "zip or postal code of patron's alternate address"
167
        },
168
        "B_country": {
169
          "description": "country of patron's alternate address"
170
        },
171
        "B_email": {
172
          "description": "email address for patron's alternate address"
173
        },
174
        "B_phone": {
175
          "description": "phone number for patron's alternate address"
176
        },
177
        "dateofbirth": {
178
          "description": "patron's date of birth"
179
        },
180
        "branchcode": {
181
          "description": "code of patron's home branch"
182
        },
183
        "categorycode": {
184
          "description": "code of patron's category"
185
        },
186
        "dateenrolled": {
187
          "description": "date the patron was added to Koha"
188
        },
189
        "dateexpiry": {
190
          "description": "date the patron's card is set to expire"
191
        },
192
        "gonenoaddress": {
193
          "description": "set to 1 if library marked this patron as having an unconfirmed address"
194
        },
195
        "lost": {
196
          "description": "set to 1 if library marked this patron as having lost his card"
197
        },
198
        "debarred": {
199
          "description": "until this date the patron can only check-in"
200
        },
201
        "debarredcomment": {
202
          "description": "comment on the stop of the patron"
203
        },
204
        "contactname": {
205
          "description": "used for children and professionals to include surname or last name of guarantor or organization name"
206
        },
207
        "contactfirstname": {
208
          "description": "used for children to include first name of guarantor"
209
        },
210
        "contacttitle": {
211
          "description": "used for children to include title of guarantor"
212
        },
213
        "guarantorid": {
214
          "description": "borrowernumber used for children or professionals to link them to guarantor or organizations"
215
        },
216
        "borrowernotes": {
217
          "description": "a note on the patron's account"
218
        },
219
        "relationship": {
220
          "description": "used for children to include the relationship to their guarantor"
221
        },
222
        "ethnicity": {
223
          "description": "unused"
224
        },
225
        "ethnotes": {
226
          "description": "unused"
227
        },
228
        "sex": {
229
          "description": "patron's gender"
230
        },
231
        "password": {
232
          "description": "patron's encrypted password"
233
        },
234
        "flags": {
235
          "description": "a number associated with the patron's permissions"
236
        },
237
        "userid": {
238
          "description": "patron's login"
239
        },
240
        "opacnote": {
241
          "description": "a note on the patron's account visible in OPAC and staff client"
242
        },
243
        "contactnote": {
244
          "description": "a note related to patron's alternate address"
245
        },
246
        "sort1": {
247
          "description": "a field that can be used for any information unique to the library"
248
        },
249
        "sort2": {
250
          "description": "a field that can be used for any information unique to the library"
251
        },
252
        "altcontactfirstname": {
253
          "description": "first name of alternate contact for the patron"
254
        },
255
        "altcontactsurname": {
256
          "description": "surname or last name of the alternate contact for the patron"
257
        },
258
        "altcontactaddress1": {
259
          "description": "the first address line for the alternate contact for the patron"
260
        },
261
        "altcontactaddress2": {
262
          "description": "the second address line for the alternate contact for the patron"
263
        },
264
        "altcontactaddress3": {
265
          "description": "the city for the alternate contact for the patron"
266
        },
267
        "altcontactstate": {
268
          "description": "the state for the alternate contact for the patron"
269
        },
270
        "altcontactzipcode": {
271
          "description": "the zipcode for the alternate contact for the patron"
272
        },
273
        "altcontactcountry": {
274
          "description": "the country for the alternate contact for the patron"
275
        },
276
        "altcontactphone": {
277
          "description": "the phone number for the alternate contact for the patron"
278
        },
279
        "smsalertnumber": {
280
          "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)"
281
        },
282
        "privacy": {
283
          "description": "patron's privacy settings related to their reading history"
95
        }
284
        }
96
      }
285
      }
97
    },
286
    },
98
    "borrowernumber": {
287
    "borrowernumber": {
99
      "description": "Borrower internal identifier"
288
      "description": "Patron internal identifier"
100
    },
289
    },
101
    "error": {
290
    "error": {
102
      "type": "object",
291
      "type": "object",
Lines 112-118 Link Here
112
    "borrowernumberPathParam": {
301
    "borrowernumberPathParam": {
113
      "name": "borrowernumber",
302
      "name": "borrowernumber",
114
      "in": "path",
303
      "in": "path",
115
      "description": "Internal borrower identifier",
304
      "description": "Internal patron identifier",
116
      "required": true,
305
      "required": true,
117
      "type": "integer"
306
      "type": "integer"
118
    }
307
    }
119
- 

Return to bug 13799