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>
Bug 21608: (follow-up) Use RevertWaitingStatus and do not alter _FixPriority
[EDIT]
Completely removed the changes to Reserves.pm by adding module prefix in
the request.pl script.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3c50245cfe)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
2e6c3b1989
commit
466fc19777
|
|
@ -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 %]&itemnumber=[% hold.itemnumber %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]'">
|
||||
[% END %]
|
||||
</td>
|
||||
[% END # IF SuspendHoldsIntranet %]
|
||||
|
|
|
|||
|
|
@ -807,29 +807,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++;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -86,13 +86,18 @@ my $action = $input->param('action');
|
|||
$action ||= q{};
|
||||
|
||||
if ( $action eq 'move' ) {
|
||||
my $where = $input->param('where');
|
||||
my $reserve_id = $input->param('reserve_id');
|
||||
my $prev_priority = $input->param('prev_priority');
|
||||
my $next_priority = $input->param('next_priority');
|
||||
my $first_priority = $input->param('first_priority');
|
||||
my $last_priority = $input->param('last_priority');
|
||||
AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
|
||||
my $where = $input->param('where');
|
||||
my $reserve_id = $input->param('reserve_id');
|
||||
my $prev_priority = $input->param('prev_priority');
|
||||
my $next_priority = $input->param('next_priority');
|
||||
my $first_priority = $input->param('first_priority');
|
||||
my $last_priority = $input->param('last_priority');
|
||||
my $hold_itemnumber = $input->param('itemnumber');
|
||||
if ( $prev_priority == 0 && $next_priority == 1 ){
|
||||
C4::Reserves::RevertWaitingStatus({ itemnumber => $hold_itemnumber });
|
||||
} else {
|
||||
AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
|
||||
}
|
||||
} elsif ( $action eq 'cancel' ) {
|
||||
my $reserve_id = $input->param('reserve_id');
|
||||
my $hold = Koha::Holds->find( $reserve_id );
|
||||
|
|
|
|||
Loading…
Reference in New Issue