Bugzilla – Attachment 118585 Details for
Bug 27894
Add visual feedback on overridden pickup locations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27894: Add visual feedback on overridden pickup locations
Bug-27894-Add-visual-feedback-on-overridden-pickup.patch (text/plain), 4.85 KB, created by
Kyle M Hall (khall)
on 2021-03-22 11:21:23 UTC
(
hide
)
Description:
Bug 27894: Add visual feedback on overridden pickup locations
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-03-22 11:21:23 UTC
Size:
4.85 KB
patch
obsolete
>From a41ad51bc228dc46f4413774a160915c8559e9a1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 11 Mar 2021 10:46:58 -0300 >Subject: [PATCH] Bug 27894: Add visual feedback on overridden pickup locations > >This patch takes advantage of the previous changes, and makes the >select2 dropdown display a warning sign (with a tooltip) on pickup >locations that, if chosen, it would mean a circ rule would be >overridden. > >To test: >1. Have some pickup locations that are not valid for existing holds and > AllowHoldPolicyOverride set to "Don't allow" >2. Visit a biblio with some holds >3. Choose a hold that cannot use some pickup location and use the > dropdown >=> SUCCESS: Only valid pickup locations are retrieved >4. Set Allow HoldPolicyOverride to "Allow" >5. Refresh the page (I usually click on the Holds tab) >6 .Repeat 3 >=> SUCCESS: All pickup locations in the system are displayed >=> FAIL: No visual feedback on overridden pickup locations :-( >7. Apply this patch and refresh the page >8. Repeat 3 >=> SUCCESS: All pickup locations in the systema are displayed >=> SUCCESS: Visual feedback on overridden pickup locations is shown! >9. Set AllowHoldPolicyOverride to "Don't allow" >10. Repeat 3 >=> SUCCESS: Only valid pickup locations are retrieved >=> SUCCESS: No overrridden warn/symbol, as expected >11. Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/modules/reserve/request.tt | 32 +++++++++++++------ > 1 file changed, 23 insertions(+), 9 deletions(-) > >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 5dfff18595..957f0bec6f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1157,6 +1157,22 @@ > }); > [% END %] > >+ function display_pickup_location (state) { >+ var $text; >+ if ( state.needs_override === true ) { >+ $text = $( >+ '<span>' + state.text + '</span> <span style="float:right;" title="' + >+ _("This pickup location is not allowed according to circulation rules") + >+ '"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span>' >+ ); >+ } >+ else { >+ $text = $('<span>'+state.text+'</span>'); >+ } >+ >+ return $text; >+ }; >+ > $(".pickup_location_dropdown").each( function () { > var this_dropdown = $(this); > var hold_id = $(this).data('hold_id'); >@@ -1164,34 +1180,32 @@ > this_dropdown.select2({ > allowClear: false, > ajax: { >- [%- IF Koha.Preference('AllowHoldPolicyOverride') -%] >- url: '/api/v1/libraries', >- [%- ELSE -%] > url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations', >- [%- END -%] > delay: 300, // wait 300 milliseconds before triggering the request > dataType: 'json', > data: function (params) { > var search_term = (params.term === undefined) ? '' : params.term; > var query = { >- "q": JSON.stringify({"name":{"-like":search_term+'%'},"pickup_location":1}), >+ "q": JSON.stringify({"name":{"-like":search_term+'%'}}), > "_order_by": "name" > }; > return query; > }, > processResults: function (data) { > var results = []; >- data.forEach( function ( library ) { >+ data.forEach( function ( pickup_location ) { > results.push( > { >- "id": library.library_id.escapeHtml(), >- "text": library.name.escapeHtml() >+ "id": pickup_location.library_id.escapeHtml(), >+ "text": pickup_location.name.escapeHtml(), >+ "needs_override": pickup_location.needs_override > } > ); > }); > return { "results": results }; > } >- } >+ }, >+ templateResult: display_pickup_location > }); > }); > }); >-- >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 27894
:
118121
|
118122
|
118123
|
118583
|
118584
|
118585
|
119167
|
119168
|
119169