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

(-)a/Koha/REST/V1/Accountline.pm (+39 lines)
Line 0 Link Here
1
package Koha::REST::V1::Accountline;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Mojo::Base 'Mojolicious::Controller';
21
22
use C4::Auth qw( haspermission );
23
use Koha::Account::Lines;
24
25
sub list {
26
    my ($c, $args, $cb) = @_;
27
28
    my $user = $c->stash('koha.user');
29
    unless ($user && haspermission($user->userid, {updatecharges => 1})) {
30
        return $c->$cb({error => "You don't have the required permission"}, 403);
31
    }
32
33
    my $params  = $c->req->params->to_hash;
34
    my $accountlines = Koha::Account::Lines->search($params);
35
36
    return $c->$cb($accountlines->unblessed, 200);
37
}
38
39
1;
(-)a/api/v1/swagger/definitions.json (+3 lines)
Lines 1-4 Link Here
1
{
1
{
2
  "accountline": {
3
    "$ref": "definitions/accountline.json"
4
  },
2
  "patron": {
5
  "patron": {
3
    "$ref": "definitions/patron.json"
6
    "$ref": "definitions/patron.json"
4
  },
7
  },
(-)a/api/v1/swagger/definitions/accountline.json (+56 lines)
Line 0 Link Here
1
{
2
  "type": "object",
3
  "properties": {
4
    "accountlines_id": {
5
      "description": "Internal account line identifier"
6
    },
7
    "borrowernumber": {
8
      "description": "Internal borrower identifier"
9
    },
10
    "accountno": {
11
      "description": "?"
12
    },
13
    "itemnumber": {
14
      "description": "Internal item identifier"
15
    },
16
    "date": {
17
      "description": "Date when the account line was created"
18
    },
19
    "time": {
20
      "description": "Time when the account line was created"
21
    },
22
    "amount": {
23
      "description": "Amount"
24
    },
25
    "description": {
26
      "description": "Description of account line"
27
    },
28
    "accounttype": {
29
      "description": "Type of accountline"
30
    },
31
    "amountoutstanding": {
32
      "description": "Amount outstanding"
33
    },
34
    "lastincrement": {
35
      "description": "?"
36
    },
37
    "timestamp": {
38
      "description": "When the account line was last updated"
39
    },
40
    "notify_id": {
41
      "description": "?"
42
    },
43
    "notify_level": {
44
      "description": "?"
45
    },
46
    "note": {
47
      "description": "Accountline note"
48
    },
49
    "manager_id": {
50
      "description": "Borrowernumber of user that created the account line"
51
    },
52
    "meansofpayment": {
53
      "description": "Means of payment"
54
    }
55
  }
56
}
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 1-4 Link Here
1
{
1
{
2
  "/accountlines": {
3
    "$ref": "paths/accountlines.json#/~1accountlines"
4
  },
2
  "/holds": {
5
  "/holds": {
3
    "$ref": "paths/holds.json#/~1holds"
6
    "$ref": "paths/holds.json#/~1holds"
4
  },
7
  },
(-)a/api/v1/swagger/paths/accountlines.json (+28 lines)
Line 0 Link Here
1
{
2
  "/accountlines": {
3
    "get": {
4
      "operationId": "listAccountlines",
5
      "tags": ["accountlines"],
6
      "produces": [
7
        "application/json"
8
      ],
9
      "responses": {
10
        "200": {
11
          "description": "A list of accountlines",
12
          "schema": {
13
            "type": "array",
14
            "items": {
15
              "$ref": "../definitions.json#/accountline"
16
            }
17
          }
18
        },
19
        "403": {
20
          "description": "Access forbidden",
21
          "schema": {
22
            "$ref": "../definitions.json#/error"
23
          }
24
        }
25
      }
26
    }
27
  }
28
}
(-)a/api/v1/swagger/swagger.min.json (-1 / +1 lines)
Line 1 Link Here
1
{"definitions":{"error":{"properties":{"error":{"description":"Error message","type":"string"}},"type":"object"},"hold":{"properties":{"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"expirationdate":{"description":"the date the hold expires"},"reservedate":{"description":"the date the hold was placed"},"priority":{"description":"where in the queue the patron sits"},"biblionumber":{"type":"string","description":"internally assigned biblio identifier"},"branchcode":{"type":["string","null"],"description":"internally assigned branch identifier"},"reservenotes":{"description":"notes related to this hold"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"timestamp":{"description":"date and time the hold was last updated"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend":{"description":""},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"suspend_until":{"description":""},"reserve_id":{"description":"Internal hold identifier"},"notificationdate":{"description":"currently unused"}},"type":"object"},"holds":{"type":"array","items":{"type":"object","properties":{"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"expirationdate":{"description":"the date the hold expires"},"reservedate":{"description":"the date the hold was placed"},"priority":{"description":"where in the queue the patron sits"},"biblionumber":{"type":"string","description":"internally assigned biblio identifier"},"branchcode":{"type":["string","null"],"description":"internally assigned branch identifier"},"reservenotes":{"description":"notes related to this hold"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"timestamp":{"description":"date and time the hold was last updated"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend":{"description":""},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"suspend_until":{"description":""},"reserve_id":{"description":"Internal hold identifier"},"notificationdate":{"description":"currently unused"}}}},"patron":{"properties":{"gonenoaddress":{"type":["string","null"],"description":"set to 1 if library marked this patron as having an unconfirmed address"},"address":{"type":"string","description":"first address line of patron's primary address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"lost":{"description":"set to 1 if library marked this patron as having lost his card","type":["string","null"]},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"fax":{"type":["string","null"],"description":"fax number for patron's primary address"},"city":{"type":"string","description":"city or town of patron's primary address"},"sex":{"type":["string","null"],"description":"patron's gender"},"categorycode":{"type":"string","description":"code of patron's category"},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"title":{"type":["string","null"],"description":"patron's title"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"altcontactphone":{"type":["string","null"],"description":"the phone number for the alternate contact for the patron"},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"surname":{"description":"patron's last name","type":"string"},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"phonepro":{"description":"secondary phone number for patron's primary address","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"altcontactsurname":{"description":"surname or last name of the alternate contact for the patron","type":["string","null"]},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"emailpro":{"description":"secondary email address for patron's primary address","type":["string","null"]},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"branchcode":{"type":"string","description":"code of patron's home branch"},"userid":{"type":["string","null"],"description":"patron's login"},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"privacy":{"description":"patron's privacy settings related to their reading history","type":"string"},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"checkprevcheckout":{"description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'","type":"string"},"initials":{"type":["string","null"],"description":"initials of the patron"},"B_city":{"type":["string","null"],"description":"city or town of patron's alternate address"},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactaddress3":{"description":"the city for the alternate contact for the patron","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"firstname":{"type":["string","null"],"description":"patron's first name"},"dateenrolled":{"description":"date the patron was added to Koha","type":["string","null"]},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]}},"type":"object"}},"paths":{"\/patrons\/{borrowernumber}":{"get":{"operationId":"getPatron","tags":["patrons"],"produces":["application\/json"],"parameters":[{"description":"Internal patron identifier","type":"integer","required":true,"in":"path","name":"borrowernumber"}],"responses":{"404":{"description":"Patron not found","schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}}},"200":{"schema":{"type":"object","properties":{"gonenoaddress":{"type":["string","null"],"description":"set to 1 if library marked this patron as having an unconfirmed address"},"address":{"type":"string","description":"first address line of patron's primary address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"lost":{"description":"set to 1 if library marked this patron as having lost his card","type":["string","null"]},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"fax":{"type":["string","null"],"description":"fax number for patron's primary address"},"city":{"type":"string","description":"city or town of patron's primary address"},"sex":{"type":["string","null"],"description":"patron's gender"},"categorycode":{"type":"string","description":"code of patron's category"},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"title":{"type":["string","null"],"description":"patron's title"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"altcontactphone":{"type":["string","null"],"description":"the phone number for the alternate contact for the patron"},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"surname":{"description":"patron's last name","type":"string"},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"phonepro":{"description":"secondary phone number for patron's primary address","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"altcontactsurname":{"description":"surname or last name of the alternate contact for the patron","type":["string","null"]},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"emailpro":{"description":"secondary email address for patron's primary address","type":["string","null"]},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"branchcode":{"type":"string","description":"code of patron's home branch"},"userid":{"type":["string","null"],"description":"patron's login"},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"privacy":{"description":"patron's privacy settings related to their reading history","type":"string"},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"checkprevcheckout":{"description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'","type":"string"},"initials":{"type":["string","null"],"description":"initials of the patron"},"B_city":{"type":["string","null"],"description":"city or town of patron's alternate address"},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactaddress3":{"description":"the city for the alternate contact for the patron","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"firstname":{"type":["string","null"],"description":"patron's first name"},"dateenrolled":{"description":"date the patron was added to Koha","type":["string","null"]},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]}}},"description":"A patron"},"403":{"description":"Access forbidden","schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}}}}}},"\/patrons":{"get":{"tags":["patrons"],"produces":["application\/json"],"responses":{"200":{"schema":{"items":{"properties":{"gonenoaddress":{"type":["string","null"],"description":"set to 1 if library marked this patron as having an unconfirmed address"},"address":{"type":"string","description":"first address line of patron's primary address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"lost":{"description":"set to 1 if library marked this patron as having lost his card","type":["string","null"]},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"fax":{"type":["string","null"],"description":"fax number for patron's primary address"},"city":{"type":"string","description":"city or town of patron's primary address"},"sex":{"type":["string","null"],"description":"patron's gender"},"categorycode":{"type":"string","description":"code of patron's category"},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"title":{"type":["string","null"],"description":"patron's title"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"altcontactphone":{"type":["string","null"],"description":"the phone number for the alternate contact for the patron"},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"surname":{"description":"patron's last name","type":"string"},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"phonepro":{"description":"secondary phone number for patron's primary address","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"altcontactsurname":{"description":"surname or last name of the alternate contact for the patron","type":["string","null"]},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"emailpro":{"description":"secondary email address for patron's primary address","type":["string","null"]},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"branchcode":{"type":"string","description":"code of patron's home branch"},"userid":{"type":["string","null"],"description":"patron's login"},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"privacy":{"description":"patron's privacy settings related to their reading history","type":"string"},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"checkprevcheckout":{"description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'","type":"string"},"initials":{"type":["string","null"],"description":"initials of the patron"},"B_city":{"type":["string","null"],"description":"city or town of patron's alternate address"},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactaddress3":{"description":"the city for the alternate contact for the patron","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"firstname":{"type":["string","null"],"description":"patron's first name"},"dateenrolled":{"description":"date the patron was added to Koha","type":["string","null"]},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]}},"type":"object"},"type":"array"},"description":"A list of patrons"},"403":{"description":"Access forbidden","schema":{"properties":{"error":{"description":"Error message","type":"string"}},"type":"object"}}},"operationId":"listPatrons"}},"\/holds":{"post":{"tags":["borrowers","holds"],"produces":["application\/json"],"parameters":[{"schema":{"properties":{"biblionumber":{"type":"integer","description":"Biblio internal identifier"},"branchcode":{"type":"string","description":"Pickup location"},"itemnumber":{"type":"integer","description":"Item internal identifier"},"expirationdate":{"type":"string","description":"Hold end date","format":"date"},"borrowernumber":{"description":"Borrower internal identifier","type":"integer"}},"type":"object"},"description":"A JSON object containing informations about the new hold","name":"body","in":"body","required":true}],"responses":{"403":{"description":"Hold not allowed","schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}}},"404":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Borrower not found"},"400":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Missing or wrong parameters"},"500":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Internal error"},"201":{"description":"Created hold","schema":{"properties":{"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"expirationdate":{"description":"the date the hold expires"},"reservedate":{"description":"the date the hold was placed"},"priority":{"description":"where in the queue the patron sits"},"biblionumber":{"type":"string","description":"internally assigned biblio identifier"},"branchcode":{"type":["string","null"],"description":"internally assigned branch identifier"},"reservenotes":{"description":"notes related to this hold"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"timestamp":{"description":"date and time the hold was last updated"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend":{"description":""},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"suspend_until":{"description":""},"reserve_id":{"description":"Internal hold identifier"},"notificationdate":{"description":"currently unused"}},"type":"object"}}},"consumes":["application\/json"],"operationId":"addHold"},"get":{"operationId":"listHolds","tags":["borrowers","holds"],"produces":["application\/json"],"parameters":[{"description":"Internal reserve identifier","type":"integer","in":"query","name":"reserve_id"},{"description":"Internal borrower identifier","type":"integer","name":"borrowernumber","in":"query"},{"type":"string","description":"Reserve date","in":"query","name":"reservedate"},{"type":"integer","description":"Internal biblio identifier","in":"query","name":"biblionumber"},{"in":"query","name":"branchcode","description":"Branch code","type":"string"},{"type":"string","description":"Notification date","in":"query","name":"notificationdate"},{"name":"reminderdate","in":"query","type":"string","description":"Reminder date"},{"in":"query","name":"cancellationdate","type":"string","description":"Cancellation date"},{"description":"Reserve notes","type":"string","in":"query","name":"reservenotes"},{"description":"Priority","type":"integer","name":"priority","in":"query"},{"description":"Found status","type":"string","name":"found","in":"query"},{"description":"Time of latest update","type":"string","in":"query","name":"timestamp"},{"type":"integer","description":"Internal item identifier","name":"itemnumber","in":"query"},{"type":"string","description":"Date the item was marked as waiting for the patron","name":"waitingdate","in":"query"},{"description":"Date the hold expires","type":"string","in":"query","name":"expirationdate"},{"description":"Lowest priority","type":"integer","in":"query","name":"lowestPriority"},{"in":"query","name":"suspend","type":"integer","description":"Suspended"},{"name":"suspend_until","in":"query","description":"Suspended until","type":"string"}],"responses":{"404":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Borrower not found"},"200":{"schema":{"type":"array","items":{"type":"object","properties":{"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"expirationdate":{"description":"the date the hold expires"},"reservedate":{"description":"the date the hold was placed"},"priority":{"description":"where in the queue the patron sits"},"biblionumber":{"type":"string","description":"internally assigned biblio identifier"},"branchcode":{"type":["string","null"],"description":"internally assigned branch identifier"},"reservenotes":{"description":"notes related to this hold"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"timestamp":{"description":"date and time the hold was last updated"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend":{"description":""},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"suspend_until":{"description":""},"reserve_id":{"description":"Internal hold identifier"},"notificationdate":{"description":"currently unused"}}}},"description":"A list of holds"}}}},"\/holds\/{reserve_id}":{"put":{"consumes":["application\/json"],"operationId":"editHold","tags":["holds"],"produces":["application\/json"],"parameters":[{"description":"Internal hold identifier","type":"integer","required":true,"in":"path","name":"reserve_id"},{"name":"body","in":"body","required":true,"schema":{"properties":{"branchcode":{"type":"string","description":"Pickup location"},"suspend_until":{"description":"Suspend until","type":"string","format":"date"},"priority":{"type":"integer","description":"Position in waiting queue","minimum":1}},"type":"object"},"description":"A JSON object containing fields to modify"}],"responses":{"404":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Hold not found"},"400":{"description":"Missing or wrong parameters","schema":{"properties":{"error":{"description":"Error message","type":"string"}},"type":"object"}},"200":{"schema":{"type":"object","properties":{"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"expirationdate":{"description":"the date the hold expires"},"reservedate":{"description":"the date the hold was placed"},"priority":{"description":"where in the queue the patron sits"},"biblionumber":{"type":"string","description":"internally assigned biblio identifier"},"branchcode":{"type":["string","null"],"description":"internally assigned branch identifier"},"reservenotes":{"description":"notes related to this hold"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"timestamp":{"description":"date and time the hold was last updated"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend":{"description":""},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"suspend_until":{"description":""},"reserve_id":{"description":"Internal hold identifier"},"notificationdate":{"description":"currently unused"}}},"description":"Updated hold"}}},"delete":{"parameters":[{"description":"Internal hold identifier","type":"integer","required":true,"in":"path","name":"reserve_id"}],"responses":{"404":{"schema":{"type":"object","properties":{"error":{"description":"Error message","type":"string"}}},"description":"Hold not found"},"200":{"description":"Successful deletion","schema":{"type":"object"}}},"tags":["holds"],"produces":["application\/json"],"operationId":"deleteHold"}}},"info":{"title":"Koha REST API","license":{"name":"GPL v3","url":"http:\/\/www.gnu.org\/licenses\/gpl.txt"},"contact":{"url":"http:\/\/koha-community.org\/","name":"Koha Team"},"version":"1"},"swagger":"2.0","parameters":{"borrowernumberPathParam":{"description":"Internal patron identifier","type":"integer","required":true,"in":"path","name":"borrowernumber"},"holdIdPathParam":{"description":"Internal hold identifier","type":"integer","required":true,"in":"path","name":"reserve_id"}},"basePath":"\/api\/v1"}
1
{"parameters":{"borrowernumberPathParam":{"name":"borrowernumber","in":"path","required":true,"type":"integer","description":"Internal patron identifier"},"borrowernumberQueryParam":{"in":"query","name":"borrowernumber","type":"integer","description":"Internal borrower identifier"},"holdIdPathParam":{"name":"reserve_id","in":"path","required":true,"type":"integer","description":"Internal hold identifier"}},"x-primitives":{"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"surname":{"type":"string","description":"patron's last name"},"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"itemnumber":{"type":["string","null"],"description":"internally assigned item identifier"},"firstname":{"description":"patron's first name","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"cardnumber":{"description":"library assigned user identifier","type":["string","null"]},"email":{"type":["string","null"],"description":"primary email address for patron's primary address"}},"basePath":"\/api\/v1","paths":{"\/patrons\/{borrowernumber}":{"get":{"produces":["application\/json"],"tags":["patrons"],"responses":{"404":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"description":"Patron not found"},"200":{"description":"A patron","schema":{"properties":{"dateofbirth":{"type":["string","null"],"description":"patron's date of birth"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"title":{"description":"patron's title","type":["string","null"]},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"dateexpiry":{"description":"date the patron's card is set to expire","type":["string","null"]},"emailpro":{"type":["string","null"],"description":"secondary email address for patron's primary address"},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"borrowernumber":{"description":"internally assigned user identifier","type":"string"},"zipcode":{"description":"zip or postal code of patron's primary address","type":["string","null"]},"sort2":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"checkprevcheckout":{"type":"string","description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'"},"userid":{"type":["string","null"],"description":"patron's login"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"opacnote":{"type":["string","null"],"description":"a note on the patron's account visible in OPAC and staff client"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"streettype":{"description":"street type of patron's primary address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"categorycode":{"type":"string","description":"code of patron's category"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"type":["string","null"],"description":"first address line of patron's alternate address"},"firstname":{"type":["string","null"],"description":"patron's first name"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"initials":{"type":["string","null"],"description":"initials of the patron"},"city":{"description":"city or town of patron's primary address","type":"string"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"B_address2":{"description":"second address line of patron's alternate address","type":["string","null"]},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"othernames":{"description":"any other names associated with the patron","type":["string","null"]},"sms_provider_id":{"type":["string","null"],"description":"the provider of the mobile phone number defined in smsalertnumber"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"sex":{"description":"patron's gender","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"surname":{"description":"patron's last name","type":"string"},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"debarredcomment":{"description":"comment on the stop of the patron","type":["string","null"]},"borrowernotes":{"description":"a note on the patron's account","type":["string","null"]},"B_zipcode":{"type":["string","null"],"description":"zip or postal code of patron's alternate address"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"email":{"type":["string","null"],"description":"primary email address for patron's primary address"}},"type":"object"}},"403":{"description":"Access forbidden","schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"}}},"operationId":"getPatron","parameters":[{"description":"Internal patron identifier","type":"integer","required":true,"in":"path","name":"borrowernumber"}]}},"\/accountlines":{"get":{"responses":{"200":{"description":"A list of accountlines","schema":{"items":{"type":"object","properties":{"accounttype":{"description":"Type of accountline"},"amount":{"description":"Amount"},"manager_id":{"description":"Borrowernumber of user that created the account line"},"date":{"description":"Date when the account line was created"},"notify_level":{"description":"?"},"lastincrement":{"description":"?"},"timestamp":{"description":"When the account line was last updated"},"borrowernumber":{"description":"Internal borrower identifier"},"itemnumber":{"description":"Internal item identifier"},"accountno":{"description":"?"},"accountlines_id":{"description":"Internal account line identifier"},"description":{"description":"Description of account line"},"notify_id":{"description":"?"},"note":{"description":"Accountline note"},"time":{"description":"Time when the account line was created"},"amountoutstanding":{"description":"Amount outstanding"},"meansofpayment":{"description":"Means of payment"}}},"type":"array"}},"403":{"description":"Access forbidden","schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"}}},"tags":["accountlines"],"produces":["application\/json"],"operationId":"listAccountlines"}},"\/holds":{"get":{"operationId":"listHolds","produces":["application\/json"],"responses":{"200":{"schema":{"items":{"properties":{"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"notificationdate":{"description":"currently unused"},"timestamp":{"description":"date and time the hold was last updated"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"itemtype":{"description":"If record level hold, the optional itemtype of the item the patron is requesting","type":["string","null"]},"reservenotes":{"description":"notes related to this hold"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend_until":{"description":""},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"reservedate":{"description":"the date the hold was placed"}},"type":"object"},"type":"array"},"description":"A list of holds"},"404":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Borrower not found"}},"tags":["borrowers","holds"],"parameters":[{"type":"integer","description":"Internal reserve identifier","in":"query","name":"reserve_id"},{"description":"Internal borrower identifier","type":"integer","in":"query","name":"borrowernumber"},{"type":"string","description":"Reserve date","in":"query","name":"reservedate"},{"type":"integer","description":"Internal biblio identifier","in":"query","name":"biblionumber"},{"in":"query","name":"branchcode","type":"string","description":"Branch code"},{"type":"string","description":"Notification date","name":"notificationdate","in":"query"},{"in":"query","name":"reminderdate","description":"Reminder date","type":"string"},{"in":"query","name":"cancellationdate","description":"Cancellation date","type":"string"},{"name":"reservenotes","in":"query","type":"string","description":"Reserve notes"},{"name":"priority","in":"query","type":"integer","description":"Priority"},{"type":"string","description":"Found status","name":"found","in":"query"},{"in":"query","name":"timestamp","description":"Time of latest update","type":"string"},{"name":"itemnumber","in":"query","type":"integer","description":"Internal item identifier"},{"name":"waitingdate","in":"query","type":"string","description":"Date the item was marked as waiting for the patron"},{"description":"Date the hold expires","type":"string","name":"expirationdate","in":"query"},{"type":"integer","description":"Lowest priority","name":"lowestPriority","in":"query"},{"description":"Suspended","type":"integer","in":"query","name":"suspend"},{"name":"suspend_until","in":"query","type":"string","description":"Suspended until"}]},"post":{"tags":["borrowers","holds"],"responses":{"201":{"description":"Created hold","schema":{"type":"object","properties":{"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"notificationdate":{"description":"currently unused"},"timestamp":{"description":"date and time the hold was last updated"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"itemtype":{"description":"If record level hold, the optional itemtype of the item the patron is requesting","type":["string","null"]},"reservenotes":{"description":"notes related to this hold"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend_until":{"description":""},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"reservedate":{"description":"the date the hold was placed"}}}},"500":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"description":"Internal error"},"404":{"description":"Borrower not found","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}},"400":{"description":"Missing or wrong parameters","schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"}},"403":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Hold not allowed"}},"produces":["application\/json"],"operationId":"addHold","consumes":["application\/json"],"parameters":[{"description":"A JSON object containing informations about the new hold","schema":{"type":"object","properties":{"biblionumber":{"description":"Biblio internal identifier","type":"integer"},"branchcode":{"description":"Pickup location","type":"string"},"expirationdate":{"format":"date","type":"string","description":"Hold end date"},"borrowernumber":{"type":"integer","description":"Borrower internal identifier"},"itemnumber":{"type":"integer","description":"Item internal identifier"}}},"name":"body","in":"body","required":true}]}},"\/holds\/{reserve_id}":{"put":{"tags":["holds"],"produces":["application\/json"],"responses":{"404":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Hold not found"},"400":{"description":"Missing or wrong parameters","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}},"200":{"schema":{"type":"object","properties":{"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"notificationdate":{"description":"currently unused"},"timestamp":{"description":"date and time the hold was last updated"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"itemtype":{"description":"If record level hold, the optional itemtype of the item the patron is requesting","type":["string","null"]},"reservenotes":{"description":"notes related to this hold"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend_until":{"description":""},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"reservedate":{"description":"the date the hold was placed"}}},"description":"Updated hold"}},"operationId":"editHold","parameters":[{"description":"Internal hold identifier","type":"integer","required":true,"name":"reserve_id","in":"path"},{"description":"A JSON object containing fields to modify","schema":{"properties":{"priority":{"description":"Position in waiting queue","type":"integer","minimum":1},"branchcode":{"description":"Pickup location","type":"string"},"suspend_until":{"type":"string","description":"Suspend until","format":"date"}},"type":"object"},"name":"body","in":"body","required":true}],"consumes":["application\/json"]},"delete":{"parameters":[{"description":"Internal hold identifier","type":"integer","required":true,"in":"path","name":"reserve_id"}],"operationId":"deleteHold","produces":["application\/json"],"responses":{"404":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Hold not found"},"200":{"description":"Successful deletion","schema":{"type":"object"}}},"tags":["holds"]}},"\/patrons":{"get":{"tags":["patrons"],"responses":{"403":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Access forbidden"},"200":{"schema":{"type":"array","items":{"properties":{"dateofbirth":{"type":["string","null"],"description":"patron's date of birth"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"title":{"description":"patron's title","type":["string","null"]},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"dateexpiry":{"description":"date the patron's card is set to expire","type":["string","null"]},"emailpro":{"type":["string","null"],"description":"secondary email address for patron's primary address"},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"borrowernumber":{"description":"internally assigned user identifier","type":"string"},"zipcode":{"description":"zip or postal code of patron's primary address","type":["string","null"]},"sort2":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"checkprevcheckout":{"type":"string","description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'"},"userid":{"type":["string","null"],"description":"patron's login"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"opacnote":{"type":["string","null"],"description":"a note on the patron's account visible in OPAC and staff client"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"streettype":{"description":"street type of patron's primary address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"categorycode":{"type":"string","description":"code of patron's category"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"type":["string","null"],"description":"first address line of patron's alternate address"},"firstname":{"type":["string","null"],"description":"patron's first name"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"initials":{"type":["string","null"],"description":"initials of the patron"},"city":{"description":"city or town of patron's primary address","type":"string"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"B_address2":{"description":"second address line of patron's alternate address","type":["string","null"]},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"othernames":{"description":"any other names associated with the patron","type":["string","null"]},"sms_provider_id":{"type":["string","null"],"description":"the provider of the mobile phone number defined in smsalertnumber"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"sex":{"description":"patron's gender","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"surname":{"description":"patron's last name","type":"string"},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"debarredcomment":{"description":"comment on the stop of the patron","type":["string","null"]},"borrowernotes":{"description":"a note on the patron's account","type":["string","null"]},"B_zipcode":{"type":["string","null"],"description":"zip or postal code of patron's alternate address"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"email":{"type":["string","null"],"description":"primary email address for patron's primary address"}},"type":"object"}},"description":"A list of patrons"}},"produces":["application\/json"],"operationId":"listPatrons"}}},"definitions":{"hold":{"properties":{"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"notificationdate":{"description":"currently unused"},"timestamp":{"description":"date and time the hold was last updated"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"itemtype":{"description":"If record level hold, the optional itemtype of the item the patron is requesting","type":["string","null"]},"reservenotes":{"description":"notes related to this hold"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend_until":{"description":""},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"reservedate":{"description":"the date the hold was placed"}},"type":"object"},"accountline":{"type":"object","properties":{"accounttype":{"description":"Type of accountline"},"amount":{"description":"Amount"},"manager_id":{"description":"Borrowernumber of user that created the account line"},"date":{"description":"Date when the account line was created"},"notify_level":{"description":"?"},"lastincrement":{"description":"?"},"timestamp":{"description":"When the account line was last updated"},"borrowernumber":{"description":"Internal borrower identifier"},"itemnumber":{"description":"Internal item identifier"},"accountno":{"description":"?"},"accountlines_id":{"description":"Internal account line identifier"},"description":{"description":"Description of account line"},"notify_id":{"description":"?"},"note":{"description":"Accountline note"},"time":{"description":"Time when the account line was created"},"amountoutstanding":{"description":"Amount outstanding"},"meansofpayment":{"description":"Means of payment"}}},"patron":{"type":"object","properties":{"dateofbirth":{"type":["string","null"],"description":"patron's date of birth"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"title":{"description":"patron's title","type":["string","null"]},"flags":{"description":"a number associated with the patron's permissions","type":["string","null"]},"sort1":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"dateexpiry":{"description":"date the patron's card is set to expire","type":["string","null"]},"emailpro":{"type":["string","null"],"description":"secondary email address for patron's primary address"},"debarred":{"type":["string","null"],"description":"until this date the patron can only check-in"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"borrowernumber":{"description":"internally assigned user identifier","type":"string"},"zipcode":{"description":"zip or postal code of patron's primary address","type":["string","null"]},"sort2":{"type":["string","null"],"description":"a field that can be used for any information unique to the library"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"altcontactstate":{"description":"the state for the alternate contact for the patron","type":["string","null"]},"checkprevcheckout":{"type":"string","description":"produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'"},"userid":{"type":["string","null"],"description":"patron's login"},"B_streetnumber":{"type":["string","null"],"description":"street number of patron's alternate address"},"streetnumber":{"description":"street number of patron's primary address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"opacnote":{"type":["string","null"],"description":"a note on the patron's account visible in OPAC and staff client"},"guarantorid":{"type":["string","null"],"description":"borrowernumber used for children or professionals to link them to guarantor or organizations"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"B_streettype":{"type":["string","null"],"description":"street type of patron's alternate address"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"streettype":{"description":"street type of patron's primary address","type":["string","null"]},"password":{"description":"patron's encrypted password","type":["string","null"]},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"relationship":{"description":"used for children to include the relationship to their guarantor","type":["string","null"]},"B_state":{"type":["string","null"],"description":"state or province of patron's alternate address"},"updated_on":{"type":"string","description":"time of last change could be useful for synchronization with external systems (among others)"},"categorycode":{"type":"string","description":"code of patron's category"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"smsalertnumber":{"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)","type":["string","null"]},"B_email":{"type":["string","null"],"description":"email address for patron's alternate address"},"B_address":{"type":["string","null"],"description":"first address line of patron's alternate address"},"firstname":{"type":["string","null"],"description":"patron's first name"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"contactname":{"type":["string","null"],"description":"used for children and professionals to include surname or last name of guarantor or organization name"},"altcontactcountry":{"type":["string","null"],"description":"the country for the alternate contact for the patron"},"B_country":{"type":["string","null"],"description":"country of patron's alternate address"},"initials":{"type":["string","null"],"description":"initials of the patron"},"city":{"description":"city or town of patron's primary address","type":"string"},"contacttitle":{"type":["string","null"],"description":"used for children to include title of guarantor"},"B_address2":{"description":"second address line of patron's alternate address","type":["string","null"]},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"altcontactzipcode":{"description":"the zipcode for the alternate contact for the patron","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"othernames":{"description":"any other names associated with the patron","type":["string","null"]},"sms_provider_id":{"type":["string","null"],"description":"the provider of the mobile phone number defined in smsalertnumber"},"country":{"type":["string","null"],"description":"country of patron's primary address"},"sex":{"description":"patron's gender","type":["string","null"]},"mobile":{"type":["string","null"],"description":"the other phone number for patron's primary address"},"surname":{"description":"patron's last name","type":"string"},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"state":{"type":["string","null"],"description":"state or province of patron's primary address"},"debarredcomment":{"description":"comment on the stop of the patron","type":["string","null"]},"borrowernotes":{"description":"a note on the patron's account","type":["string","null"]},"B_zipcode":{"type":["string","null"],"description":"zip or postal code of patron's alternate address"},"privacy_guarantor_checkouts":{"type":"string","description":"controls if relatives can see this patron's checkouts"},"email":{"type":["string","null"],"description":"primary email address for patron's primary address"}}},"error":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"holds":{"type":"array","items":{"properties":{"reserve_id":{"description":"Internal hold identifier"},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"reminderdate":{"description":"currently unused"},"lowestPriority":{"description":""},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"notificationdate":{"description":"currently unused"},"timestamp":{"description":"date and time the hold was last updated"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"itemtype":{"description":"If record level hold, the optional itemtype of the item the patron is requesting","type":["string","null"]},"reservenotes":{"description":"notes related to this hold"},"cancellationdate":{"description":"the date the hold was cancelled"},"suspend_until":{"description":""},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"reservedate":{"description":"the date the hold was placed"}},"type":"object"}}},"swagger":"2.0","info":{"version":"1","title":"Koha REST API","contact":{"name":"Koha Team","url":"http:\/\/koha-community.org\/"},"license":{"name":"GPL v3","url":"http:\/\/www.gnu.org\/licenses\/gpl.txt"}}}
(-)a/t/db_dependent/api/v1/accountlines.t (-1 / +104 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/env perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Test::More tests => 10;
21
use Test::Mojo;
22
use t::lib::TestBuilder;
23
24
use C4::Auth;
25
use C4::Context;
26
27
use Koha::Database;
28
29
my $builder = t::lib::TestBuilder->new();
30
31
my $dbh = C4::Context->dbh;
32
$dbh->{AutoCommit} = 0;
33
$dbh->{RaiseError} = 1;
34
35
$ENV{REMOTE_ADDR} = '127.0.0.1';
36
my $t = Test::Mojo->new('Koha::REST::V1');
37
38
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode };
39
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode };
40
41
$t->get_ok('/api/v1/accountlines')
42
  ->status_is(403);
43
44
my $loggedinuser = $builder->build({
45
    source => 'Borrower',
46
    value => {
47
        branchcode   => $branchcode,
48
        categorycode => $categorycode,
49
        flags        => 1024
50
    }
51
});
52
53
my $borrower = $builder->build({
54
    source => 'Borrower',
55
    value => {
56
        branchcode   => $branchcode,
57
        categorycode => $categorycode,
58
    }
59
});
60
61
my $borrower2 = $builder->build({
62
    source => 'Borrower',
63
    value => {
64
        branchcode   => $branchcode,
65
        categorycode => $categorycode,
66
    }
67
});
68
my $borrowernumber = $borrower->{borrowernumber};
69
my $borrowernumber2 = $borrower2->{borrowernumber};
70
71
$dbh->do(q| DELETE FROM accountlines |);
72
$dbh->do(q|
73
    INSERT INTO accountlines (borrowernumber, amount, accounttype)
74
    VALUES (?, 20, 'A'), (?, 40, 'F'), (?, 80, 'F'), (?, 10, 'F')
75
    |, undef, $borrowernumber, $borrowernumber, $borrowernumber, $borrowernumber2);
76
77
my $session = C4::Auth::get_session('');
78
$session->param('number', $loggedinuser->{ borrowernumber });
79
$session->param('id', $loggedinuser->{ userid });
80
$session->param('ip', '127.0.0.1');
81
$session->param('lasttime', time());
82
$session->flush;
83
84
my $tx = $t->ua->build_tx(GET => "/api/v1/accountlines?borrowernumber=$borrowernumber");
85
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
86
$tx->req->env({REMOTE_ADDR => '127.0.0.1'});
87
$t->request_ok($tx)
88
  ->status_is(200);
89
90
my $json = $t->tx->res->json;
91
ok(ref $json eq 'ARRAY', 'response is a JSON array');
92
ok(scalar @$json == 3, 'response array contains 3 elements');
93
94
$tx = $t->ua->build_tx(GET => "/api/v1/accountlines");
95
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
96
$tx->req->env({REMOTE_ADDR => '127.0.0.1'});
97
$t->request_ok($tx)
98
  ->status_is(200);
99
100
$json = $t->tx->res->json;
101
ok(ref $json eq 'ARRAY', 'response is a JSON array');
102
ok(scalar @$json == 4, 'response array contains 3 elements');
103
104
$dbh->rollback;

Return to bug 15165