Bugzilla – Attachment 81272 Details for
Bug 21608
Arranging holds priority with dropdowns is faulty when there are waiting/intransit holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21608: Disable dropdown for found holds - add button to revert
Bug-21608-Disable-dropdown-for-found-holds---add-b.patch (text/plain), 5.69 KB, created by
Martin Renvoize (ashimema)
on 2018-10-26 10:33:15 UTC
(
hide
)
Description:
Bug 21608: Disable dropdown for found holds - add button to revert
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-10-26 10:33:15 UTC
Size:
5.69 KB
patch
obsolete
>From 10072d87c80dd823b61ccdebc3e0ab2f6771c902 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 25 Oct 2018 11:45:25 +0000 >Subject: [PATCH] Bug 21608: Disable dropdown for found holds - add button to > revert > >This patch disables the dropdown for found holds, and adds a new button >to revert the waiting status, setting the hold to priority 1 > >Additionally we remove some changes from 19469 and update the JS to skip >found holds when updating priority > >To test: >1 - Find a record with multiple items >2 - Place 4 holds (or more) >3 - Capture one ohld as waiting, one as in transit >4 - View the holds on the record - switch the last to priority one >5 - Waiting and transit statuses get confused >6 - Apply patch >7 - Observe dropdown is now disabled for waiting holds >8 - Confirm other holds operate as expected >9 - Confirm 'Revert found status' resets hold > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Reserves.pm | 5 ++++ > .../prog/en/includes/holds_table.inc | 6 ++--- > .../prog/en/modules/reserve/request.tt | 27 +++++++++---------- > 3 files changed, 20 insertions(+), 18 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 78e8f6a360..bdf0e0a130 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1425,6 +1425,11 @@ sub _FixPriority { > my $sth = $dbh->prepare($query); > $sth->execute( $reserve_id ); > } >+ elsif ( $hold && $hold->found() && $rank > 0 ) { >+ $hold->found(undef); >+ $hold->store(); >+ } >+ > my @priority; > > # get whats left >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 25af3b94e0..b92a6dc7b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -26,10 +26,10 @@ > <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" /> > <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" /> > <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" /> >- [% IF Koha.Preference('HoldsSplitQueue') == "nothing" %] >+ [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %] > <select name="rank-request"> > [% ELSE %] >- <select name="rank-request" disabled> >+ <select name="rank-request" disabled="disabled"> > [% END %] > [% IF ( hold.found ) %] > [% IF ( hold.intransit ) %] >@@ -191,7 +191,7 @@ > [% END %] > > [% ELSE %] >- <input type="hidden" name="suspend_until" value="" /> >+ <input type="button" value="Revert found status" onclick="window.location.href='request.pl?action=move&where=down&first_priority=[% first_priority | html %]&last_priority=[% last_priority | html %]&prev_priority=0&next_priority=1&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]'"> > [% END %] > </td> > [% END # IF SuspendHoldsIntranet %] >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 30ce360652..6a3a78561f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -798,29 +798,26 @@ > } > }); > var prev_rank_request; >- var priorities; > $("select[name=rank-request]").on("focus", function() { > prev_rank_request = $(this).val(); > var row = $(this).parents("tr:first"); >- priorities = row.parent().find("select[name=rank-request]").map( function() { >- return $(this).val(); >- }).get(); > }).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) { >- row.insertBefore(after); >- } else { >- row.insertAfter(after); >+ 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+1+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 = 0; >- row.parent().find("select[name=rank-request]").each(function () { >- $(this).val(priorities[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++; > }); > }); >-- >2.19.1
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 21608
:
80933
|
81131
|
81134
|
81272
|
81835
|
82157
|
82322
|
82652
|
82956
|
82957
|
82958
|
82959
|
83541