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

(-)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;itemnumber=[% hold.itemnumber %]&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 (-15 / +12 lines)
Lines 807-835 Link Here
807
                }
807
                }
808
            });
808
            });
809
            var prev_rank_request;
809
            var prev_rank_request;
810
            var priorities;
811
            $("select[name=rank-request]").on("focus", function() {
810
            $("select[name=rank-request]").on("focus", function() {
812
                prev_rank_request = $(this).val();
811
                prev_rank_request = $(this).val();
813
                var row = $(this).parents("tr:first");
812
                var row = $(this).parents("tr:first");
814
                priorities = row.parent().find("select[name=rank-request]").map( function() {
815
                    return $(this).val();
816
                }).get();
817
            }).change(function() {
813
            }).change(function() {
818
                var row = $(this).parents("tr:first");
814
                var row = $(this).parents("tr:first");
819
                var value = parseInt($(this).val());
815
                var value = parseInt($(this).val());
820
                var rowsCount = row.parent().children('tr').length - 1;
816
                var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
821
                value = value > rowsCount ? rowsCount : value;
817
                if( !isNaN(value) ) {  //If moved to 'del'
822
                var after = row.parent().find("tr:nth-child("+(value+1)+")");
818
                    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)
823
819
                    if (prev_rank_request > value) {
824
                if (prev_rank_request > value) {
820
                        row.insertBefore(after);
825
                    row.insertBefore(after);
821
                    } else {
826
                } else {
822
                        row.insertAfter(after);
827
                    row.insertAfter(after);
823
                    }
828
                }
824
                }
829
825
830
                var next_priority = 0;
826
                var next_priority = 1;
831
                row.parent().find("select[name=rank-request]").each(function () {
827
                $("select[name=rank-request]").each(function () {
832
                    $(this).val(priorities[next_priority]);
828
                    if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
829
                    $(this).val(next_priority);
833
                    next_priority++;
830
                    next_priority++;
834
                });
831
                });
835
            });
832
            });
(-)a/reserve/request.pl (-8 / +12 lines)
Lines 86-98 my $action = $input->param('action'); Link Here
86
$action ||= q{};
86
$action ||= q{};
87
87
88
if ( $action eq 'move' ) {
88
if ( $action eq 'move' ) {
89
  my $where          = $input->param('where');
89
  my $where           = $input->param('where');
90
  my $reserve_id     = $input->param('reserve_id');
90
  my $reserve_id      = $input->param('reserve_id');
91
  my $prev_priority  = $input->param('prev_priority');
91
  my $prev_priority   = $input->param('prev_priority');
92
  my $next_priority  = $input->param('next_priority');
92
  my $next_priority   = $input->param('next_priority');
93
  my $first_priority = $input->param('first_priority');
93
  my $first_priority  = $input->param('first_priority');
94
  my $last_priority  = $input->param('last_priority');
94
  my $last_priority   = $input->param('last_priority');
95
  AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
95
  my $hold_itemnumber = $input->param('itemnumber');
96
  if ( $prev_priority == 0 && $next_priority == 1 ){
97
      C4::Reserves::RevertWaitingStatus({ itemnumber => $hold_itemnumber });
98
  } else {
99
      AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
100
  }
96
} elsif ( $action eq 'cancel' ) {
101
} elsif ( $action eq 'cancel' ) {
97
  my $reserve_id = $input->param('reserve_id');
102
  my $reserve_id = $input->param('reserve_id');
98
  my $hold = Koha::Holds->find( $reserve_id );
103
  my $hold = Koha::Holds->find( $reserve_id );
99
- 

Return to bug 21608