View | Details | Raw Unified | Return to bug 21608
Collapse All | Expand All

(-)a/C4/Reserves.pm (+5 lines)
Lines 1425-1430 sub _FixPriority { Link Here
1425
        my $sth = $dbh->prepare($query);
1425
        my $sth = $dbh->prepare($query);
1426
        $sth->execute( $reserve_id );
1426
        $sth->execute( $reserve_id );
1427
    }
1427
    }
1428
    elsif ( $hold && $hold->found() && $rank > 0 ) {
1429
        $hold->found(undef);
1430
        $hold->store();
1431
    }
1432
1428
    my @priority;
1433
    my @priority;
1429
1434
1430
    # get whats left
1435
    # get whats left
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-3 / +3 lines)
Lines 26-35 Link Here
26
                <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
26
                <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
27
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
27
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
28
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
28
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
29
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" %]
29
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
30
                    <select name="rank-request">
30
                    <select name="rank-request">
31
                [% ELSE %]
31
                [% ELSE %]
32
                    <select name="rank-request" disabled>
32
                    <select name="rank-request" disabled="disabled">
33
                [% END %]
33
                [% END %]
34
                    [% IF ( hold.found ) %]
34
                    [% IF ( hold.found ) %]
35
                        [% IF ( hold.intransit ) %]
35
                        [% IF ( hold.intransit ) %]
Lines 191-197 Link Here
191
                        [% END %]
191
                        [% END %]
192
192
193
                    [% ELSE %]
193
                    [% ELSE %]
194
                        <input type="hidden" name="suspend_until" value="" />
194
                        <input type="button" value="Revert found status" onclick="window.location.href='request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=0&amp;next_priority=1&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]'">
195
                    [% END %]
195
                    [% END %]
196
                </td>
196
                </td>
197
            [% END # IF SuspendHoldsIntranet %]
197
            [% END # IF SuspendHoldsIntranet %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-16 / +12 lines)
Lines 798-826 Link Here
798
                }
798
                }
799
            });
799
            });
800
            var prev_rank_request;
800
            var prev_rank_request;
801
            var priorities;
802
            $("select[name=rank-request]").on("focus", function() {
801
            $("select[name=rank-request]").on("focus", function() {
803
                prev_rank_request = $(this).val();
802
                prev_rank_request = $(this).val();
804
                var row = $(this).parents("tr:first");
803
                var row = $(this).parents("tr:first");
805
                priorities = row.parent().find("select[name=rank-request]").map( function() {
806
                    return $(this).val();
807
                }).get();
808
            }).change(function() {
804
            }).change(function() {
809
                var row = $(this).parents("tr:first");
805
                var row = $(this).parents("tr:first");
810
                var value = parseInt($(this).val());
806
                var value = parseInt($(this).val());
811
                var rowsCount = row.parent().children('tr').length - 1;
807
                var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
812
                value = value > rowsCount ? rowsCount : value;
808
                if( !isNaN(value) ) {  //If moved to 'del'
813
                var after = row.parent().find("tr:nth-child("+(value+1)+")");
809
                    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)
814
810
                    if (prev_rank_request > value) {
815
                if (prev_rank_request > value) {
811
                        row.insertBefore(after);
816
                    row.insertBefore(after);
812
                    } else {
817
                } else {
813
                        row.insertAfter(after);
818
                    row.insertAfter(after);
814
                    }
819
                }
815
                }
820
816
821
                var next_priority = 0;
817
                var next_priority = 1;
822
                row.parent().find("select[name=rank-request]").each(function () {
818
                $("select[name=rank-request]").each(function () {
823
                    $(this).val(priorities[next_priority]);
819
                    if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
820
                    $(this).val(next_priority);
824
                    next_priority++;
821
                    next_priority++;
825
                });
822
                });
826
            });
823
            });
827
- 

Return to bug 21608