From 1a53f77fa33bf6ee05a9705fe5d64368cc2a2718 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 17 Apr 2018 14:29:27 +0000 Subject: [PATCH] Bug 19469 [QA Followup]: Use hold item's itemtype if available, fix priority changing --- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 16 +++++++++++----- reserve/request.pl | 1 + 2 files changed, 12 insertions(+), 5 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 b0ee7b3276..a8558e3846 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -169,6 +169,8 @@ function checkMultiHold() { }).change(function() { var row = $(this).parents("tr:first"); var value = parseInt($(this).val()); + var rowsCount = row.parent().children('tr').length - 1; + value = value > rowsCount ? rowsCount : value; var after = row.parent().find("tr:nth-child("+(value+1)+")"); if (prev_rank_request > value) { @@ -178,7 +180,7 @@ function checkMultiHold() { } var next_priority = 1; - $("select[name=rank-request]").each(function () { + row.parent().find("select[name=rank-request]").each(function () { $(this).val(next_priority); next_priority++; }); @@ -759,14 +761,16 @@ function checkMultiHold() { [% SET itemtypes = [] %] [% FOREACH h IN biblioloo.reserveloop %] - [% itemtypes.push( h.itemtype ) %] + [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %] + [% itemtypes_all.push( hold_itemtype ) %] [% END %] [% itemtypes = itemtypes.unique %] [% FOREACH i IN itemtypes.sort %] [% SET holds_by_itemtype = [] %] [% FOREACH h IN biblioloo.reserveloop %] - [% IF h.itemtype == i %] + [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %] + [% IF hold_itemtype == i %] [% holds_by_itemtype.push( h ) %] [% END %] [% END %] @@ -800,7 +804,8 @@ function checkMultiHold() { [% SET itemtypes = [] %] [% FOREACH h IN holds_by_branch %] - [% itemtypes.push( h.itemtype ) %] + [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %] + [% itemtypes.push( hold_itemtype ) %] [% END %] [% itemtypes = itemtypes.unique %] @@ -814,7 +819,8 @@ function checkMultiHold() { [% SET holds_by_itemtype = [] %] [% FOREACH h IN holds_by_branch %] - [% IF h.itemtype == i %] + [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %] + [% IF hold_itemtype == i %] [% holds_by_itemtype.push( h ) %] [% END %] [% END %] diff --git a/reserve/request.pl b/reserve/request.pl index 40d35f33eb..0dac3588dc 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -589,6 +589,7 @@ foreach my $biblionumber (@biblionumbers) { $reserve{'reserve_id'} = $res->reserve_id(); $reserve{itemtype} = $res->itemtype(); $reserve{branchcode} = $res->branchcode(); + $reserve{object} = $res; push( @reserveloop, \%reserve ); } -- 2.15.1 (Apple Git-101)