Bugzilla – Attachment 122120 Details for
Bug 28271
Add the ability to set a new lost status when a claim is resolved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28271: Add the ability to set a new lost status when a claim is resolved
Bug-28271-Add-the-ability-to-set-a-new-lost-status.patch (text/plain), 5.34 KB, created by
Andrew Fuerste-Henry
on 2021-06-18 11:50:03 UTC
(
hide
)
Description:
Bug 28271: Add the ability to set a new lost status when a claim is resolved
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-06-18 11:50:03 UTC
Size:
5.34 KB
patch
obsolete
>From 33ab51f920903acfd07355b03b52760c929acb8f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 30 Apr 2021 15:13:26 +0200 >Subject: [PATCH] Bug 28271: Add the ability to set a new lost status when a > claim is resolved > >When a claim is resolved the librarian should be able to edit the lost >status of the item. > >It is also letting a way out when BlockReturnOfLostItems is set (the >lost status is stuck on ClaimReturnedLostValue as we remove the >option to edit itemlost on the item edit form). > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > Koha/REST/V1/ReturnClaims.pm | 9 +++++++-- > .../prog/en/includes/checkouts-table.inc | 9 +++++++++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 6 ++++-- > t/db_dependent/api/v1/return_claims.t | 19 ++++++++++++++++++- > 4 files changed, 38 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/V1/ReturnClaims.pm b/Koha/REST/V1/ReturnClaims.pm >index 118e11782a..bcc210902a 100644 >--- a/Koha/REST/V1/ReturnClaims.pm >+++ b/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; >@@ -174,6 +175,10 @@ sub resolve_claim { > updated_by => $resolved_by, > } > )->store; >+ >+ if ( defined $new_lost_status ) { >+ $claim->checkout->item->itemlost($new_lost_status)->store; >+ } > $claim->discard_changes; > > return $c->render( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index 9a2f74d43f..2f9bf6cb17 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -145,6 +145,15 @@ > <option value="[% r.authorised_value | html %]">[% r.lib | html %]</option> > [% END %] > </select> >+ >+ <label for="new_lost_status">New item lost value:</label> >+ [% SET itemlost = AuthorisedValues.GetAuthValueDropbox('LOST') %] >+ <select class="form-control" id="new_lost_status"> >+ <option value="0"></option> >+ [% FOREACH lost IN itemlost %] >+ <option value="[% lost.authorised_value | html %]">[% lost.lib | html %]</option> >+ [% END %] >+ </select> > </div> > > <input type="hidden" id="claims-returned-resolved-modal-id"/> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 6ef16c71f8..3c3da8ceef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -1142,14 +1142,16 @@ $(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(); > $('#claims-returned-resolved-modal-btn-submit-icon').hide(); > > params = { >- resolution: resolution, >- resolved_by: logged_in_user_borrowernumber >+ resolution: resolution, >+ resolved_by: logged_in_user_borrowernumber, >+ new_lost_status: new_lost_status > }; > > $.ajax({ >diff --git a/t/db_dependent/api/v1/return_claims.t b/t/db_dependent/api/v1/return_claims.t >index aac1a3db5e..2123b5e0ae 100755 >--- a/t/db_dependent/api/v1/return_claims.t >+++ b/t/db_dependent/api/v1/return_claims.t >@@ -175,7 +175,7 @@ subtest 'update_notes() tests' => sub { > > subtest 'resolve_claim() tests' => sub { > >- plan tests => 9; >+ plan tests => 13; > > $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( >@@ -225,6 +229,19 @@ subtest 'resolve_claim() tests' => sub { > is( $claim->updated_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; > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28271
:
120335
|
120336
|
120406
|
122047
|
122054
|
122093
|
122094
|
122095
|
122096
| 122120 |
122121
|
122122
|
122123