From 23d4046635ea588842fbc4c7c152a12002855d7a Mon Sep 17 00:00:00 2001 From: Nick Clemens 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 -%] - - [%- ELSE -%] - - [%- 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 @@ [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %] - [% ELSE %] - + [% END %] - - [% ELSE %] - - [% IF ( hold.found ) %] [% IF ( hold.found == 'T' ) %] - + In transit [% ELSIF ( hold.found == 'P' ) %] - + In processing [% ELSE %] - + Waiting [% END %] [% ELSE %] - + [% END %] - [% END %] [%- 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 @@

Existing holds

-
- [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] - [% IF hold_cancellation %] - - - [% END %] -
[% 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