Bugzilla – Attachment 188573 Details for
Bug 40504
ILL requests should have ability to assign staff to manage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40504: Add tests
Bug-40504-Add-tests.patch (text/plain), 5.61 KB, created by
Pedro Amorim
on 2025-10-29 16:22:35 UTC
(
hide
)
Description:
Bug 40504: Add tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-10-29 16:22:35 UTC
Size:
5.61 KB
patch
obsolete
>From 484d40d652314cd4173956b0b37cc70c45a8e0c7 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 15 Oct 2025 13:11:42 +0000 >Subject: [PATCH] Bug 40504: Add tests > >Test plan, ktd, apply patches: >1) Enable ILLModule >2) Create a new ILL request, visit: ><staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard >3) Set a 'type', add a cardnumber e.g. '23529000035676', and a library. Click 'Submit'. >4) Notice the new 'Managed by' field entry on the 'Manage request' page. This should be assigned to your logged in user. >5) Click 'Edit request' from the top toolbar >6) Notice the new 'Managed by' form entry. Click 'Select manager' and click 'Search'. Only the 'koha' user should be returned. >7) Notice the message at the top 'Only staff with superlibrarian or ILL permissions are returned in the search results'. >8) Let's give 'ill' permissions to Edna Acosta, visit: ><staff_url>/cgi-bin/koha/members/member-flags.pl?member=5 >9) Search for 'ill' permission (Search for 'interlibrary' on the top right search bar) and set 'ill' permission to Edna Acosta. Save. >10) Repeat 6). Notice that now when you use the patron search modal Edna Acosta is also returned. Select Edna. Click 'Submit' to edit the request. >11) Edit again. Notice the 'Managed by' is showing 'You', with the message 'Previously was Edna Acosta'. This is the desired behavior mimicked from Suggestions i.e. the staff member that is editing the request details is assumed to becomes it's manager by default. The staff member must click 'Keep existing manager' if they want to submit changes without changing the request's manager. Test buttons, save, verify that it all works. >12) Visit the ILL list table: ><staff_url>/cgi-bin/koha/ill/ill-requests.pl >13) Click 'columns' and pick 'Managed by'. Notice it shows correctly with the link to the patron and sorting also works. >14) Create a new user without permissions (OPAC only user) >15) Access the OPAC ILL and login as that user (preferably on a different browser session as we'll want to access the staff UI as staff member again), visit: ><opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard >16) Pick a type and click 'Create' >17) Repeat 12) Notice the newly created request from OPAC is 'Managed by': Nobody. This is intentional as that request still needs to be assigned to a staff member. > >Suggestions testing: >1) This testing is also important as the existing suggestions 'Managed by' functionality has been abstracted to be utilized by both the suggestions and ILL module. >2) Access suggestions, visit: ><staff_url>/cgi-bin/koha/suggestion/suggestion.pl >3) Click 'New purchase suggestion'. Notice the select manager button is also there. Click it and click 'search'. On the modal, the following message should show 'Only staff with superlibrarian or full suggestions permissions are returned in the search results' and the patrons shown should reflect that. >4) Do the same exercises here as we just did for the ILL module, i.e. create a staff member with permission 'suggestions.suggestions_manage' and ensure that shows on the modal, assign that patron as manager, edit again, verify that it defaults to 'You' and that the 'Keep existing manager' button works as before. >5) Finally, test the suggestions list table, repeat 2) and notice the 'Update manager' action at the bottom, test that that works just as well, by checking a few suggestions boxes, selecting a manager to your selection and clicking the 'Submit' button under it. > >Run tests: >prove t/db_dependent/Koha/ILL/Request.t >prove t/db_dependent/api/v1/ill_users.t > >Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> >--- > t/db_dependent/Koha/ILL/Request.t | 46 ++++++++++++++++++++++++++++++- > 1 file changed, 45 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/ILL/Request.t b/t/db_dependent/Koha/ILL/Request.t >index d3cc3f0e277..42c4e3768ed 100755 >--- a/t/db_dependent/Koha/ILL/Request.t >+++ b/t/db_dependent/Koha/ILL/Request.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 8; >+use Test::More tests => 9; > use Test::MockModule; > > use Koha::ILL::Requests; >@@ -299,3 +299,47 @@ subtest 'add_or_update_attributes() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'auto_set_manager' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $librarian = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 2**22 } >+ } >+ ); >+ my $password = 'thePassword123'; >+ $librarian->set_password( { password => $password, skip_validation => 1 } ); >+ >+ my $logger = Koha::ILL::Request::Logger->new; >+ my $ill_request = $builder->build_sample_ill_request( { managedby => undef } ); >+ >+ t::lib::Mocks::mock_userenv( { patron => $librarian } ); >+ $logger->log_status_change( >+ { >+ request => $ill_request, >+ value => 'NEW' >+ } >+ ); >+ >+ is( $librarian->borrowernumber, $ill_request->managedby, 'Managed by correctly set' ); >+ >+ my $unauthorized_patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 0 } >+ } >+ ); >+ my $unauth_password = 'thePassword123'; >+ $unauthorized_patron->set_password( { password => $unauth_password, skip_validation => 1 } ); >+ my $unauth_userid = $unauthorized_patron->userid; >+ t::lib::Mocks::mock_userenv( { patron => $librarian } ); >+ my $no_manager_ill_request = $builder->build_sample_ill_request( { managedby => undef } ); >+ is( undef, $no_manager_ill_request->managedby, 'Managed by correctly undef' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.39.5
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 40504
:
187906
|
187907
|
187908
|
187909
|
187910
|
187911
|
187912
|
187913
|
187914
|
187915
|
188365
|
188563
|
188565
|
188566
|
188567
|
188568
|
188569
|
188570
|
188571
|
188572
| 188573 |
188574
|
188624
|
188625
|
188935
|
188936