@@ -, +, @@
claim is resolved
---
Koha/REST/V1/ReturnClaims.pm | 9 +++++++--
.../prog/en/includes/checkouts-table.inc | 9 +++++++++
koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 2 ++
t/db_dependent/api/v1/return_claims.t | 19 ++++++++++++++++++-
4 files changed, 36 insertions(+), 3 deletions(-)
--- a/Koha/REST/V1/ReturnClaims.pm
+++ a/Koha/REST/V1/ReturnClaims.pm
@@ -160,8 +160,9 @@ sub resolve_claim {
return try {
- my $resolved_by = $body->{resolved_by};
- my $resolution = $body->{resolution};
+ my $resolved_by = $body->{resolved_by};
+ my $resolution = $body->{resolution};
+ my $new_lost_status = $body->{new_lost_status};
my $user = $c->stash('koha.user');
$resolved_by //= $user->borrowernumber;
@@ -173,6 +174,10 @@ sub resolve_claim {
resolved_on => \'NOW()',
}
)->store;
+
+ if ( defined $new_lost_status ) {
+ $claim->checkout->item->itemlost($new_lost_status)->store;
+ }
$claim->discard_changes;
return $c->render(
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc
@@ -145,6 +145,15 @@
[% END %]
+
+
+ [% SET itemlost = AuthorisedValues.GetAuthValueDropbox('LOST') %]
+
--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
@@ -1142,6 +1142,7 @@ $(document).ready(function() {
$(document).on('click', '#claims-returned-resolved-modal-btn-submit', function(e) {
let resolution = $('#claims-returned-resolved-modal-resolved-code').val();
+ let new_lost_status = $('#new_lost_status').val();
let id = $('#claims-returned-resolved-modal-id').val();
$('#claims-returned-resolved-modal-btn-submit-spinner').show();
@@ -1149,6 +1150,7 @@ $(document).ready(function() {
params = {
resolution: resolution,
+ new_lost_status: new_lost_status,
updated_by: logged_in_user_borrowernumber
};
--- a/t/db_dependent/api/v1/return_claims.t
+++ a/t/db_dependent/api/v1/return_claims.t
@@ -175,7 +175,7 @@ subtest 'update_notes() tests' => sub {
subtest 'resolve_claim() tests' => sub {
- plan tests => 8;
+ plan tests => 12;
$schema->storage->txn_begin;
@@ -193,6 +193,10 @@ subtest 'resolve_claim() tests' => sub {
t::lib::Mocks::mock_userenv( { branchcode => $item->homebranch } ); # needed by AddIssue
+ # Picking 1 that should exist
+ my $ClaimReturnedLostValue = 1;
+ t::lib::Mocks::mock_preference('ClaimReturnedLostValue', $ClaimReturnedLostValue);
+
my $issue = AddIssue( $librarian->unblessed, $item->barcode, dt_from_string->add( weeks => 2 ) );
my $claim = $issue->claim_returned(
@@ -219,6 +223,19 @@ subtest 'resolve_claim() tests' => sub {
is( $claim->resolved_by, $librarian->id );
ok( $claim->resolved_on );
+ is( $claim->checkout->item->itemlost, $ClaimReturnedLostValue );
+
+ $claim->update({resolution => undef, resolved_by => undef, resolved_on => undef });
+ $t->put_ok(
+ "//$userid:$password@/api/v1/return_claims/$claim_id/resolve" => json => {
+ resolved_by => $librarian->id,
+ resolution => "FOUNDINLIB",
+ new_lost_status => 0,
+ }
+ )->status_is(200);
+ is( $claim->get_from_storage->checkout->item->itemlost, 0 );
+
+
# Make sure the claim doesn't exist on the DB anymore
$claim->delete;
--