Bugzilla – Attachment 183092 Details for
Bug 39917
Display a prompt for status alias when completing a request if ILL_STATUS_ALIAS in use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39917: Add new optional 'mark_completed' ILL screen
Bug-39917-Add-new-optional-markcompleted-ILL-scree.patch (text/plain), 6.06 KB, created by
David Nind
on 2025-06-07 06:35:38 UTC
(
hide
)
Description:
Bug 39917: Add new optional 'mark_completed' ILL screen
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-06-07 06:35:38 UTC
Size:
6.06 KB
patch
obsolete
>From 6f7bc534af2b6b98b9158c3a6712cc3e0a83bdc9 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Fri, 16 May 2025 11:39:42 +0000 >Subject: [PATCH] Bug 39917: Add new optional 'mark_completed' ILL screen > >This new 'Mark completed' screen only shows when ILL_STATUS_ALIAS is not empty, i.e. Koha installations that are not using ILL_STATUS_ALIAS will not see any change in their workflow. >Backends that don't implement 'mark_completed' are inherently already making use of core 'mark_completed' and will automatically adopt this enhancement. >Backends that do implement their own mark_completed don't automatically adopt this enhancement and will not see any change in their workflow. > >Test plan: >1) Enable ILLModule sys pref >2) Create a new ILL request: > <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard >3) Add a type, cardnumber and library. Click 'Create'. >4) You should now be on the manage request screen. Click 'Confirm' and 'Confirm request'. >5) You should be on the manage request screen again. Click 'Mark completed'. The request's status became 'Completed'. >6) Add at least one AV entry to ILL_STATUS_ALIAS av category, visit: > <staff_url>/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=ILL_STATUS_ALIAS >7) Add 'abc_code' to 'Authorized value' and 'abc_description' to 'Description'. Click 'Save'. >8) Repeat steps 2 to 5. Notice that when you 'Mark completed' now, a new screen is shown prompting for a status_alias. >9) Pick a status_alias and save. Notice the 'status' now shows the alias. > >Sponsored-by: NHS England >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/ILL/Request.pm | 43 ++++++++++++++----- > .../prog/en/modules/ill/ill-requests.tt | 25 +++++++++++ > 2 files changed, 57 insertions(+), 11 deletions(-) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index 9b151e3924..fda4d98f38 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -910,17 +910,38 @@ Mark a request as completed (status = COMP). > =cut > > sub mark_completed { >- my ($self) = @_; >- $self->status('COMP')->store; >- $self->completed( dt_from_string() )->store; >- return { >- error => 0, >- status => '', >- message => '', >- method => 'mark_completed', >- stage => 'commit', >- next => 'illview', >- }; >+ my ( $self, $params ) = @_; >+ >+ my $stage = $params->{stage}; >+ >+ my $status_aliases_exist = Koha::AuthorisedValues->search( { category => 'ILL_STATUS_ALIAS' } )->count; >+ >+ if ( ( !$stage || $stage eq 'init' ) && $status_aliases_exist ) { >+ return { >+ method => 'mark_completed', >+ }; >+ } elsif ( !$stage || $stage eq 'complete' ) { >+ >+ $self->status('COMP'); >+ $self->status_alias( $params->{status_alias} ) if $params->{status_alias}; >+ $self->completed( dt_from_string() ); >+ $self->store; >+ return { >+ stage => 'commit', >+ next => 'illview', >+ }; >+ } else { >+ >+ # Invalid stage, return error. >+ return { >+ error => 1, >+ status => 'unknown_stage', >+ message => '', >+ method => 'confirm', >+ stage => $params->{stage}, >+ value => {}, >+ }; >+ } > } > > =head2 backend_illview >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index 26ba077ed9..63974c3f9d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -45,6 +45,8 @@ > <span>Manage request [% request.id_prefix _ request.illrequest_id | html %]</span> > [% ELSIF op == 'confirm' %] > <span>Confirm request [% request.id_prefix _ request.illrequest_id | html %]</span> >+ [% ELSIF op == 'mark_completed' %] >+ <span>Complete request request [% request.id_prefix _ request.illrequest_id | html %]</span> > [% ELSIF op == 'delete_confirm' %] > <span>Delete request [% request.id_prefix _ request.illrequest_id | html %]</span> > [% ELSIF op == 'generic_confirm' %] >@@ -115,6 +117,29 @@ > [% ELSIF op == 'confirm' %] > <h1>Confirm ILL request</h1> > [% PROCESS $whole.template %] >+ [% ELSIF op == 'mark_completed' %] >+ <h1>Complete ILL request</h1> >+ <p>Proceeding with this action will set this request to 'Completed'.</p> >+ <p>You can select a status alias from the available options:</p> >+ <p> >+ [% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %] >+ [% proceed_url = base_url _ "?method=mark_completed&stage=complete" _ "&illrequest_id=" _ request.illrequest_id %] >+ <form action="[% proceed_url | url %]" method="get"> >+ <select name="status_alias"> >+ <option value="" selected></option> >+ [% FOREACH alias IN AuthorisedValues.Get('ILL_STATUS_ALIAS') %] >+ <option value="[% alias.authorised_value | html %]" > [% alias.lib | html %] </option> >+ [% END %] >+ </select> >+ <input type="hidden" name="method" value="mark_completed"> >+ <input type="hidden" name="stage" value="complete"> >+ <input type="hidden" name="illrequest_id" value="[% request.illrequest_id %]"> >+ <fieldset class="action"> >+ <button type="submit" class="btn btn-sm btn-primary">Complete request</button> >+ <a class="btn btn-sm btn-default cancel" href="[% base_url | url %]">Cancel</a> >+ </fieldset> >+ </form> >+ </p> > [% ELSIF op == 'cud-cancel' and !whole.error %] > <h1>Cancel a confirmed request</h1> > [% PROCESS $whole.template %] >-- >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 39917
:
182517
|
182518
|
182541
|
183091
| 183092 |
183093