Bugzilla – Attachment 183470 Details for
Bug 39371
Holds to Place Count should have a character limit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39371: Limit "Holds to place" input based on holds_per_record rule and prompt for multiple holds To test: 1. Go to place a hold for a patron. Under "Hold next available item," the "Holds to place (count)" field should default to 1. Before applying t
Bug-39371-Limit-Holds-to-place-input-based-on-hold.patch (text/plain), 55.31 KB, created by
Laura Escamilla
on 2025-06-24 16:34:42 UTC
(
hide
)
Description:
Bug 39371: Limit "Holds to place" input based on holds_per_record rule and prompt for multiple holds To test: 1. Go to place a hold for a patron. Under "Hold next available item," the "Holds to place (count)" field should default to 1. Before applying t
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2025-06-24 16:34:42 UTC
Size:
55.31 KB
patch
obsolete
>From f51f684ec31ef39070dd3fa0576fe7eeac716c23 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Tue, 24 Jun 2025 16:29:54 +0000 >Subject: [PATCH] =?UTF-8?q?Bug=2039371:=20Limit=20"Holds=20to=20place"=20i?= > =?UTF-8?q?nput=20based=20on=20holds=5Fper=5Frecord=20rule=20and=20prompt?= > =?UTF-8?q?=20for=20multiple=20holds=20To=20test:=201.=20Go=20to=20place?= > =?UTF-8?q?=20a=20hold=20for=20a=20patron.=20Under=20"Hold=20next=20availa?= > =?UTF-8?q?ble=20item,"=20the=20"Holds=20to=20place=20(count)"=20field=20s?= > =?UTF-8?q?hould=20default=20to=201.=E2=80=A8Before=20applying=20the=20pat?= > =?UTF-8?q?ch,=20this=20input:=20=20=20=20=20*=20Has=20no=20maximum=20limi?= > =?UTF-8?q?t=20=20=20=20=20*=20Allows=20entry=20of=20any=20number,=20even?= > =?UTF-8?q?=20extremely=20high=20values=20=20=20=20=20*=20Does=20not=20sho?= > =?UTF-8?q?w=20a=20confirmation=20prompt=202.=20Apply=20the=20patch.=203.?= > =?UTF-8?q?=20Repeat=20step=201.=20Now:=20=20=20=20=20*=20The=20maximum=20?= > =?UTF-8?q?number=20of=20holds=20allowed=20is=20based=20on=20the=20holds?= > =?UTF-8?q?=5Fper=5Frecord=20circulation=20rule=20=20=20=20=20=20=20=20=20?= > =?UTF-8?q?*=20If=20holds=5Fper=5Frecord=20is=20set=20(e.g.,=202),=20you?= > =?UTF-8?q?=20cannot=20enter=20more=20than=20that=20=20=20=20=20=20=20=20?= > =?UTF-8?q?=20*=20If=20it's=20blank=20(meaning=20unlimited),=20no=20max=20?= > =?UTF-8?q?is=20set=20=20=20=20=20*=20A=20note=20appears=20under=20the=20i?= > =?UTF-8?q?nput:=20=20=20=20=20=20=20=20=20*=20=E2=80=9CThe=20maximum=20nu?= > =?UTF-8?q?mber=20of=20holds=20to=20place=20is=202.=E2=80=9D=20(or=20whate?= > =?UTF-8?q?ver=20the=20rule=20is)=20=20=20=20=20=20=20=20=20*=20Or:=20?= > =?UTF-8?q?=E2=80=9CThere=20is=20no=20set=20maximum=20for=20holds.?= > =?UTF-8?q?=E2=80=9D=20if=20blank=20=20=20=20=20*=20If=20you=20enter=20mor?= > =?UTF-8?q?e=20than=201,=20you=20will=20see=20a=20confirmation=20prompt:?= > =?UTF-8?q?=20=20=20=20=20=20=20=20=20*=20=E2=80=9CAre=20you=20sure=20you?= > =?UTF-8?q?=20want=20to=20place=203=20hold(s)=3F=E2=80=9D=20=20=20=20=20*?= > =?UTF-8?q?=20If=20you=20enter=201=20hold,=20it=20proceeds=20without=20pro?= > =?UTF-8?q?mpting=204.=20Try=20entering=200=20or=20leaving=20the=20field?= > =?UTF-8?q?=20blank:=20=20=20=20=20*=20The=20minimum=20is=20enforced=20as?= > =?UTF-8?q?=201=20=20=20=20=20*=20The=20system=20defaults=20back=20to=20pl?= > =?UTF-8?q?acing=201=20hold=205.=20Confirm=20that=20the=20input=20box:=20?= > =?UTF-8?q?=20=20=20=20*=20Allows=20up/down=20arrows=20if=20a=20numeric=20?= > =?UTF-8?q?max=20is=20set=20=20=20=20=20*=20Behaves=20correctly=20with=20k?= > =?UTF-8?q?eyboard=20input=20=20=20=20=20*=20Respects=20the=20configured?= > =?UTF-8?q?=20circulation=20rule=206.=20Sign=20off=20and=20have=20an=20ama?= > =?UTF-8?q?zing=20day!=20=F0=9F=8E=89?= >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >--- > .../prog/en/modules/reserve/request.tt | 902 +++++++++--------- > 1 file changed, 463 insertions(+), 439 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 1a949d3c4b..c38ef6f2f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -661,7 +661,21 @@ > [% UNLESS remaining_holds_for_record == 1 %] > <li> > <label for="holds_to_place_count">Holds to place (count)</label> >- <input type="text" inputmode="numeric" pattern="[0-9]*" id="holds_to_place_count" name="holds_to_place_count" value="1" /> >+ <input >+ type="number" >+ inputmode="numeric" >+ pattern="[0-9]*" >+ id="holds_to_place_count" >+ name="holds_to_place_count" >+ value="1" >+ min="1" >+ [% IF max_holds_for_record %]max="[% max_holds_for_record | html %]"[% END %] >+ /> >+ [% IF max_holds_for_record %] >+ <p class="hint">The maximum number of holds to place is [% max_holds_for_record %].</p> >+ [% ELSE %] >+ <p class="hint">There is no set maximum for holds.</p> >+ [% END %] > </li> > [% ELSE %] > <input type="hidden" name="holds_to_place_count" value="1" /> >@@ -1432,507 +1446,517 @@ > [% END %] > <script> > $(document).ready(function () { >- hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %]; >- $("#patron_holds_table").kohaTable( >- { >- paging: false, >- bKohaColumnsUseNames: true, >- }, >- hold_table_settings >- ); >+ hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %]; >+ $("#patron_holds_table").kohaTable( >+ { >+ paging: false, >+ bKohaColumnsUseNames: true, >+ }, >+ hold_table_settings >+ ); >+ }); >+ var biblionumbers = [[% biblionumbers.join(', ') | $raw %]]; >+ var borrowernumber = "[% patron.borrowernumber | $raw %]"; >+ var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]"; >+ var override_items = {[% FOREACH biblio_info IN biblioloop %][% FOREACH itemloo IN biblio_info.itemloop %][% IF ( itemloo.override ) %] >+ [% itemloo.itemnumber | html %]: { >+ homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]", >+ holdallowed: "[% itemloo.holdallowed | html %]" >+ }, >+ [% END %][% END %][% END %] >+ }; >+ var ERROR_MAP = { >+ damaged: _("Item damaged"), >+ ageRestricted: _("Age restricted"), >+ tooManyHoldsForThisRecord: _("Exceeded max holds per record"), >+ tooManyReservesToday: _("Daily hold limit reached for patron"), >+ tooManyReserves: _("Too many holds"), >+ notReservable: _("Not holdable"), >+ noReservesAllowed: _("No reserves allowed"), >+ cannotReserveFromOtherBranches: _("Patron is from different library"), >+ itemAlreadyOnHold: _("Patron already has hold for this item"), >+ cannotBeTransferred: _("Cannot be transferred to pickup library"), >+ pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed") >+ } >+ >+ var MSG_CANCEL_SELECTED = _("Cancel selected (%s)"); >+ var MSG_CANCEL_ALERT = _("This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."); >+ var MSG_CONFIRM_PLACE_HOLDS = _("Are you sure you want to place %s hold(s)?"); >+ $.fn.select2.defaults.set("width", "100%" ); >+ $.fn.select2.defaults.set("dropdownAutoWidth", true ); >+ $("form").on("submit", function(e) { >+ var countInput = document.getElementById("holds_to_place_count"); >+ if (countInput) { >+ var count = parseInt(countInput.value, 10) || 1; >+ if (count > 1 && !confirm(MSG_CONFIRM_PLACE_HOLDS.replace("%s", count))) { >+ e.preventDefault(); >+ } >+ } > }); >- var biblionumbers = [[% biblionumbers.join(', ') | $raw %]]; >- var borrowernumber = "[% patron.borrowernumber | $raw %]"; >- var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]"; >- var override_items = {[% FOREACH biblio_info IN biblioloop %][% FOREACH itemloo IN biblio_info.itemloop %][% IF ( itemloo.override ) %] >- [% itemloo.itemnumber | html %]: { >- homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]", >- holdallowed: "[% itemloo.holdallowed | html %]" >- }, >- [% END %][% END %][% END %] >- }; >- var ERROR_MAP = { >- damaged: _("Item damaged"), >- ageRestricted: _("Age restricted"), >- tooManyHoldsForThisRecord: _("Exceeded max holds per record"), >- tooManyReservesToday: _("Daily hold limit reached for patron"), >- tooManyReserves: _("Too many holds"), >- notReservable: _("Not holdable"), >- noReservesAllowed: _("No reserves allowed"), >- cannotReserveFromOtherBranches: _("Patron is from different library"), >- itemAlreadyOnHold: _("Patron already has hold for this item"), >- cannotBeTransferred: _("Cannot be transferred to pickup library"), >- pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed") >- } > >- var MSG_CANCEL_SELECTED = _("Cancel selected (%s)"); >- var MSG_CANCEL_ALERT = _("This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."); >- $.fn.select2.defaults.set("width", "100%" ); >- $.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 { >+ $(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(); >+ } >+ }); > >- if( $("#circ_holds_select").length > 0 ){ >- [% SET active = clubs ? 1 : 0 %] >- /* Set active tab based on whether a club search was submitted */ >- var tabs = $("#circ_holds_select li:eq(" + [% active | $raw %] + ") a").tab("show"); >- $( tabs[0].hash ).find("input.focus").focus(); >+ if( $("#circ_holds_select").length > 0 ){ >+ [% SET active = clubs ? 1 : 0 %] >+ /* Set active tab based on whether a club search was submitted */ >+ var tabs = $("#circ_holds_select li:eq(" + [% active | $raw %] + ") a").tab("show"); >+ $( tabs[0].hash ).find("input.focus").focus(); > >- /* Change active focus when tabs change */ >- $("#circ_holds_select a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { >- active_tab = e.target.hash; >- $( active_tab ).find("input.focus").focus(); >- }); >- } >+ /* Change active focus when tabs change */ >+ $("#circ_holds_select a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { >+ active_tab = e.target.hash; >+ $( active_tab ).find("input.focus").focus(); >+ }); >+ } > > >- ToggleHoldsToPlace(); >- $("#requestany,.requestspecific[name='request'],.requestgrp").on('change', function(){ >- ToggleHoldsToPlace(); >- }); >+ ToggleHoldsToPlace(); >+ $("#requestany,.requestspecific[name='request'],.requestgrp").on('change', function(){ >+ ToggleHoldsToPlace(); >+ }); > >- [% IF Koha.Preference('UseBranchTransferLimits') %] >- $("#pickup,#pickup-next-avail,#pickup-item-group").on('change', function(){ >- var pickup = $(this).val(); >- var url = "?pickup=" + pickup; >- url += "&borrowernumber=" + borrowernumber; >- url += "&biblionumber=" + biblionumbers[0]; >- window.location.replace(url); >- }); >- [% END %] >+ [% IF Koha.Preference('UseBranchTransferLimits') %] >+ $("#pickup,#pickup-next-avail,#pickup-item-group").on('change', function(){ >+ var pickup = $(this).val(); >+ var url = "?pickup=" + pickup; >+ url += "&borrowernumber=" + borrowernumber; >+ url += "&biblionumber=" + biblionumbers[0]; >+ window.location.replace(url); >+ }); >+ [% END %] > >- var my_table = $("#requestspecific").kohaTable({ >- paging: false, >- dom: '<"top pager"ilf>t', >- }); >+ var my_table = $("#requestspecific").kohaTable({ >+ paging: false, >+ dom: '<"top pager"ilf>t', >+ }); > >- $("#club-request-form").on("submit", function() { >- let $t = $(this); >- $('.clubalert, .holdalert').addClass('hide'); >- const data = { >- pickup_library_id: $('select[name="pickup"]').val() >- }; >- if($('input[name="checkitem"]:checked').length) >- data.item_id = $('input[name="checkitem"]:checked').val(); >- if($('input[name="item_group_id"]:checked').length) >- data.item_group_id = $('input[name="item_group_id"]:checked').val(); >- if($('input[name="borrowernumber"]').length) >- data.patron_id = $('input[name="borrowernumber"]').val(); >- if($('textarea[name="notes"]').length) >- data.notes = $('textarea[name="notes"]').val()||null; >- if($('input[name="itemtype"]').length) { >- data.item_type = $('input[name="itemtype"]').val()||null; >- } >- if($('input[name="default_patron_home"]:checked').length) { >- data.default_patron_home = 1; >- } >+ $("#club-request-form").on("submit", function() { >+ let $t = $(this); >+ $('.clubalert, .holdalert').addClass('hide'); >+ const data = { >+ pickup_library_id: $('select[name="pickup"]').val() >+ }; >+ if($('input[name="checkitem"]:checked').length) >+ data.item_id = $('input[name="checkitem"]:checked').val(); >+ if($('input[name="item_group_id"]:checked').length) >+ data.item_group_id = $('input[name="item_group_id"]:checked').val(); >+ if($('input[name="borrowernumber"]').length) >+ data.patron_id = $('input[name="borrowernumber"]').val(); >+ if($('textarea[name="notes"]').length) >+ data.notes = $('textarea[name="notes"]').val()||null; >+ if($('input[name="itemtype"]').length) { >+ data.item_type = $('input[name="itemtype"]').val()||null; >+ } >+ if($('input[name="default_patron_home"]:checked').length) { >+ data.default_patron_home = 1; >+ } > >- const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1; >- var newloc = 'request.pl?'; >- biblionumbers.forEach(function (biblionumber) { >- newloc += '&biblionumber=' + biblionumber; >- }); >+ const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1; >+ var newloc = 'request.pl?'; >+ biblionumbers.forEach(function (biblionumber) { >+ newloc += '&biblionumber=' + biblionumber; >+ }); > >- biblionumbers.forEach(function(biblionumber) { >- data.biblio_id = biblionumber; >- let options = { >- url: $t.attr('action'), >- method: $t.attr('method').toUpperCase(), >- contentType: 'application/json', >- data: JSON.stringify(data) >- }; >- for(let i = 0; i < count; i++) { >- $.ajax(options) >- .then(function(result) { >- document.location = newloc; >- }) >- .fail(function(err) { >- var message = err.responseJSON.error; >- var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/); >- if(match && ERROR_MAP[match[1]]) { >- message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>' >+ biblionumbers.forEach(function(biblionumber) { >+ data.biblio_id = biblionumber; >+ let options = { >+ url: $t.attr('action'), >+ method: $t.attr('method').toUpperCase(), >+ contentType: 'application/json', >+ data: JSON.stringify(data) >+ }; >+ for(let i = 0; i < count; i++) { >+ $.ajax(options) >+ .then(function(result) { >+ document.location = newloc; >+ }) >+ .fail(function(err) { >+ var message = err.responseJSON.error; >+ var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/); >+ if(match && ERROR_MAP[match[1]]) { >+ message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>' >+ } >+ $('.clubalert, .holdalert').removeClass('hide').html(message); >+ }); > } >- $('.clubalert, .holdalert').removeClass('hide').html(message); > }); >- } >- }); > >- return false; >- }); >+ return false; >+ }); > >- [% UNLESS ( multi_hold ) %] >- $("#hold-request-form").on("submit", function(e){ >- return check(e, $(this)); >- }); >- [% ELSE %] >- $("#hold-request-form").on("submit", function(){ >- return checkMultiHold(); >- }); >- [% END %] >+ [% UNLESS ( multi_hold ) %] >+ $("#hold-request-form").on("submit", function(e){ >+ return check(e, $(this)); >+ }); >+ [% ELSE %] >+ $("#hold-request-form").on("submit", function(){ >+ return checkMultiHold(); >+ }); >+ [% END %] > >- $(".pickup_location_dropdown").each( function () { >- $(this).pickup_locations_dropdown(); >- }); >+ $(".pickup_location_dropdown").each( function () { >+ $(this).pickup_locations_dropdown(); >+ }); > >- $("#pickup_multi").select2({ >- width: '30%', >- allowClear: true >- }); >+ $("#pickup_multi").select2({ >+ width: '30%', >+ allowClear: true >+ }); > >- $('.multi_pickup_select').select2({ >- width: '100%', >- allowClear: true >- }); >+ $('.multi_pickup_select').select2({ >+ width: '100%', >+ allowClear: true >+ }); > >- $("#pickup_multi").on("change", function() { >- var selection = $(this).val(); >- if ( selection != '' ) { >- $(".multi_pickup_select").each(function() { >- var valid_pickup_locations = $(this).data('pickup-locations'); >- if ( valid_pickup_locations.includes(selection) ) { >- $(this).val(selection); >- $(this).trigger("change"); >+ $("#pickup_multi").on("change", function() { >+ var selection = $(this).val(); >+ if ( selection != '' ) { >+ $(".multi_pickup_select").each(function() { >+ var valid_pickup_locations = $(this).data('pickup-locations'); >+ if ( valid_pickup_locations.includes(selection) ) { >+ $(this).val(selection); >+ $(this).trigger("change"); >+ } >+ }); > } > }); >- } >- }); > >- $("#pickup,#pickup-item-group,#pickup-next-avail").each( function () { >- $(this).pickup_locations_dropdown(); >- }); >- >- $(".pickup_locations").each(function () { >- $(this).pickup_locations_dropdown(); >- }); >- }); >+ $("#pickup,#pickup-item-group,#pickup-next-avail").each( function () { >+ $(this).pickup_locations_dropdown(); >+ }); > >- function ToggleHoldsToPlace() { >- if ( $("#requestany").prop('checked') ) { >- $(".disable_request_any").prop('disabled',true).addClass('disabled').removeClass('enabled'); >- $(".enable_request_any").prop('disabled',false).removeClass('disabled').addClass('enabled'); >- $(".requestspecific,.requestgrp").prop('checked', false); >- } else if( $(".requestspecific").prop('checked') ) { >- $(".disable_request_specific").prop('disabled',true).addClass('disabled').removeClass('enabled'); >- $(".enable_request_specific").prop('disabled',false).removeClass('disabled').addClass('enabled'); >- $("#requestany,.requestgrp").prop('checked', false); >- } else { >- $(".disable_request_group").prop('disabled',true).addClass('disabled').removeClass('enabled'); >- $(".enable_request_group").prop('disabled',false).removeClass('disabled').addClass('enabled'); >- $("#requestany,.requestspecific").prop('checked', false); >- } >- } >+ $(".pickup_locations").each(function () { >+ $(this).pickup_locations_dropdown(); >+ }); >+ }); > >- $('.any_specific').click(function() { >- const fieldset = $(this).find('fieldset:first'); >- >- if ( fieldset.hasClass('disabled') ) { >- $('.enable_request_specific, .enable_request_any, .enable_request_group').removeClass('enabled'); >- const specific_cb = $(this).find('#requestspecificitem'); >- const any_cb = $(this).find('#requestany'); >- const itemgroup_cb = $(this).find('#requestgrp'); >- >- if ( specific_cb.length ) { >- specific_cb.prop('checked', true); >- } else if ( any_cb.length ) { >- any_cb.prop('checked', true); >- } else { >- itemgroup_cb.prop('checked', true); >+ function ToggleHoldsToPlace() { >+ if ( $("#requestany").prop('checked') ) { >+ $(".disable_request_any").prop('disabled',true).addClass('disabled').removeClass('enabled'); >+ $(".enable_request_any").prop('disabled',false).removeClass('disabled').addClass('enabled'); >+ $(".requestspecific,.requestgrp").prop('checked', false); >+ } else if( $(".requestspecific").prop('checked') ) { >+ $(".disable_request_specific").prop('disabled',true).addClass('disabled').removeClass('enabled'); >+ $(".enable_request_specific").prop('disabled',false).removeClass('disabled').addClass('enabled'); >+ $("#requestany,.requestgrp").prop('checked', false); >+ } else { >+ $(".disable_request_group").prop('disabled',true).addClass('disabled').removeClass('enabled'); >+ $(".enable_request_group").prop('disabled',false).removeClass('disabled').addClass('enabled'); >+ $("#requestany,.requestspecific").prop('checked', false); >+ } > } > >- fieldset.removeClass('disabled').addClass('enabled'); >- ToggleHoldsToPlace(); >- } >- }); >+ $('.any_specific').click(function() { >+ const fieldset = $(this).find('fieldset:first'); >+ >+ if ( fieldset.hasClass('disabled') ) { >+ $('.enable_request_specific, .enable_request_any, .enable_request_group').removeClass('enabled'); >+ const specific_cb = $(this).find('#requestspecificitem'); >+ const any_cb = $(this).find('#requestany'); >+ const itemgroup_cb = $(this).find('#requestgrp'); >+ >+ if ( specific_cb.length ) { >+ specific_cb.prop('checked', true); >+ } else if ( any_cb.length ) { >+ any_cb.prop('checked', true); >+ } else { >+ itemgroup_cb.prop('checked', true); >+ } > >- function check( e, table ) { >+ fieldset.removeClass('disabled').addClass('enabled'); >+ ToggleHoldsToPlace(); >+ } >+ }); > >- var msg = ""; >+ function check( e, table ) { > >- if ( $(".requestspecific").is(":checked") ) { >- // requestany not selected, go through the item-specific cases >- var selected_items = $('#requestspecific input[name="checkitem"]:checked'); >- if ( selected_items.length > 0 ) { >- // got item-specific hold requests in the form! >- // verify they have a pickup location selected >+ var msg = ""; > >- if ( selected_items.closest('tr').find(".pickup_locations").val() == '' ) { >+ if ( $(".requestspecific").is(":checked") ) { >+ // requestany not selected, go through the item-specific cases >+ var selected_items = $('#requestspecific input[name="checkitem"]:checked'); >+ if ( selected_items.length > 0 ) { >+ // got item-specific hold requests in the form! >+ // verify they have a pickup location selected > >- msg = _("- Please select a pickup location for the item") + "\n" >- } >- } >- else { >- msg = _("- Please select an item to place a hold") + "\n"; >- } >- } else if ( $("#requestgrp").is(":checked") ) { >- var selected_group = $('#requestgroup input[type="radio"]:checked'); >- if( selected_group.length > 0 ){ >- if( $("#pickup-item-group").length < 1 || $("#pickup-item-grp").val() == "" ){ >- msg = _("- Please select a pickup location for this hold" + "\n"); >+ if ( selected_items.closest('tr').find(".pickup_locations").val() == '' ) { >+ >+ msg = _("- Please select a pickup location for the item") + "\n" >+ } >+ } >+ else { >+ msg = _("- Please select an item to place a hold") + "\n"; >+ } >+ } else if ( $("#requestgrp").is(":checked") ) { >+ var selected_group = $('#requestgroup input[type="radio"]:checked'); >+ if( selected_group.length > 0 ){ >+ if( $("#pickup-item-group").length < 1 || $("#pickup-item-grp").val() == "" ){ >+ msg = _("- Please select a pickup location for this hold" + "\n"); >+ } >+ } else { >+ msg = (_("- Please select an item group to place a hold") + "\n"); >+ } >+ } else { >+ // Requesting next available >+ if( $("#pickup-next-avail").length < 1 || $("#pickup-next-avail").val() == "" || $('#pickup-next-avail').val() === null ){ >+ msg = _("- Please select a pickup location for this hold") + "\n"; >+ } > } >- } else { >- msg = (_("- Please select an item group to place a hold") + "\n"); >- } >- } else { >- // Requesting next available >- if( $("#pickup-next-avail").length < 1 || $("#pickup-next-avail").val() == "" || $('#pickup-next-avail').val() === null ){ >- msg = _("- Please select a pickup location for this hold") + "\n"; >- } >- } > > >- if (msg == "") { >- $('#hold-request-form').preventDoubleFormSubmit(); >- return(true); >- } else { >- e.preventDefault(); >- alert(msg); >- return(false); >- } >- } >+ if (msg == "") { >+ $('#hold-request-form').preventDoubleFormSubmit(); >+ return(true); >+ } else { >+ e.preventDefault(); >+ alert(msg); >+ return(false); >+ } >+ } > >- function checkMultiHold() { >+ function checkMultiHold() { > >- var selected_bibs = $(".multi_hold_item_checkbox:checked"); >- if ( selected_bibs.length > 0 ) { >- // there are biblios selected in the form! >- // verify they have a pickup location selected >+ var selected_bibs = $(".multi_hold_item_checkbox:checked"); >+ if ( selected_bibs.length > 0 ) { >+ // there are biblios selected in the form! >+ // verify they have a pickup location selected > >- var pickup_not_set = 0; >- selected_bibs.each(function() { >- if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) { >- pickup_not_set++; >+ var pickup_not_set = 0; >+ selected_bibs.each(function() { >+ if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) { >+ pickup_not_set++; >+ } >+ else { >+ var bibnum = $(this).attr("title"); >+ } >+ }); >+ if ( pickup_not_set > 0 ) { >+ alert( _("Please make sure all selected titles have a pickup location set") + "\n" ); >+ return false; >+ } > } > else { >- var bibnum = $(this).attr("title"); >+ alert( _("Please select at least one title") + "\n" ); >+ return false; > } >- }); >- if ( pickup_not_set > 0 ) { >- alert( _("Please make sure all selected titles have a pickup location set") + "\n" ); >- return false; >- } >- } >- else { >- alert( _("Please select at least one title") + "\n" ); >- return false; >- } > >- $('#hold-request-form').preventDoubleFormSubmit(); >+ $('#hold-request-form').preventDoubleFormSubmit(); > >- return true; >- } >+ return true; >+ } > >- $(document).ready(function() { >+ $(document).ready(function() { > >- $("#always_show_holds").change(function(){ >- if( $(this).prop('checked') ){ >- document.cookie = "always_show_holds=DO"; >- } else { >- document.cookie = "always_show_holds=DONT"; >- } >- }); >- $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic >- var itemnumber = this.value; >- var msg = ''; >+ $("#always_show_holds").change(function(){ >+ if( $(this).prop('checked') ){ >+ document.cookie = "always_show_holds=DO"; >+ } else { >+ document.cookie = "always_show_holds=DONT"; >+ } >+ }); >+ $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic >+ var itemnumber = this.value; >+ var msg = ''; > >- switch (override_items[itemnumber].holdallowed) { >- case "not_allowed": msg = _("This item normally cannot be put on hold."); break; >- case "from_home_library": msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break; >- } >+ switch (override_items[itemnumber].holdallowed) { >+ case "not_allowed": msg = _("This item normally cannot be put on hold."); break; >+ case "from_home_library": msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break; >+ } > >- msg += "\n\n" + _("Place hold on this item?"); >+ msg += "\n\n" + _("Place hold on this item?"); > >- return confirm(msg); >- }); >- $("button.warning").click(function() { >- return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") ); >- }); >- var prev_rank_request; >- $("select[name=rank-request]").on("focus", function() { >- prev_rank_request = $(this).val(); >- var row = $(this).parents("tr:first"); >- }).change(function() { >- 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 >- if( !isNaN(value) ) { //If moved to 'del' >- var after = row.parent().find(`tr:nth-child(${value+found_holds})`); //Go to the row 1 after the new value (and skip found holds) >- if (prev_rank_request > value) { >- row.insertBefore(after); >- } else { >- row.insertAfter(after); >- } >- } >+ return confirm(msg); >+ }); >+ $("button.warning").click(function() { >+ return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") ); >+ }); >+ var prev_rank_request; >+ $("select[name=rank-request]").on("focus", function() { >+ prev_rank_request = $(this).val(); >+ var row = $(this).parents("tr:first"); >+ }).change(function() { >+ 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 >+ if( !isNaN(value) ) { //If moved to 'del' >+ var after = row.parent().find(`tr:nth-child(${value+found_holds})`); //Go to the row 1 after the new value (and skip found holds) >+ if (prev_rank_request > value) { >+ row.insertBefore(after); >+ } else { >+ row.insertAfter(after); >+ } >+ } > >- 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); >- next_priority++; >- }); >- }); >+ 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); >+ next_priority++; >+ }); >+ }); > >- $(".clear-date").on("click",function(e){ >- e.preventDefault(); >- var fieldID = this.id.replace("clear-date-",""); >- $("#" + fieldID).val(""); >- }); >+ $(".clear-date").on("click",function(e){ >+ e.preventDefault(); >+ var fieldID = this.id.replace("clear-date-",""); >+ $("#" + fieldID).val(""); >+ }); > >- // Confirm cancellation of hold >- let cancel_link; >- $(".cancel-hold").on("click",function(e) { >- e.preventDefault; >- cancel_link = $(this); >- $("#cancel_modal_form #inputs").empty(); >- let reserve_id = cancel_link.data('id'); >- let biblionumber = cancel_link.data('biblionumber'); >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="reserve_id" value="' + reserve_id + '">'); >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="' + biblionumber + '">'); >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="op" value="cud-cancel">'); >- $('#cancelModal').modal('show'); >- return false; >- }); >+ // Confirm cancellation of hold >+ let cancel_link; >+ $(".cancel-hold").on("click",function(e) { >+ e.preventDefault; >+ cancel_link = $(this); >+ $("#cancel_modal_form #inputs").empty(); >+ let reserve_id = cancel_link.data('id'); >+ let biblionumber = cancel_link.data('biblionumber'); >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="reserve_id" value="' + reserve_id + '">'); >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="' + biblionumber + '">'); >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="op" value="cud-cancel">'); >+ $('#cancelModal').modal('show'); >+ return false; >+ }); > >- [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %] >- [% IF ( PatronAutoComplete ) %] >- patron_autocomplete($(".search_patron_filter"), { 'link-to': 'reserve', 'url-params': '[% url_biblio_params | url %]' }); >- [% END %] >- [% END %] >+ [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %] >+ [% IF ( PatronAutoComplete ) %] >+ patron_autocomplete($(".search_patron_filter"), { 'link-to': 'reserve', 'url-params': '[% url_biblio_params | url %]' }); >+ [% END %] >+ [% END %] > >- [% IF Koha.Preference('EnableItemGroupHolds') %] >- $(':radio[name="item_group_id"]').change(function(){ >- $('input[name="checkitem"]').prop('checked', false); >- }); >+ [% IF Koha.Preference('EnableItemGroupHolds') %] >+ $(':radio[name="item_group_id"]').change(function(){ >+ $('input[name="checkitem"]').prop('checked', false); >+ }); > >- $('input[name="checkitem"]').change(function(){ >- $(':radio[name="item_group_id"]').prop('checked', false); >- }); >- [% END %] >+ $('input[name="checkitem"]').change(function(){ >+ $(':radio[name="item_group_id"]').prop('checked', false); >+ }); >+ [% END %] > >- if(!localStorage.selectedHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) { >- localStorage.selectedHolds = []; >- } >+ if(!localStorage.selectedHolds || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) { >+ localStorage.selectedHolds = []; >+ } > >- $('.holds_table .select_hold').each(function() { >- if(localStorage.selectedHolds.includes($(this).data('id'))) { >- $(this).prop('checked', true); >- } >- }); >+ $('.holds_table .select_hold').each(function() { >+ if(localStorage.selectedHolds.includes($(this).data('id'))) { >+ $(this).prop('checked', true); >+ } >+ }); > >- $('.holds_table .select_hold_all').each(function() { >- var table = $(this).parents('.holds_table'); >- var count = $('.select_hold:not(:checked)', table).length; >- $('.select_hold_all', table).prop('checked', !count); >- }); >+ $('.holds_table .select_hold_all').each(function() { >+ var table = $(this).parents('.holds_table'); >+ var count = $('.select_hold:not(:checked)', table).length; >+ $('.select_hold_all', table).prop('checked', !count); >+ }); > >- $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >- >- $('.holds_table .select_hold_all').click(function() { >- var table = $(this).parents('.holds_table'); >- var count = $('.select_hold:checked', table).length; >- $('.select_hold', table).prop('checked', !count); >- $(this).prop('checked', !count); >- $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >- $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); >- $('#cancel_hold_alert').show(); >- localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >- }); >+ $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ >+ $('.holds_table .select_hold_all').click(function() { >+ var table = $(this).parents('.holds_table'); >+ var count = $('.select_hold:checked', table).length; >+ $('.select_hold', table).prop('checked', !count); >+ $(this).prop('checked', !count); >+ $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); >+ $('#cancel_hold_alert').show(); >+ localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >+ }); > >- $('.holds_table .select_hold').click(function() { >- var table = $(this).parents('.holds_table'); >- var count = $('.select_hold:not(:checked)', table).length; >- $('.select_hold_all', table).prop('checked', !count); >- $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >- $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); >- $('#cancel_hold_alert').show(); >- localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >- }); >+ $('.holds_table .select_hold').click(function() { >+ var table = $(this).parents('.holds_table'); >+ var count = $('.select_hold:not(:checked)', table).length; >+ $('.select_hold_all', table).prop('checked', !count); >+ $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length)); >+ $('#cancel_hold_alert').html( MSG_CANCEL_ALERT.format($('.holds_table .select_hold:checked').length)); >+ $('#cancel_hold_alert').show(); >+ localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')); >+ }); > >- $('.cancel_selected_holds').click(function(e) { >- e.preventDefault(); >- if($('.holds_table .select_hold:checked').length) { >- cancel_link = $(this); >- $("#cancel_modal_form #inputs").empty(); >- biblionumbers.forEach( function(biblionumber){ >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="'+biblionumber+'">'); >+ $('.cancel_selected_holds').click(function(e) { >+ e.preventDefault(); >+ if($('.holds_table .select_hold:checked').length) { >+ cancel_link = $(this); >+ $("#cancel_modal_form #inputs").empty(); >+ biblionumbers.forEach( function(biblionumber){ >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="'+biblionumber+'">'); >+ }); >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="op" value="cud-cancel_bulk">'); >+ let hold_ids= $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(','); >+ $("#cancel_modal_form #inputs").append('<input type="hidden" name="ids" value="' + hold_ids + '">'); >+ delete localStorage.selectedHolds; >+ $('#cancelModal').modal('show'); >+ } >+ return false; > }); >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="op" value="cud-cancel_bulk">'); >- let hold_ids= $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(','); >- $("#cancel_modal_form #inputs").append('<input type="hidden" name="ids" value="' + hold_ids + '">'); >- delete localStorage.selectedHolds; >- $('#cancelModal').modal('show'); >- } >- return false; >- }); > >- $(".hold-arrow").click(function(e) { >- e.preventDefault(); >- let arrowForm = $("#hold-actions-form").attr({ >- action: 'request.pl', >- method: 'post' >- }); >- let arrow_op = $("<input />").attr({ >- name: 'op', >- type: 'hidden', >- value: $(this).data('op') >- }); >- let arrow_where = $("<input />").attr({ >- name: 'where', >- type: 'hidden', >- value: $(this).data('where') >- }); >- let arrow_fp = $("<input />").attr({ >- name: 'first_priority', >- type: 'hidden', >- value: $(this).data('first_priority') >- }); >- let arrow_lp = $("<input />").attr({ >- name: 'last_priority', >- type: 'hidden', >- value: $(this).data('last_priority') >- }); >- let arrow_pp = $("<input />").attr({ >- name: 'prev_priority', >- type: 'hidden', >- value: $(this).data('prev_priority') >- }); >- let arrow_np = $("<input />").attr({ >- name: 'next_priority', >- type: 'hidden', >- value: $(this).data('next_priority') >- }); >- let arrow_bn = $("<input />").attr({ >- name: 'borrowernumber', >- type: 'hidden', >- value: $(this).data('borrowernumber') >- }); >- let arrow_bb = $("<input />").attr({ >- name: 'biblionumber', >- type: 'hidden', >- value: $(this).data('biblionumber') >- }); >- let arrow_ri = $("<input />").attr({ >- name: 'reserve_id', >- type: 'hidden', >- value: $(this).data('reserve_id') >- }); >- let arrow_date = $("<input />").attr({ >- name: 'date', >- type: 'hidden', >- value: $(this).data('date') >+ $(".hold-arrow").click(function(e) { >+ e.preventDefault(); >+ let arrowForm = $("#hold-actions-form").attr({ >+ action: 'request.pl', >+ method: 'post' >+ }); >+ let arrow_op = $("<input />").attr({ >+ name: 'op', >+ type: 'hidden', >+ value: $(this).data('op') >+ }); >+ let arrow_where = $("<input />").attr({ >+ name: 'where', >+ type: 'hidden', >+ value: $(this).data('where') >+ }); >+ let arrow_fp = $("<input />").attr({ >+ name: 'first_priority', >+ type: 'hidden', >+ value: $(this).data('first_priority') >+ }); >+ let arrow_lp = $("<input />").attr({ >+ name: 'last_priority', >+ type: 'hidden', >+ value: $(this).data('last_priority') >+ }); >+ let arrow_pp = $("<input />").attr({ >+ name: 'prev_priority', >+ type: 'hidden', >+ value: $(this).data('prev_priority') >+ }); >+ let arrow_np = $("<input />").attr({ >+ name: 'next_priority', >+ type: 'hidden', >+ value: $(this).data('next_priority') >+ }); >+ let arrow_bn = $("<input />").attr({ >+ name: 'borrowernumber', >+ type: 'hidden', >+ value: $(this).data('borrowernumber') >+ }); >+ let arrow_bb = $("<input />").attr({ >+ name: 'biblionumber', >+ type: 'hidden', >+ value: $(this).data('biblionumber') >+ }); >+ let arrow_ri = $("<input />").attr({ >+ name: 'reserve_id', >+ type: 'hidden', >+ value: $(this).data('reserve_id') >+ }); >+ let arrow_date = $("<input />").attr({ >+ name: 'date', >+ type: 'hidden', >+ value: $(this).data('date') >+ }); >+ arrowForm.append(arrow_op,arrow_where,arrow_fp,arrow_lp,arrow_pp,arrow_np,arrow_bn,arrow_bb,arrow_ri,arrow_date); >+ $("#hold-actions-form").submit(); >+ return true; >+ }) > }); >- arrowForm.append(arrow_op,arrow_where,arrow_fp,arrow_lp,arrow_pp,arrow_np,arrow_bn,arrow_bb,arrow_ri,arrow_date); >- $("#hold-actions-form").submit(); >- return true; >- }) >- }); > </script> > <script> > table_settings = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]; >-- >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 39371
:
179482
|
180408
|
183470
|
183471