Bugzilla – Attachment 108990 Details for
Bug 25534
Add ability to specifying and store a reason when cancelling a hold
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25534: (QA follow-up) Use modal for cancel links, hide reason unless priority is set to 'del'
Bug-25534-QA-follow-up-Use-modal-for-cancel-links-.patch (text/plain), 9.26 KB, created by
Kyle M Hall (khall)
on 2020-08-24 14:52:55 UTC
(
hide
)
Description:
Bug 25534: (QA follow-up) Use modal for cancel links, hide reason unless priority is set to 'del'
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-08-24 14:52:55 UTC
Size:
9.26 KB
patch
obsolete
>From 562f832b4a0a966b826f3000166cf44ef18fa22c Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 24 Aug 2020 10:52:28 -0400 >Subject: [PATCH] Bug 25534: (QA follow-up) Use modal for cancel links, hide > reason unless priority is set to 'del' > >--- > .../prog/en/includes/holds_table.inc | 2 +- > .../prog/en/modules/reserve/request.tt | 97 +++++++++++++------ > 2 files changed, 69 insertions(+), 30 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 3dc61ee242..26791f819d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -191,7 +191,7 @@ > [% END %] > > <td> >- <a class="cancel-hold" title="Cancel hold" href="request.pl?action=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> >+ <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> > <img src="[% interface | html %]/[% theme | html %]/img/x.png" alt="Cancel" /> > </a> > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 92c195b732..f0832ffc37 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -801,6 +801,18 @@ > <h2>Existing holds</h2> > <div id="toolbar" class="btn-toolbar"> > <input type="submit" name="submit" value="Update hold(s)" /> >+ <fieldset id="cancellation-reason-fieldset" class="action"> >+ [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] >+ [% IF hold_cancellation %] >+ <label for="cancellation-reason">Cancellation reason: </label> >+ <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason"> >+ <option value="">No reason given</option> >+ [% FOREACH reason IN hold_cancellation %] >+ <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option> >+ [% END %] >+ </select> >+ [% END %] >+ </fieldset> > </div> > > [% FOREACH biblioloo IN biblioloop %] >@@ -909,22 +921,6 @@ > > [% END # /IF biblioloo.reserveloop %] > [% END # FOREACH biblioloo %] >- <fieldset class="action"> >- [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] >- [% IF hold_cancellation %] >- <label for="cancellation-reason">Cancellation reason: </label> >- <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason"> >- <option value="">No reason given</option> >- [% FOREACH reason IN hold_cancellation %] >- <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option> >- [% END %] >- </select> >- [% END %] >- </fieldset> >- >- <fieldset class="action"> >- <input type="submit" name="submit" value="Update hold(s)" /> >- </fieldset> > </fieldset> <!-- /.rows --> > </form> <!-- /name=TTime --> > [% END # IF reserveloop %] >@@ -944,6 +940,38 @@ > [% END %] > </div> <!-- /.row --> > >+ <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h3>Confirm deletion</h3> >+ </div> >+ >+ <div class="modal-body"> >+ <p>Are you sure you want to cancel this hold?</p> >+ >+ <fieldset class="action"> >+ [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] >+ [% IF hold_cancellation %] >+ <label for="cancellation-reason">Cancellation reason: </label> >+ <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason"> >+ <option value="">No reason given</option> >+ [% FOREACH reason IN hold_cancellation %] >+ <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option> >+ [% END %] >+ </select> >+ [% END %] >+ </fieldset> >+ </div> >+ >+ <div class="modal-footer"> >+ <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button> >+ <a href="#" data-dismiss="modal">Cancel</a> >+ </div> >+ </div> >+ </div> >+ </div> > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >@@ -955,8 +983,6 @@ > var Sticky; > var biblionumber = "[% biblionumber | $raw %]"; > var borrowernumber = "[% patron.borrowernumber | $raw %]"; >- var MSG_CONFIRM_DELETE_HOLD = _("Are you sure you want to cancel this hold?"); >- var REASON_LABEL = _("Reason: "); > var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]"; > var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %] > [% itemloo.itemnumber | html %]: { >@@ -980,6 +1006,15 @@ > columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %] > > $(document).ready(function() { >+ $('#cancellation-reason-fieldset').hide(); >+ $('.rank-request').on('change', function() { >+ if ( $(".rank-request option:selected[value='del']").length ) { >+ $('#cancellation-reason-fieldset').show(); >+ } else { >+ $('#cancellation-reason-fieldset').hide(); >+ } >+ }); >+ > [% SET active = clubs ? 1 : 0 %] > $('#circ_holds_select').tabs({ > active: [% active | $raw %], >@@ -1244,20 +1279,24 @@ > $("#" + fieldID).val(""); > }); > >- // Confirm cancelation of hold >+ // Confirm cancellation of hold >+ let cancel_link; > $(".cancel-hold").on("click",function(e) { > e.preventDefault; >- let msg = MSG_CONFIRM_DELETE_HOLD ; >- if ( $("#cancellation-reason").val() ) { >- const reason = $("#cancellation-reason option:selected").text(); >- msg += "\n\n" + REASON_LABEL + reason; >- } >- const confirm = confirmDelete(msg); >- if ( confirm ) { >- let href = $(this).attr('href'); >- href += "&cancellation-reason=" + $("#cancellation-reason").val(); >- window.location = href; >+ cancel_link = $(this); >+ $('#cancelModal').modal(); >+ return false; >+ }); >+ $("#cancelModalConfirmBtn").on("click",function(e) { >+ let borrowernumber = cancel_link.data('borrowernumber'); >+ let biblionumber = cancel_link.data('biblionumber'); >+ let reserve_id = cancel_link.data('id'); >+ let reason = $("#modal-cancellation-reason").val(); >+ let link = `request.pl?action=cancel&borrowernumber=${ borrowernumber }&biblionumber=${ biblionumber }&reserve_id=${ reserve_id }`; >+ if ( reason ) { >+ link += "&cancellation-reason=" + reason > } >+ window.location.href = link; > return false; > }); > >-- >2.24.1 (Apple Git-126)
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 25534
:
105034
|
105035
|
105036
|
105077
|
105078
|
105079
|
105105
|
105106
|
105108
|
105109
|
105110
|
105111
|
105112
|
105113
|
105114
|
105115
|
105116
|
105117
|
105118
|
105119
|
105120
|
105121
|
105122
|
105147
|
105148
|
105149
|
105150
|
105151
|
108476
|
108477
|
108478
|
108479
|
108480
|
108481
|
108746
|
108747
|
108748
|
108749
|
108750
|
108751
|
108752
|
108753
|
108754
|
108755
|
108756
|
108757
|
108805
|
108806
|
108891
|
108892
|
108893
|
108894
|
108895
|
108896
|
108897
|
108898
|
108899
|
108900
|
108901
|
108902
|
108903
|
108904
|
108977
|
108985
|
108986
| 108990 |
114026
|
114027
|
114788