Bugzilla – Attachment 131574 Details for
Bug 30270
Use numeric inputs instead of dropdowns for hold priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30270: Use numeric inputs for holds priority
Bug-30270-Use-numeric-inputs-for-holds-priority.patch (text/plain), 8.98 KB, created by
Nick Clemens (kidclamp)
on 2022-03-10 16:15:33 UTC
(
hide
)
Description:
Bug 30270: Use numeric inputs for holds priority
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-03-10 16:15:33 UTC
Size:
8.98 KB
patch
obsolete
>From 23d4046635ea588842fbc4c7c152a12002855d7a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 10 Mar 2022 16:09:56 +0000 >Subject: [PATCH] Bug 30270: Use numeric inputs for holds priority > >This patch removes the code to generate dropdowns for holds priority >and adjusts it to use numeric inputs > >This does remove the option to set priority to 'del' and use 'Update holds' button >to delete, however, we have a checkbox and 'Cancel selected' which perform the same function >as well as a cancel button for each individual hold > >This patch increases performance of the page by reducing the size of the page > >To test: >1 - Place many holds on a record >2 - View the holds page and verify functionlity when using: > HoldsSplitQueue > HoldsSplitQueueNumbering >3 - Apply patch >4 - Confirm dropdowns are gone >5 - Confirm priorities correctly numbered virtually or actually according to HoldsSplitQueueNumbering >6 - Confirm with all values of HoldsSplitQueue >7 - Confirm cancellation works using checkboxes or button >8 - Confirm hold priority buttons work as before >--- > .../prog/en/includes/holds_table.inc | 31 ++++------------ > .../prog/en/modules/reserve/request.tt | 35 ++++--------------- > 2 files changed, 14 insertions(+), 52 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 dbda7ece69..1052af1510 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -27,18 +27,6 @@ > [%- SET found_holds = 0 -%] > [%- SET last_priority = holds.last.priority -%] > >- [% BLOCK priority_dropdown %] >- [%- SET loop_priority = 1 -%] >- [%- WHILE loop_priority <= last_priority -%] >- [%- IF this_priority == loop_priority -%] >- <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option> >- [%- ELSE -%] >- <option value="[% loop_priority | html %]">[% loop_priority | html %]</option> >- [%- END -%] >- [%- loop_priority = loop_priority + 1- %] >- [%- END -%] >- [% END %] >- > [% FOREACH hold IN holds %] > [%- IF !hold.found && first_priority == 0 -%] > [%- first_priority = hold.priority -%] >@@ -56,29 +44,24 @@ > <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" /> > <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" /> > [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %] >- <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]"> > [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >- [% PROCESS priority_dropdown %] >+ <input type="number" min="1" max="[% last_priority |html %]" name="rank-request" value="[% hold.priority | html %]" data-current_value="[% hold.priority | html %]"> > [% ELSE %] >- <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option> >+ <input type="number" min="1" max="[% last_priority |html %]" name="rank-request" value="[% hold.priority | html %]" data-current_value="[% hold.priority | html %]"> > [% END %] >- <option value="del">del</option> >- </select> > [% ELSE %] >- <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]"> >- <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]"> >+ <input type="hidden" name="rank-request" class="rank-request found" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]"> > [% IF ( hold.found ) %] > [% IF ( hold.found == 'T' ) %] >- <option value="T" selected="selected">In transit</option> >+ In transit > [% ELSIF ( hold.found == 'P' ) %] >- <option value="P" selected="selected">In processing</option> >+ In processing > [% ELSE %] >- <option value="W" selected="selected">Waiting</option> >+ Waiting > [% END %] > [% ELSE %] >- <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option> >+ <input type="number" disabled="disabled" name="rank-request" class="rank-request" value="[% this_priority | html %]" data-hold-id="[% hold.reserve_id | html %]"> > [% END %] >- </select> > [% END %] > </td> > [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%] >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 a7ddc45c8d..4bbd1108db 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -933,18 +933,6 @@ > <h2>Existing holds</h2> > <div id="toolbar" class="btn-toolbar"> > <input type="submit" name="submit" value="Update hold(s)" /> <button class="cancel_selected_holds" data-bulk="true"></button> >- <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 %] >@@ -1181,14 +1169,6 @@ > $.fn.select2.defaults.set("dropdownAutoWidth", true ); > > $(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({ >@@ -1450,13 +1430,12 @@ > } > }); > var prev_rank_request; >- $("select[name=rank-request]").on("focus", function() { >- prev_rank_request = $(this).val(); >- var row = $(this).parents("tr:first"); >- }).change(function() { >+ $("input[name=rank-request]").change(function() { >+ prev_rank_request = $(this).data('current_value'); > var row = $(this).parents("tr:first"); > var value = parseInt($(this).val()); >- var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found >+ var found_holds = $("input[name='rank-request'].found").length ; //Count how many are found >+ console.log( found_holds); > if( !isNaN(value) ) { //If moved to 'del' > var after = row.parent().find("tr:nth-child("+(value+1+found_holds )+")"); //Go to the row 1 after the new value (and skip found holds) > if (prev_rank_request > value) { >@@ -1467,9 +1446,9 @@ > } > > var next_priority = 1; >- $("select[name=rank-request]").each(function () { >- if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds >- $(this).val(next_priority); >+ $("input[name=rank-request]").each(function () { >+ if( isNaN( $(this).val() ) || $(this).val() == 0 ){ return true; } //Don't reset found or del holds >+ $(this).val(next_priority).data('current_value',next_priority); > next_priority++; > }); > }); >-- >2.30.2
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 30270
: 131574