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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-24 / +7 lines)
Lines 27-44 Link Here
27
    [%- SET found_holds = 0 -%]
27
    [%- SET found_holds = 0 -%]
28
    [%- SET last_priority  = holds.last.priority -%]
28
    [%- SET last_priority  = holds.last.priority -%]
29
29
30
    [% BLOCK priority_dropdown %]
31
        [%- SET loop_priority = 1 -%]
32
        [%- WHILE loop_priority <= last_priority -%]
33
            [%- IF this_priority == loop_priority -%]
34
                <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option>
35
            [%- ELSE -%]
36
                <option value="[% loop_priority | html %]">[% loop_priority | html %]</option>
37
            [%- END -%]
38
            [%- loop_priority = loop_priority + 1- %]
39
        [%- END -%]
40
    [% END %]
41
42
    [% FOREACH hold IN holds %]
30
    [% FOREACH hold IN holds %]
43
    [%- IF !hold.found && first_priority == 0 -%]
31
    [%- IF !hold.found && first_priority == 0 -%]
44
        [%- first_priority = hold.priority -%]
32
        [%- first_priority = hold.priority -%]
Lines 56-84 Link Here
56
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
44
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
57
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
45
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
58
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
46
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
59
                    <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id | html %]">
60
                    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
47
                    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
61
                        [% PROCESS priority_dropdown %]
48
                        <input type="number" min="1" max="[% last_priority |html %]" name="rank-request" value="[% hold.priority | html %]" data-current_value="[% hold.priority | html %]">
62
                    [% ELSE %]
49
                    [% ELSE %]
63
                        <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
50
                        <input type="number" min="1" max="[% last_priority |html %]" name="rank-request" value="[% hold.priority | html %]" data-current_value="[% hold.priority | html %]">
64
                    [% END %]
51
                    [% END %]
65
                        <option value="del">del</option>
66
                    </select>
67
                [% ELSE %]
52
                [% ELSE %]
68
                    <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
53
                        <input type="hidden" name="rank-request" class="rank-request found" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
69
                    <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
70
                    [% IF ( hold.found ) %]
54
                    [% IF ( hold.found ) %]
71
                        [% IF ( hold.found == 'T' ) %]
55
                        [% IF ( hold.found == 'T' ) %]
72
                            <option value="T" selected="selected">In transit</option>
56
                            In transit
73
                        [% ELSIF ( hold.found == 'P' ) %]
57
                        [% ELSIF ( hold.found == 'P' ) %]
74
                            <option value="P" selected="selected">In processing</option>
58
                            In processing
75
                        [% ELSE %]
59
                        [% ELSE %]
76
                            <option value="W" selected="selected">Waiting</option>
60
                            Waiting
77
                        [% END %]
61
                        [% END %]
78
                    [% ELSE %]
62
                    [% ELSE %]
79
                        <option value="[% hold.priority | html %]" selected="selected">[% this_priority | html %]</option>
63
                        <input type="number" disabled="disabled" name="rank-request" class="rank-request" value="[% this_priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
80
                    [% END %]
64
                    [% END %]
81
                    </select>
82
                [% END %]
65
                [% END %]
83
            </td>
66
            </td>
84
            [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
67
            [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-29 / +7 lines)
Lines 933-950 Link Here
933
                        <h2>Existing holds</h2>
933
                        <h2>Existing holds</h2>
934
                        <div id="toolbar" class="btn-toolbar">
934
                        <div id="toolbar" class="btn-toolbar">
935
                            <input type="submit" name="submit" value="Update hold(s)" /> <button class="cancel_selected_holds" data-bulk="true"></button>
935
                            <input type="submit" name="submit" value="Update hold(s)" /> <button class="cancel_selected_holds" data-bulk="true"></button>
936
                        <fieldset id="cancellation-reason-fieldset" class="action">
937
                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
938
                            [% IF hold_cancellation %]
939
                                <label for="cancellation-reason">Cancellation reason: </label>
940
                                <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
941
                                    <option value="">No reason given</option>
942
                                    [% FOREACH reason IN hold_cancellation %]
943
                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
944
                                    [% END %]
945
                                </select>
946
                            [% END %]
947
                        </fieldset>
948
                        </div>
936
                        </div>
949
937
950
                        [% FOREACH biblioloo IN biblioloop %]
938
                        [% FOREACH biblioloo IN biblioloop %]
Lines 1181-1194 Link Here
1181
        $.fn.select2.defaults.set("dropdownAutoWidth", true );
1169
        $.fn.select2.defaults.set("dropdownAutoWidth", true );
1182
1170
1183
        $(document).ready(function() {
1171
        $(document).ready(function() {
1184
            $('#cancellation-reason-fieldset').hide();
1185
            $('.rank-request').on('change', function() {
1186
                if ( $(".rank-request option:selected[value='del']").length ) {
1187
                    $('#cancellation-reason-fieldset').show();
1188
                } else {
1189
                    $('#cancellation-reason-fieldset').hide();
1190
                }
1191
            });
1192
1172
1193
            [% SET active = clubs ? 1 : 0 %]
1173
            [% SET active = clubs ? 1 : 0 %]
1194
            $('#circ_holds_select').tabs({
1174
            $('#circ_holds_select').tabs({
Lines 1450-1462 Link Here
1450
                }
1430
                }
1451
            });
1431
            });
1452
            var prev_rank_request;
1432
            var prev_rank_request;
1453
            $("select[name=rank-request]").on("focus", function() {
1433
            $("input[name=rank-request]").change(function() {
1454
                prev_rank_request = $(this).val();
1434
                prev_rank_request = $(this).data('current_value');
1455
                var row = $(this).parents("tr:first");
1456
            }).change(function() {
1457
                var row = $(this).parents("tr:first");
1435
                var row = $(this).parents("tr:first");
1458
                var value = parseInt($(this).val());
1436
                var value = parseInt($(this).val());
1459
                var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1437
                var found_holds = $("input[name='rank-request'].found").length ; //Count how many are found
1438
                console.log( found_holds);
1460
                if( !isNaN(value) ) {  //If moved to 'del'
1439
                if( !isNaN(value) ) {  //If moved to 'del'
1461
                    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)
1440
                    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)
1462
                    if (prev_rank_request > value) {
1441
                    if (prev_rank_request > value) {
Lines 1467-1475 Link Here
1467
                }
1446
                }
1468
1447
1469
                var next_priority = 1;
1448
                var next_priority = 1;
1470
                $("select[name=rank-request]").each(function () {
1449
                $("input[name=rank-request]").each(function () {
1471
                    if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1450
                    if( isNaN( $(this).val() ) || $(this).val() == 0 ){ return true; } //Don't reset found or del holds
1472
                    $(this).val(next_priority);
1451
                    $(this).val(next_priority).data('current_value',next_priority);
1473
                    next_priority++;
1452
                    next_priority++;
1474
                });
1453
                });
1475
            });
1454
            });
1476
- 

Return to bug 30270