| 
 
        
          Description
        
        
          Esther Melander
        
        
        
        
          2025-07-24 19:15:20 UTC
        
       
    Created attachment 187906 [details] [review] Bug 40504: Preparation: Abstract 'managed by' functionality from suggestions Move 'managed by' and 'restore previous manager' form and show functionality to reusable .inc files Created attachment 187907 [details] [review] Bug 40504: Preparation: Add empty_table_settings option to patron_search_js This is required for ILL 'select manager' functionality, as table_settings are already defined there and the user modal table will pick that up unless explicitly stated to not use it, thus empty_table_settings Created attachment 187908 [details] [review] Bug 40504: Preparation: Disambiguation of .clear_search This is required, or clicking 'Clear' on the ILL patron search modal will trigger this event listener and cause a JS error, as the 'regular' ILL table is not shown/initialized when editing an ILL request Created attachment 187909 [details] [review] Bug 40504: Add ill/users API endpoint Required to get users filtered by 'ill' permission for patron search modal prove t/db_dependent/api/v1/ill_users.t Created attachment 187910 [details] [review] Bug 40504: dbic Created attachment 187911 [details] [review] Bug 40504: Add 'managedby' to illrequests This also includes a 'manager' accessor which returns the Koha::Patron object Created attachment 187912 [details] [review] Bug 40504: UI improvements This turns the 'Select manager' and 'Restore manager' actions to proper buttons, well aligned in where they are displayed. The 'Select manager' functionality in the suggestions table page is also updated to make use of the same reusable button block Created attachment 187913 [details] [review] Bug 40504: Auto functionality: - The staff member who creates a new ILL request is automatically assigned as its manager. - No manager is assigned to ILL requests made by users without 'ill' permission e.g. patrons using the OPAC. - When an ILL request without a manager has its status changed, the staff member making the change is automatically assigned as its manager e.g. by clicking 'confirm' or 'revert request'. - It is possible to manually update a request's manager by clicking the 'Edit request' toolbar button when viewing a request. The patron search modal, 'select manager' button and all its functionality is shared with the 'select manager' present in the suggestions module. This means that when editing an ILL request, the 'managedby' defaults to the staff member editing the request, unless 'Keep existing manager' is clicked, like it happens in suggestions. - This is fully core built, all backends will automatically hook into this functionality, because: -- Automatic 'managedby' happen on status change, regardless of backend -- All requests have access to 'edit request' page, regardless of backend - Only if a logged in staff member exists does the auto set manager. If no staff member is found, nothing happens e.g. an ILL request status was changed by a CLI command / cronjob Created attachment 187914 [details] [review] Bug 40504: atomicupdate Created attachment 187915 [details] [review] 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 Created attachment 188365 [details] [review] Bug 40504: atomicupdate Created attachment 188563 [details] [review] 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: Pedro <pedro.amorim@openfifth.co.uk> I have tested this on a sandbox and it is working as expected. Created attachment 188565 [details] [review] Bug 40504: Preparation: Abstract 'managed by' functionality from suggestions Move 'managed by' and 'restore previous manager' form and show functionality to reusable .inc files Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188566 [details] [review] Bug 40504: Preparation: Add empty_table_settings option to patron_search_js This is required for ILL 'select manager' functionality, as table_settings are already defined there and the user modal table will pick that up unless explicitly stated to not use it, thus empty_table_settings Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188567 [details] [review] Bug 40504: Preparation: Disambiguation of .clear_search This is required, or clicking 'Clear' on the ILL patron search modal will trigger this event listener and cause a JS error, as the 'regular' ILL table is not shown/initialized when editing an ILL request Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188568 [details] [review] Bug 40504: Add ill/users API endpoint Required to get users filtered by 'ill' permission for patron search modal prove t/db_dependent/api/v1/ill_users.t Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188569 [details] [review] Bug 40504: dbic Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188570 [details] [review] Bug 40504: Add 'managedby' to illrequests This also includes a 'manager' accessor which returns the Koha::Patron object Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188571 [details] [review] Bug 40504: UI improvements This turns the 'Select manager' and 'Restore manager' actions to proper buttons, well aligned in where they are displayed. The 'Select manager' functionality in the suggestions table page is also updated to make use of the same reusable button block Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188572 [details] [review] Bug 40504: Auto functionality: - The staff member who creates a new ILL request is automatically assigned as its manager. - No manager is assigned to ILL requests made by users without 'ill' permission e.g. patrons using the OPAC. - When an ILL request without a manager has its status changed, the staff member making the change is automatically assigned as its manager e.g. by clicking 'confirm' or 'revert request'. - It is possible to manually update a request's manager by clicking the 'Edit request' toolbar button when viewing a request. The patron search modal, 'select manager' button and all its functionality is shared with the 'select manager' present in the suggestions module. This means that when editing an ILL request, the 'managedby' defaults to the staff member editing the request, unless 'Keep existing manager' is clicked, like it happens in suggestions. - This is fully core built, all backends will automatically hook into this functionality, because: -- Automatic 'managedby' happen on status change, regardless of backend -- All requests have access to 'edit request' page, regardless of backend - Only if a logged in staff member exists does the auto set manager. If no staff member is found, nothing happens e.g. an ILL request status was changed by a CLI command / cronjob Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188573 [details] [review] 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> Created attachment 188574 [details] [review] Bug 40504: atomicupdate Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188624 [details] [review] Bug 40504: (QA follow-up): Add 'managed by' filter This adds a 'Managed by:' filter input on the left side filters. Created attachment 188625 [details] [review] Bug 40504: (QA follow-up): Add 'managed by' filter This adds a 'Managed by:' filter input on the left side filters. Created attachment 188935 [details] [review] Bug 40504: (QA follow-up): Add 'managed by' filter This adds a 'Managed by:' filter input on the left side filters. Signed-off-by: Jeremy Evans <Jeremy.Evans@ukhsa.gov.uk> Created attachment 188936 [details] [review] Bug 40504: [DONT PUSH] dbic  |