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

(-)a/Koha/REST/V1/ReturnClaims.pm (-2 / +1 lines)
Lines 37-46 Claim that a checked out item was returned. Link Here
37
37
38
sub claim_returned {
38
sub claim_returned {
39
    my $c     = shift->openapi->valid_input or return;
39
    my $c     = shift->openapi->valid_input or return;
40
    my $input = $c->validation->output;
41
    my $body  = $c->validation->param('body');
40
    my $body  = $c->validation->param('body');
42
41
43
    my $itemnumber      = $input->{item_id};
42
    my $itemnumber      = $body->{item_id};
44
    my $charge_lost_fee = $body->{charge_lost_fee} ? 1 : 0;
43
    my $charge_lost_fee = $body->{charge_lost_fee} ? 1 : 0;
45
    my $created_by      = $body->{created_by};
44
    my $created_by      = $body->{created_by};
46
    my $notes           = $body->{notes};
45
    my $notes           = $body->{notes};
(-)a/api/v1/swagger/paths.json (-2 / +2 lines)
Lines 86-93 Link Here
86
  "/public/patrons/{patron_id}/guarantors/can_see_checkouts": {
86
  "/public/patrons/{patron_id}/guarantors/can_see_checkouts": {
87
    "$ref": "paths/public_patrons.json#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_checkouts"
87
    "$ref": "paths/public_patrons.json#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_checkouts"
88
  },
88
  },
89
  "/return_claims/claim/{item_id}/": {
89
  "/return_claims": {
90
    "$ref": "paths/return_claims.json#/~1return_claims~1claim~1{item_id}"
90
    "$ref": "paths/return_claims.json#/~1return_claims"
91
  },
91
  },
92
  "/return_claims/{claim_id}/notes": {
92
  "/return_claims/{claim_id}/notes": {
93
    "$ref": "paths/return_claims.json#/~1return_claims~1{claim_id}~1notes"
93
    "$ref": "paths/return_claims.json#/~1return_claims~1{claim_id}~1notes"
(-)a/api/v1/swagger/paths/return_claims.json (-8 / +5 lines)
Lines 1-5 Link Here
1
{
1
{
2
  "/return_claims/claim/{item_id}": {
2
  "/return_claims": {
3
    "post": {
3
    "post": {
4
      "x-mojo-to": "ReturnClaims#claim_returned",
4
      "x-mojo-to": "ReturnClaims#claim_returned",
5
      "operationId": "claimReturned",
5
      "operationId": "claimReturned",
Lines 10-22 Link Here
10
        "claim"
10
        "claim"
11
      ],
11
      ],
12
      "parameters": [
12
      "parameters": [
13
        {
14
          "name": "item_id",
15
          "in": "path",
16
          "required": true,
17
          "description": "Itemnumber of item to claim as returned",
18
          "type": "integer"
19
        },
20
        {
13
        {
21
          "name": "body",
14
          "name": "body",
22
          "in": "body",
15
          "in": "body",
Lines 25-30 Link Here
25
          "schema": {
18
          "schema": {
26
            "type": "object",
19
            "type": "object",
27
            "properties": {
20
            "properties": {
21
              "item_id" : {
22
                "description": "Internal item id to claim as returned",
23
                "type": "integer"
24
              },
28
              "notes": {
25
              "notes": {
29
                "description": "Notes about this return claim",
26
                "description": "Notes about this return claim",
30
                "type": "string"
27
                "type": "string"
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-1 / +2 lines)
Lines 845-856 $(document).ready(function() { Link Here
845
        $(`.claim-returned-btn[data-itemnumber='${itemnumber}']`).replaceWith(`<img id='return_claim_spinner_${itemnumber}' src='${interface}/${theme}/img/spinner-small.gif' />`);
845
        $(`.claim-returned-btn[data-itemnumber='${itemnumber}']`).replaceWith(`<img id='return_claim_spinner_${itemnumber}' src='${interface}/${theme}/img/spinner-small.gif' />`);
846
846
847
        params = {
847
        params = {
848
            item_id: itemnumber,
848
            notes: notes,
849
            notes: notes,
849
            charge_lost_fee: fee,
850
            charge_lost_fee: fee,
850
            created_by: $.cookie("lastborrowernumber")
851
            created_by: $.cookie("lastborrowernumber")
851
        };
852
        };
852
853
853
        $.post( `/api/v1/return_claims/claim/${itemnumber}`, JSON.stringify(params), function( data ) {
854
        $.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) {
854
855
855
            id = "#return_claim_spinner_" + data.itemnumber;
856
            id = "#return_claim_spinner_" + data.itemnumber;
856
857
(-)a/t/db_dependent/api/v1/return_claims.t (-4 / +6 lines)
Lines 81-87 t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', '99' ); Link Here
81
# Test creating a return claim
81
# Test creating a return claim
82
## Invalid id
82
## Invalid id
83
$t->post_ok(
83
$t->post_ok(
84
    "//$userid:$password@/api/v1/return_claims/claim/1" => json => {
84
    "//$userid:$password@/api/v1/return_claims" => json => {
85
        item_id         => 1,
85
        charge_lost_fee => Mojo::JSON->false,
86
        charge_lost_fee => Mojo::JSON->false,
86
        created_by      => $librarian->id,
87
        created_by      => $librarian->id,
87
        notes           => "This is a test note."
88
        notes           => "This is a test note."
Lines 90-96 $t->post_ok( Link Here
90
91
91
## Valid id
92
## Valid id
92
$t->post_ok(
93
$t->post_ok(
93
    "//$userid:$password@/api/v1/return_claims/claim/$itemnumber1" => json => {
94
    "//$userid:$password@/api/v1/return_claims" => json => {
95
        item_id         => $itemnumber1,
94
        charge_lost_fee => Mojo::JSON->false,
96
        charge_lost_fee => Mojo::JSON->false,
95
        created_by      => $librarian->id,
97
        created_by      => $librarian->id,
96
        notes           => "This is a test note."
98
        notes           => "This is a test note."
Lines 100-106 my $claim_id = $t->tx->res->json->{id}; Link Here
100
102
101
## Duplicate id
103
## Duplicate id
102
$t->post_ok(
104
$t->post_ok(
103
    "//$userid:$password@/api/v1/return_claims/claim/$itemnumber1" => json => {
105
    "//$userid:$password@/api/v1/return_claims" => json => {
106
        item_id         => $itemnumber1,
104
        charge_lost_fee => Mojo::JSON->false,
107
        charge_lost_fee => Mojo::JSON->false,
105
        created_by      => $librarian->id,
108
        created_by      => $librarian->id,
106
        notes           => "This is a test note."
109
        notes           => "This is a test note."
107
- 

Return to bug 14697