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

(-)a/Koha/REST/V1/Accountline.pm (+22 lines)
Lines 36-39 sub list { Link Here
36
    return $c->$cb($accountlines->unblessed, 200);
36
    return $c->$cb($accountlines->unblessed, 200);
37
}
37
}
38
38
39
40
sub edit {
41
    my ($c, $args, $cb) = @_;
42
43
    my $user = $c->stash('koha.user');
44
    unless ($user && haspermission($user->userid, {updatecharges => 1})) {
45
        return $c->$cb({error => "You don't have the required permission"}, 403);
46
    }
47
48
    my $accountline = Koha::Account::Lines->find($args->{accountlines_id});
49
    unless ($accountline) {
50
        return $c->$cb({error => "Accountline not found"}, 404);
51
    }
52
53
    my $body = $c->req->json;
54
55
    $accountline->set( $body );
56
    $accountline->store();
57
58
    return $c->$cb($accountline->unblessed(), 200);
59
}
60
39
1;
61
1;
(-)a/api/v1/swagger/parameters.json (+3 lines)
Lines 1-4 Link Here
1
{
1
{
2
  "accountlinesIdPathParam": {
3
    "$ref": "parameters/accountline.json#/accountlinesIdPathParam"
4
  },
2
  "borrowernumberPathParam": {
5
  "borrowernumberPathParam": {
3
    "$ref": "parameters/patron.json#/borrowernumberPathParam"
6
    "$ref": "parameters/patron.json#/borrowernumberPathParam"
4
  },
7
  },
(-)a/api/v1/swagger/parameters/accountline.json (+9 lines)
Line 0 Link Here
1
{
2
  "accountlinesIdPathParam": {
3
    "name": "accountlines_id",
4
    "in": "path",
5
    "description": "Internal accountline identifier",
6
    "required": true,
7
    "type": "integer"
8
  }
9
}
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 2-7 Link Here
2
  "/accountlines": {
2
  "/accountlines": {
3
    "$ref": "paths/accountlines.json#/~1accountlines"
3
    "$ref": "paths/accountlines.json#/~1accountlines"
4
  },
4
  },
5
  "/accountlines/{accountlines_id}": {
6
    "$ref": "paths/accountlines.json#/~1accountlines~1{accountlines_id}"
7
  },
5
  "/holds": {
8
  "/holds": {
6
    "$ref": "paths/holds.json#/~1holds"
9
    "$ref": "paths/holds.json#/~1holds"
7
  },
10
  },
(-)a/api/v1/swagger/paths/accountlines.json (+57 lines)
Lines 24-28 Link Here
24
        }
24
        }
25
      }
25
      }
26
    }
26
    }
27
  },
28
  "/accountlines/{accountlines_id}": {
29
    "put": {
30
      "operationId": "editAccountlines",
31
      "tags": ["accountlines"],
32
      "produces": [
33
        "application/json"
34
      ],
35
      "parameters": [
36
        { "$ref": "../parameters.json#/accountlinesIdPathParam" },
37
        {
38
          "name": "body",
39
          "in": "body",
40
          "description": "A JSON object containing fields to modify",
41
          "required": true,
42
          "schema": {
43
            "type": "object",
44
            "properties": {
45
              "amount": {
46
                "description": "Amount"
47
              },
48
              "amountoutstanding": {
49
                "description": "Amount outstanding"
50
              },
51
              "note": {
52
                "description": "Accountline note"
53
              },
54
              "meansofpayment": {
55
                "description": "Means of payment"
56
              }
57
            }
58
          }
59
        }
60
      ],
61
      "consumes": ["application/json"],
62
      "produces": ["application/json"],
63
      "responses": {
64
        "200": {
65
          "description": "Updated accountline",
66
          "schema": { "$ref": "../definitions.json#/accountline" }
67
        },
68
        "400": {
69
          "description": "Missing or wrong parameters",
70
          "schema": { "$ref": "../definitions.json#/error" }
71
        },
72
        "403": {
73
          "description": "Access forbidden",
74
          "schema": {
75
            "$ref": "../definitions.json#/error"
76
          }
77
        },
78
        "404": {
79
          "description": "Accountline not found",
80
          "schema": { "$ref": "../definitions.json#/error" }
81
        }
82
      }
83
    }
27
  }
84
  }
28
}
85
}
(-)a/api/v1/swagger/swagger.min.json (-1 / +1 lines)
Line 1 Link Here
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"}}}
1
{"swagger":"2.0","x-primitives":{"phone":{"type":["string","null"],"description":"primary phone number for patron's primary address"},"reserve_id":{"description":"Internal hold identifier"},"branchcode":{"description":"code of patron's home branch","type":["string","null"]},"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"firstname":{"description":"patron's first name","type":["string","null"]},"cardnumber":{"description":"library assigned user identifier","type":["string","null"]},"surname":{"type":"string","description":"patron's last name"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]}},"info":{"title":"Koha REST API","license":{"url":"http:\/\/www.gnu.org\/licenses\/gpl.txt","name":"GPL v3"},"contact":{"url":"http:\/\/koha-community.org\/","name":"Koha Team"},"version":"1"},"paths":{"\/patrons\/{borrowernumber}":{"get":{"responses":{"403":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"description":"Access forbidden"},"200":{"schema":{"type":"object","properties":{"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"categorycode":{"type":"string","description":"code of patron's category"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"initials":{"type":["string","null"],"description":"initials of the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"guarantorid":{"description":"borrowernumber used for children or professionals to link them to guarantor or organizations","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'"},"altcontactstate":{"type":["string","null"],"description":"the state for the alternate contact for the patron"},"emailpro":{"type":["string","null"],"description":"secondary email address for 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"},"sort1":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"B_email":{"description":"email address for patron's alternate address","type":["string","null"]},"altcontactzipcode":{"type":["string","null"],"description":"the zipcode for the alternate contact for the patron"},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"state":{"description":"state or province of patron's primary address","type":["string","null"]},"privacy_guarantor_checkouts":{"description":"controls if relatives can see this patron's checkouts","type":"string"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"updated_on":{"description":"time of last change could be useful for synchronization with external systems (among others)","type":"string"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"contacttitle":{"description":"used for children to include title of guarantor","type":["string","null"]},"sex":{"type":["string","null"],"description":"patron's gender"},"B_streetnumber":{"description":"street number of patron's alternate address","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"mobile":{"description":"the other phone number for patron's primary address","type":["string","null"]},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"B_state":{"description":"state or province of patron's alternate address","type":["string","null"]},"streetnumber":{"type":["string","null"],"description":"street number of patron's primary address"},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"country":{"description":"country of patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"title":{"type":["string","null"],"description":"patron's title"},"password":{"type":["string","null"],"description":"patron's encrypted password"},"city":{"description":"city or town of patron's primary address","type":"string"},"relationship":{"type":["string","null"],"description":"used for children to include the relationship to their guarantor"},"firstname":{"description":"patron's first name","type":["string","null"]},"altcontactcountry":{"description":"the country for the alternate contact for the patron","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"branchcode":{"description":"code of patron's home branch","type":["string","null"]},"debarred":{"description":"until this date the patron can only check-in","type":["string","null"]},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"userid":{"type":["string","null"],"description":"patron's login"},"surname":{"type":"string","description":"patron's last name"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]},"flags":{"type":["string","null"],"description":"a number associated with the patron's permissions"},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"B_country":{"description":"country of patron's alternate address","type":["string","null"]},"B_streettype":{"description":"street type of patron's alternate address","type":["string","null"]},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"smsalertnumber":{"type":["string","null"],"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)"}}},"description":"A patron"},"404":{"description":"Patron not found","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"operationId":"getPatron","parameters":[{"name":"borrowernumber","in":"path","required":true,"description":"Internal patron identifier","type":"integer"}],"produces":["application\/json"],"tags":["patrons"]}},"\/holds":{"post":{"produces":["application\/json"],"consumes":["application\/json"],"operationId":"addHold","parameters":[{"name":"body","schema":{"type":"object","properties":{"expirationdate":{"format":"date","description":"Hold end date","type":"string"},"branchcode":{"type":"string","description":"Pickup location"},"biblionumber":{"description":"Biblio internal identifier","type":"integer"},"borrowernumber":{"type":"integer","description":"Borrower internal identifier"},"itemnumber":{"description":"Item internal identifier","type":"integer"}}},"required":true,"in":"body","description":"A JSON object containing informations about the new hold"}],"responses":{"403":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Hold not allowed"},"400":{"description":"Missing or wrong parameters","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}},"500":{"description":"Internal error","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}},"404":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Borrower not found"},"201":{"description":"Created hold","schema":{"properties":{"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"reserve_id":{"description":"Internal hold identifier"},"reservedate":{"description":"the date the hold was placed"},"suspend_until":{"description":""},"notificationdate":{"description":"currently unused"},"cancellationdate":{"description":"the date the hold was cancelled"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"reservenotes":{"description":"notes related to this hold"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"timestamp":{"description":"date and time the hold was last updated"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"reminderdate":{"description":"currently unused"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"lowestPriority":{"description":""}},"type":"object"}}},"tags":["borrowers","holds"]},"get":{"responses":{"404":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Borrower not found"},"200":{"description":"A list of holds","schema":{"type":"array","items":{"properties":{"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"reserve_id":{"description":"Internal hold identifier"},"reservedate":{"description":"the date the hold was placed"},"suspend_until":{"description":""},"notificationdate":{"description":"currently unused"},"cancellationdate":{"description":"the date the hold was cancelled"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"reservenotes":{"description":"notes related to this hold"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"timestamp":{"description":"date and time the hold was last updated"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"reminderdate":{"description":"currently unused"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"lowestPriority":{"description":""}},"type":"object"}}}},"operationId":"listHolds","parameters":[{"name":"reserve_id","in":"query","type":"integer","description":"Internal reserve identifier"},{"name":"borrowernumber","in":"query","description":"Internal borrower identifier","type":"integer"},{"name":"reservedate","in":"query","description":"Reserve date","type":"string"},{"name":"biblionumber","in":"query","description":"Internal biblio identifier","type":"integer"},{"name":"branchcode","in":"query","description":"Branch code","type":"string"},{"description":"Notification date","type":"string","in":"query","name":"notificationdate"},{"name":"reminderdate","description":"Reminder date","type":"string","in":"query"},{"name":"cancellationdate","in":"query","description":"Cancellation date","type":"string"},{"in":"query","type":"string","description":"Reserve notes","name":"reservenotes"},{"type":"integer","description":"Priority","in":"query","name":"priority"},{"name":"found","type":"string","description":"Found status","in":"query"},{"in":"query","type":"string","description":"Time of latest update","name":"timestamp"},{"type":"integer","description":"Internal item identifier","in":"query","name":"itemnumber"},{"description":"Date the item was marked as waiting for the patron","type":"string","in":"query","name":"waitingdate"},{"in":"query","type":"string","description":"Date the hold expires","name":"expirationdate"},{"name":"lowestPriority","description":"Lowest priority","type":"integer","in":"query"},{"type":"integer","description":"Suspended","in":"query","name":"suspend"},{"name":"suspend_until","in":"query","description":"Suspended until","type":"string"}],"produces":["application\/json"],"tags":["borrowers","holds"]}},"\/accountlines":{"get":{"responses":{"200":{"description":"A list of accountlines","schema":{"items":{"type":"object","properties":{"note":{"description":"Accountline note"},"accountno":{"description":"?"},"accountlines_id":{"description":"Internal account line identifier"},"date":{"description":"Date when the account line was created"},"itemnumber":{"description":"Internal item identifier"},"accounttype":{"description":"Type of accountline"},"notify_level":{"description":"?"},"timestamp":{"description":"When the account line was last updated"},"amount":{"description":"Amount"},"borrowernumber":{"description":"Internal borrower identifier"},"time":{"description":"Time when the account line was created"},"meansofpayment":{"description":"Means of payment"},"description":{"description":"Description of account line"},"amountoutstanding":{"description":"Amount outstanding"},"notify_id":{"description":"?"},"manager_id":{"description":"Borrowernumber of user that created the account line"},"lastincrement":{"description":"?"}}},"type":"array"}},"403":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Access forbidden"}},"produces":["application\/json"],"operationId":"listAccountlines","tags":["accountlines"]}},"\/patrons":{"get":{"responses":{"200":{"schema":{"type":"array","items":{"type":"object","properties":{"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"categorycode":{"type":"string","description":"code of patron's category"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"initials":{"type":["string","null"],"description":"initials of the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"guarantorid":{"description":"borrowernumber used for children or professionals to link them to guarantor or organizations","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'"},"altcontactstate":{"type":["string","null"],"description":"the state for the alternate contact for the patron"},"emailpro":{"type":["string","null"],"description":"secondary email address for 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"},"sort1":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"B_email":{"description":"email address for patron's alternate address","type":["string","null"]},"altcontactzipcode":{"type":["string","null"],"description":"the zipcode for the alternate contact for the patron"},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"state":{"description":"state or province of patron's primary address","type":["string","null"]},"privacy_guarantor_checkouts":{"description":"controls if relatives can see this patron's checkouts","type":"string"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"updated_on":{"description":"time of last change could be useful for synchronization with external systems (among others)","type":"string"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"contacttitle":{"description":"used for children to include title of guarantor","type":["string","null"]},"sex":{"type":["string","null"],"description":"patron's gender"},"B_streetnumber":{"description":"street number of patron's alternate address","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"mobile":{"description":"the other phone number for patron's primary address","type":["string","null"]},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"B_state":{"description":"state or province of patron's alternate address","type":["string","null"]},"streetnumber":{"type":["string","null"],"description":"street number of patron's primary address"},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"country":{"description":"country of patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"title":{"type":["string","null"],"description":"patron's title"},"password":{"type":["string","null"],"description":"patron's encrypted password"},"city":{"description":"city or town of patron's primary address","type":"string"},"relationship":{"type":["string","null"],"description":"used for children to include the relationship to their guarantor"},"firstname":{"description":"patron's first name","type":["string","null"]},"altcontactcountry":{"description":"the country for the alternate contact for the patron","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"branchcode":{"description":"code of patron's home branch","type":["string","null"]},"debarred":{"description":"until this date the patron can only check-in","type":["string","null"]},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"userid":{"type":["string","null"],"description":"patron's login"},"surname":{"type":"string","description":"patron's last name"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]},"flags":{"type":["string","null"],"description":"a number associated with the patron's permissions"},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"B_country":{"description":"country of patron's alternate address","type":["string","null"]},"B_streettype":{"description":"street type of patron's alternate address","type":["string","null"]},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"smsalertnumber":{"type":["string","null"],"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)"}}}},"description":"A list of patrons"},"403":{"description":"Access forbidden","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"produces":["application\/json"],"operationId":"listPatrons","tags":["patrons"]}},"\/accountlines\/{accountlines_id}":{"put":{"responses":{"404":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}},"description":"Accountline not found"},"400":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Missing or wrong parameters"},"403":{"description":"Access forbidden","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}},"200":{"schema":{"properties":{"note":{"description":"Accountline note"},"accountno":{"description":"?"},"accountlines_id":{"description":"Internal account line identifier"},"date":{"description":"Date when the account line was created"},"itemnumber":{"description":"Internal item identifier"},"accounttype":{"description":"Type of accountline"},"notify_level":{"description":"?"},"timestamp":{"description":"When the account line was last updated"},"amount":{"description":"Amount"},"borrowernumber":{"description":"Internal borrower identifier"},"time":{"description":"Time when the account line was created"},"meansofpayment":{"description":"Means of payment"},"description":{"description":"Description of account line"},"amountoutstanding":{"description":"Amount outstanding"},"notify_id":{"description":"?"},"manager_id":{"description":"Borrowernumber of user that created the account line"},"lastincrement":{"description":"?"}},"type":"object"},"description":"Updated accountline"}},"parameters":[{"name":"accountlines_id","in":"path","required":true,"description":"Internal accountline identifier","type":"integer"},{"schema":{"type":"object","properties":{"amount":{"description":"Amount"},"amountoutstanding":{"description":"Amount outstanding"},"meansofpayment":{"description":"Means of payment"},"note":{"description":"Accountline note"}}},"name":"body","in":"body","required":true,"description":"A JSON object containing fields to modify"}],"operationId":"editAccountlines","produces":["application\/json"],"consumes":["application\/json"],"tags":["accountlines"]}},"\/holds\/{reserve_id}":{"delete":{"parameters":[{"required":true,"in":"path","type":"integer","description":"Internal hold identifier","name":"reserve_id"}],"operationId":"deleteHold","produces":["application\/json"],"responses":{"404":{"description":"Hold not found","schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"}},"200":{"schema":{"type":"object"},"description":"Successful deletion"}},"tags":["holds"]},"put":{"tags":["holds"],"responses":{"400":{"schema":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"description":"Missing or wrong parameters"},"200":{"description":"Updated hold","schema":{"properties":{"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"reserve_id":{"description":"Internal hold identifier"},"reservedate":{"description":"the date the hold was placed"},"suspend_until":{"description":""},"notificationdate":{"description":"currently unused"},"cancellationdate":{"description":"the date the hold was cancelled"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"reservenotes":{"description":"notes related to this hold"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"timestamp":{"description":"date and time the hold was last updated"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"reminderdate":{"description":"currently unused"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"lowestPriority":{"description":""}},"type":"object"}},"404":{"description":"Hold not found","schema":{"type":"object","properties":{"error":{"type":"string","description":"Error message"}}}}},"parameters":[{"name":"reserve_id","required":true,"in":"path","type":"integer","description":"Internal hold identifier"},{"description":"A JSON object containing fields to modify","required":true,"in":"body","name":"body","schema":{"type":"object","properties":{"priority":{"description":"Position in waiting queue","type":"integer","minimum":1},"branchcode":{"description":"Pickup location","type":"string"},"suspend_until":{"format":"date","type":"string","description":"Suspend until"}}}}],"operationId":"editHold","consumes":["application\/json"],"produces":["application\/json"]}}},"basePath":"\/api\/v1","definitions":{"accountline":{"properties":{"note":{"description":"Accountline note"},"accountno":{"description":"?"},"accountlines_id":{"description":"Internal account line identifier"},"date":{"description":"Date when the account line was created"},"itemnumber":{"description":"Internal item identifier"},"accounttype":{"description":"Type of accountline"},"notify_level":{"description":"?"},"timestamp":{"description":"When the account line was last updated"},"amount":{"description":"Amount"},"borrowernumber":{"description":"Internal borrower identifier"},"time":{"description":"Time when the account line was created"},"meansofpayment":{"description":"Means of payment"},"description":{"description":"Description of account line"},"amountoutstanding":{"description":"Amount outstanding"},"notify_id":{"description":"?"},"manager_id":{"description":"Borrowernumber of user that created the account line"},"lastincrement":{"description":"?"}},"type":"object"},"patron":{"type":"object","properties":{"B_phone":{"type":["string","null"],"description":"phone number for patron's alternate address"},"dateexpiry":{"type":["string","null"],"description":"date the patron's card is set to expire"},"categorycode":{"type":"string","description":"code of patron's category"},"B_city":{"description":"city or town of patron's alternate address","type":["string","null"]},"initials":{"type":["string","null"],"description":"initials of the patron"},"address2":{"type":["string","null"],"description":"second address line of patron's primary address"},"guarantorid":{"description":"borrowernumber used for children or professionals to link them to guarantor or organizations","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'"},"altcontactstate":{"type":["string","null"],"description":"the state for the alternate contact for the patron"},"emailpro":{"type":["string","null"],"description":"secondary email address for 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"},"sort1":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"B_address2":{"type":["string","null"],"description":"second address line of patron's alternate address"},"gonenoaddress":{"description":"set to 1 if library marked this patron as having an unconfirmed address","type":["string","null"]},"cardnumber":{"type":["string","null"],"description":"library assigned user identifier"},"altcontactphone":{"description":"the phone number for the alternate contact for the patron","type":["string","null"]},"altcontactaddress3":{"type":["string","null"],"description":"the city for the alternate contact for the patron"},"B_email":{"description":"email address for patron's alternate address","type":["string","null"]},"altcontactzipcode":{"type":["string","null"],"description":"the zipcode for the alternate contact for the patron"},"zipcode":{"type":["string","null"],"description":"zip or postal code of patron's primary address"},"dateofbirth":{"description":"patron's date of birth","type":["string","null"]},"state":{"description":"state or province of patron's primary address","type":["string","null"]},"privacy_guarantor_checkouts":{"description":"controls if relatives can see this patron's checkouts","type":"string"},"fax":{"description":"fax number for patron's primary address","type":["string","null"]},"updated_on":{"description":"time of last change could be useful for synchronization with external systems (among others)","type":"string"},"contactfirstname":{"type":["string","null"],"description":"used for children to include first name of guarantor"},"contacttitle":{"description":"used for children to include title of guarantor","type":["string","null"]},"sex":{"type":["string","null"],"description":"patron's gender"},"B_streetnumber":{"description":"street number of patron's alternate address","type":["string","null"]},"contactnote":{"description":"a note related to patron's alternate address","type":["string","null"]},"mobile":{"description":"the other phone number for patron's primary address","type":["string","null"]},"othernames":{"type":["string","null"],"description":"any other names associated with the patron"},"lost":{"type":["string","null"],"description":"set to 1 if library marked this patron as having lost his card"},"B_state":{"description":"state or province of patron's alternate address","type":["string","null"]},"streetnumber":{"type":["string","null"],"description":"street number of patron's primary address"},"borrowernotes":{"type":["string","null"],"description":"a note on the patron's account"},"phonepro":{"type":["string","null"],"description":"secondary phone number for patron's primary address"},"country":{"description":"country of patron's primary address","type":["string","null"]},"altcontactaddress2":{"type":["string","null"],"description":"the second address line for the alternate contact for the patron"},"streettype":{"type":["string","null"],"description":"street type of patron's primary address"},"title":{"type":["string","null"],"description":"patron's title"},"password":{"type":["string","null"],"description":"patron's encrypted password"},"city":{"description":"city or town of patron's primary address","type":"string"},"relationship":{"type":["string","null"],"description":"used for children to include the relationship to their guarantor"},"firstname":{"description":"patron's first name","type":["string","null"]},"altcontactcountry":{"description":"the country for the alternate contact for the patron","type":["string","null"]},"email":{"description":"primary email address for patron's primary address","type":["string","null"]},"phone":{"description":"primary phone number for patron's primary address","type":["string","null"]},"branchcode":{"description":"code of patron's home branch","type":["string","null"]},"debarred":{"description":"until this date the patron can only check-in","type":["string","null"]},"privacy":{"type":"string","description":"patron's privacy settings related to their reading history"},"altcontactsurname":{"type":["string","null"],"description":"surname or last name of the alternate contact for the patron"},"sort2":{"description":"a field that can be used for any information unique to the library","type":["string","null"]},"userid":{"type":["string","null"],"description":"patron's login"},"surname":{"type":"string","description":"patron's last name"},"B_zipcode":{"description":"zip or postal code of patron's alternate address","type":["string","null"]},"altcontactaddress1":{"description":"the first address line for the alternate contact for the patron","type":["string","null"]},"sms_provider_id":{"description":"the provider of the mobile phone number defined in smsalertnumber","type":["string","null"]},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"address":{"description":"first address line of patron's primary address","type":"string"},"altcontactfirstname":{"type":["string","null"],"description":"first name of alternate contact for the patron"},"opacnote":{"description":"a note on the patron's account visible in OPAC and staff client","type":["string","null"]},"flags":{"type":["string","null"],"description":"a number associated with the patron's permissions"},"dateenrolled":{"type":["string","null"],"description":"date the patron was added to Koha"},"B_country":{"description":"country of patron's alternate address","type":["string","null"]},"B_streettype":{"description":"street type of patron's alternate address","type":["string","null"]},"debarredcomment":{"type":["string","null"],"description":"comment on the stop of the patron"},"B_address":{"description":"first address line of patron's alternate address","type":["string","null"]},"smsalertnumber":{"type":["string","null"],"description":"the mobile phone number where the patron would like to receive notices (if SMS turned on)"}}},"holds":{"items":{"properties":{"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"reserve_id":{"description":"Internal hold identifier"},"reservedate":{"description":"the date the hold was placed"},"suspend_until":{"description":""},"notificationdate":{"description":"currently unused"},"cancellationdate":{"description":"the date the hold was cancelled"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"reservenotes":{"description":"notes related to this hold"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"timestamp":{"description":"date and time the hold was last updated"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"reminderdate":{"description":"currently unused"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"lowestPriority":{"description":""}},"type":"object"},"type":"array"},"error":{"properties":{"error":{"type":"string","description":"Error message"}},"type":"object"},"hold":{"properties":{"biblionumber":{"description":"internally assigned biblio identifier","type":"string"},"reserve_id":{"description":"Internal hold identifier"},"reservedate":{"description":"the date the hold was placed"},"suspend_until":{"description":""},"notificationdate":{"description":"currently unused"},"cancellationdate":{"description":"the date the hold was cancelled"},"itemnumber":{"description":"internally assigned item identifier","type":["string","null"]},"suspend":{"description":""},"reservenotes":{"description":"notes related to this hold"},"itemtype":{"type":["string","null"],"description":"If record level hold, the optional itemtype of the item the patron is requesting"},"timestamp":{"description":"date and time the hold was last updated"},"branchcode":{"type":["string","null"],"description":"code of patron's home branch"},"expirationdate":{"description":"the date the hold expires"},"priority":{"description":"where in the queue the patron sits"},"reminderdate":{"description":"currently unused"},"waitingdate":{"description":"the date the item was marked as waiting for the patron at the library"},"borrowernumber":{"type":"string","description":"internally assigned user identifier"},"found":{"description":"a one letter code defining what the status of the hold is after it has been confirmed"},"lowestPriority":{"description":""}},"type":"object"}},"parameters":{"accountlinesIdPathParam":{"in":"path","required":true,"description":"Internal accountline identifier","type":"integer","name":"accountlines_id"},"borrowernumberPathParam":{"required":true,"in":"path","type":"integer","description":"Internal patron identifier","name":"borrowernumber"},"holdIdPathParam":{"in":"path","required":true,"description":"Internal hold identifier","type":"integer","name":"reserve_id"},"borrowernumberQueryParam":{"in":"query","description":"Internal borrower identifier","type":"integer","name":"borrowernumber"}}}
(-)a/t/db_dependent/api/v1/accountlines.t (-2 / +40 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 10;
20
use Test::More tests => 18;
21
use Test::Mojo;
21
use Test::Mojo;
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
23
Lines 25-30 use C4::Auth; Link Here
25
use C4::Context;
25
use C4::Context;
26
26
27
use Koha::Database;
27
use Koha::Database;
28
use Koha::Account::Line;
28
29
29
my $builder = t::lib::TestBuilder->new();
30
my $builder = t::lib::TestBuilder->new();
30
31
Lines 41-46 my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; Link Here
41
$t->get_ok('/api/v1/accountlines')
42
$t->get_ok('/api/v1/accountlines')
42
  ->status_is(403);
43
  ->status_is(403);
43
44
45
$t->put_ok("/api/v1/accountlines/11224409" => json => {'amount' => -5})
46
    ->status_is(403);
47
44
my $loggedinuser = $builder->build({
48
my $loggedinuser = $builder->build({
45
    source => 'Borrower',
49
    source => 'Borrower',
46
    value => {
50
    value => {
Lines 101-104 $json = $t->tx->res->json; Link Here
101
ok(ref $json eq 'ARRAY', 'response is a JSON array');
105
ok(ref $json eq 'ARRAY', 'response is a JSON array');
102
ok(scalar @$json == 4, 'response array contains 3 elements');
106
ok(scalar @$json == 4, 'response array contains 3 elements');
103
107
108
# Editing accountlines tests
109
my $put_data = {
110
    'amount' => -19,
111
    'amountoutstanding' => -19
112
};
113
114
115
$tx = $t->ua->build_tx(
116
    PUT => "/api/v1/accountlines/11224409"
117
        => {Accept => '*/*'}
118
        => json => $put_data);
119
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
120
$tx->req->env({REMOTE_ADDR => '127.0.0.1'});
121
$t->request_ok($tx)
122
    ->status_is(404);
123
124
my $accountline_to_edit = Koha::Account::Lines->search({'borrowernumber' => $borrowernumber2})->unblessed()->[0];
125
126
$tx = $t->ua->build_tx(
127
    PUT => "/api/v1/accountlines/$accountline_to_edit->{accountlines_id}"
128
        => {Accept => '*/*'}
129
        => json => $put_data);
130
$tx->req->cookies({name => 'CGISESSID', value => $session->id});
131
$tx->req->env({REMOTE_ADDR => '127.0.0.1'});
132
$t->request_ok($tx)
133
    ->status_is(200);
134
135
my $accountline_edited = Koha::Account::Lines->search({'borrowernumber' => $borrowernumber2})->unblessed()->[0];
136
137
is($accountline_edited->{amount}, '-19.000000');
138
is($accountline_edited->{amountoutstanding}, '-19.000000');
139
140
141
# Payment tests
142
104
$dbh->rollback;
143
$dbh->rollback;
105
- 

Return to bug 15165