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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-1 / +11 lines)
Lines 46-52 Link Here
46
            [%- END -%]
46
            [%- END -%]
47
            [% SET tr_class = hold.suspend ? 'suspend' : '' %]
47
            [% SET tr_class = hold.suspend ? 'suspend' : '' %]
48
            <tr class="[% tr_class | html %]">
48
            <tr class="[% tr_class | html %]">
49
                <td><input type="checkbox" class="select_hold" data-id="[% hold.reserve_id | html %]"  data-item_level_hold="[% hold.item_level_hold | html %]" data-itemnumber="[% hold.itemnumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-waiting="[% hold.atdestination | html %]" data-intransit="[% hold.intransit | html %]"/></td>
49
                <td
50
                    ><input
51
                        type="checkbox"
52
                        class="select_hold"
53
                        data-id="[% hold.reserve_id | html %]"
54
                        data-item_level_hold="[% hold.item_level_hold | html %]"
55
                        data-itemnumber="[% hold.itemnumber | html %]"
56
                        data-biblionumber="[% hold.biblionumber | html %]"
57
                        data-waiting="[% hold.atdestination | html %]"
58
                        data-intransit="[% hold.intransit | html %]"
59
                /></td>
50
                <td style="min-width:185px;" data-order="[% priority | html %]">
60
                <td style="min-width:185px;" data-order="[% priority | html %]">
51
                    <div>
61
                    <div>
52
                        <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
62
                        <input type="hidden" name="reserve_id" value="[% hold.reserve_id | html %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-95 lines)
Lines 1854-1954 Link Here
1854
        }
1854
        }
1855
1855
1856
         $(document).ready(function() {
1856
         $(document).ready(function() {
1857
            $("#itemSearchForm").on("submit", function (event) {
1858
                event.preventDefault();
1859
                $('#move_hold_item_confirm').prop('disabled' , true );
1860
1861
                let externalID = $("#external_id").val();
1862
                let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`;
1863
1864
                $.ajax({
1865
                    url: apiUrl,
1866
                    method: "GET",
1867
                    dataType: "json",
1868
                    success: function (data) {
1869
                        // Filter for exact matches only
1870
                        let exactMatches = data.filter(item => item.external_id === externalID);
1871
                        if (exactMatches.length > 0) {
1872
                            let resultHtml = "";
1873
                            $.each(exactMatches, function (index, item) {
1874
                                resultHtml += `
1875
                                    <div class="alert alert-success">
1876
                                        <strong>Biblionumber:</strong> ${item.biblio_id} <br>
1877
                                        <strong>Item:</strong> ${item.external_id} <br>
1878
                                        <input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}">
1879
                                        <label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label>
1880
                                        <input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}">
1881
                                    </div>
1882
                                    <hr />
1883
                                `;
1884
                            });
1885
                            $("#itemResultMessage").html(resultHtml);
1886
                        } else {
1887
                            $("#itemResultMessage").html(`
1888
                                <div class="alert alert-warning">No item found with barcode: ${externalID}.</div>
1889
                            `);
1890
                        }
1891
                    },
1892
                });
1893
            });
1894
1895
            $("#biblioSearchForm").on("submit", function (event) {
1896
                event.preventDefault();
1897
                $('#move_hold_biblio_confirm').prop('disabled' , true );
1898
1899
                let biblioID = parseInt( $("#biblio_id").val() );
1900
                let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`;
1901
                $.ajax({
1902
                    url: apiUrl,
1903
                    method: "GET",
1904
                    dataType: "json",
1905
                    headers: {
1906
                        'Accept': 'application/json'
1907
                    },
1908
                    success: function (data) {
1909
                        // Filter for exact matches only
1910
                        let exactMatches = data.filter(item => item.biblio_id === biblioID);
1911
1912
1913
                        if (exactMatches.length > 0) {
1914
                            let resultHtml = "";
1915
                            $.each(exactMatches, function (index, item) {
1916
                                resultHtml += `
1917
                                    <div class="alert alert-success">
1918
                                        <strong>Biblionumber:</strong> ${item.biblio_id} <br>
1919
                                        <input id="new_biblionumber_${item.biblio_id}" name="new_biblionumber" type="checkbox" value="${item.biblio_id}">
1920
                                        <label for="new_biblionumber_${item.biblio_id}">Move all selected record level holds to this record</label>
1921
                                    </div>
1922
                                    <hr />
1923
                                `;
1924
                            });
1925
                            $("#biblioResultMessage").html(resultHtml);
1926
                        } else {
1927
                            $("#biblioResultMessage").html(`
1928
                                <div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div>
1929
                            `);
1930
                        }
1931
                    }
1932
                });
1933
            });
1934
1935
            $(document).on("change", 'input[name="new_itemnumber"]', function() {
1936
                $('input[name="new_itemnumber"]').not(this).prop("checked", false);
1937
                if ( $('input[name="new_itemnumber"]:checked').length ){
1938
                    $('#move_hold_item_confirm').prop( 'disabled' , false );
1939
                } else {
1940
                    $('#move_hold_item_confirm').prop( 'disabled' , true );
1941
                }
1942
            });
1943
1944
            $(document).on("change", 'input[name="new_biblionumber"]', function() {
1945
                $('input[name="new_biblionumber"]').not(this).prop("checked", false);
1946
                if ( $('input[name="new_biblionumber"]:checked').length ){
1947
                    $('#move_hold_biblio_confirm').prop('disabled' , false );
1948
                } else {
1949
                    $('#move_hold_biblio_confirm').prop('disabled' , true );
1950
                }
1951
            });
1952
1857
1953
            $("#always_show_holds").change(function(){
1858
            $("#always_show_holds").change(function(){
1954
                if( $(this).prop('checked') ){
1859
                if( $(this).prop('checked') ){
(-)a/koha-tmpl/intranet-tmpl/prog/js/holds.js (-1 / +108 lines)
Lines 729-734 $(document).ready(function () { Link Here
729
    });
729
    });
730
730
731
    var MSG_CANCEL_SELECTED = __("Cancel selected (%s)");
731
    var MSG_CANCEL_SELECTED = __("Cancel selected (%s)");
732
    var MSG_MOVE_SELECTED = __("Move selected (%s)");
732
    var MSG_CANCEL_ALERT = __(
733
    var MSG_CANCEL_ALERT = __(
733
        "This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."
734
        "This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."
734
    );
735
    );
Lines 794-799 $(document).ready(function () { Link Here
794
                $(".holds_table .select_hold:checked").length
795
                $(".holds_table .select_hold:checked").length
795
            )
796
            )
796
        );
797
        );
798
        $(".move_selected_holds").html(
799
            MSG_MOVE_SELECTED.format(
800
                $(".holds_table .select_hold:checked").length
801
            )
802
        );
797
        $(".suspend_selected_holds").html(
803
        $(".suspend_selected_holds").html(
798
            MSG_SUSPEND_SELECTED.format(
804
            MSG_SUSPEND_SELECTED.format(
799
                $(".holds_table .select_hold:checked").length
805
                $(".holds_table .select_hold:checked").length
Lines 833-843 $(document).ready(function () { Link Here
833
                )
839
                )
834
                .join(",") +
840
                .join(",") +
835
            "]";
841
            "]";
842
        $(".move_selected_holds").prop("disabled", count);
836
    });
843
    });
837
844
838
    $(".holds_table").on("click", ".select_hold", function () {
845
    $(".holds_table").on("click", ".select_hold", function () {
839
        var table = $(this).parents(".holds_table");
846
        var table = $(this).parents(".holds_table");
840
        var count = $(".select_hold:not(:checked)", table).length;
847
        var count = $(".select_hold:not(:checked)", table).length;
848
        var checked_count = $(".select_hold:checked", table).length;
841
        $(".select_hold_all", table).prop("checked", !count);
849
        $(".select_hold_all", table).prop("checked", !count);
842
        updateSelectedHoldsButtonCounters();
850
        updateSelectedHoldsButtonCounters();
843
        $("#cancel_hold_alert").html(
851
        $("#cancel_hold_alert").html(
Lines 859-864 $(document).ready(function () { Link Here
859
                )
867
                )
860
                .join(",") +
868
                .join(",") +
861
            "]";
869
            "]";
870
        $(".move_selected_holds").prop("disabled", !checked_count);
862
    });
871
    });
863
872
864
    $(".cancel_selected_holds").click(function (e) {
873
    $(".cancel_selected_holds").click(function (e) {
Lines 911-916 $(document).ready(function () { Link Here
911
        return false;
920
        return false;
912
    });
921
    });
913
922
923
    $("#itemSearchForm").on("submit", function (event) {
924
        event.preventDefault();
925
        $("#move_hold_item_confirm").prop("disabled", true);
926
927
        let externalID = $("#external_id").val();
928
        let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`;
929
930
        $.ajax({
931
            url: apiUrl,
932
            method: "GET",
933
            dataType: "json",
934
            success: function (data) {
935
                // Filter for exact matches only
936
                let exactMatches = data.filter(
937
                    item => item.external_id === externalID
938
                );
939
                if (exactMatches.length > 0) {
940
                    let resultHtml = "";
941
                    $.each(exactMatches, function (index, item) {
942
                        resultHtml += `
943
                            <div class="alert alert-success">
944
                                <strong>Biblionumber:</strong> ${item.biblio_id} <br>
945
                                <strong>Item:</strong> ${item.external_id} <br>
946
                                <input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}">
947
                                <label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label>
948
                                <input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}">
949
                            </div>
950
                            <hr />
951
                        `;
952
                    });
953
                    $("#itemResultMessage").html(resultHtml);
954
                } else {
955
                    $("#itemResultMessage").html(`
956
                        <div class="alert alert-warning">No item found with barcode: ${externalID}.</div>
957
                    `);
958
                }
959
            },
960
        });
961
    });
962
963
    $("#biblioSearchForm").on("submit", function (event) {
964
        event.preventDefault();
965
        $("#move_hold_biblio_confirm").prop("disabled", true);
966
967
        let biblioID = parseInt($("#biblio_id").val());
968
        let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`;
969
        $.ajax({
970
            url: apiUrl,
971
            method: "GET",
972
            dataType: "json",
973
            headers: {
974
                Accept: "application/json",
975
            },
976
            success: function (data) {
977
                // Filter for exact matches only
978
                let exactMatches = data.filter(
979
                    item => item.biblio_id === biblioID
980
                );
981
982
                if (exactMatches.length > 0) {
983
                    let resultHtml = "";
984
                    $.each(exactMatches, function (index, item) {
985
                        resultHtml += `
986
                            <div class="alert alert-success">
987
                                <strong>Biblionumber:</strong> ${item.biblio_id} <br>
988
                                <input id="new_biblionumber_${item.biblio_id}" name="new_biblionumber" type="checkbox" value="${item.biblio_id}">
989
                                <label for="new_biblionumber_${item.biblio_id}">Move all selected record level holds to this record</label>
990
                            </div>
991
                            <hr />
992
                        `;
993
                    });
994
                    $("#biblioResultMessage").html(resultHtml);
995
                } else {
996
                    $("#biblioResultMessage").html(`
997
                        <div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div>
998
                    `);
999
                }
1000
            },
1001
        });
1002
    });
1003
1004
    $(document).on("change", 'input[name="new_itemnumber"]', function () {
1005
        $('input[name="new_itemnumber"]').not(this).prop("checked", false);
1006
        if ($('input[name="new_itemnumber"]:checked').length) {
1007
            $("#move_hold_item_confirm").prop("disabled", false);
1008
        } else {
1009
            $("#move_hold_item_confirm").prop("disabled", true);
1010
        }
1011
    });
1012
1013
    $(document).on("change", 'input[name="new_biblionumber"]', function () {
1014
        $('input[name="new_biblionumber"]').not(this).prop("checked", false);
1015
        if ($('input[name="new_biblionumber"]:checked').length) {
1016
            $("#move_hold_biblio_confirm").prop("disabled", false);
1017
        } else {
1018
            $("#move_hold_biblio_confirm").prop("disabled", true);
1019
        }
1020
    });
1021
914
    function _append_patron_page_cancel_hold_modal_data(hold) {
1022
    function _append_patron_page_cancel_hold_modal_data(hold) {
915
        $("#cancel_modal_form #inputs").append(
1023
        $("#cancel_modal_form #inputs").append(
916
            '<input type="hidden" name="rank-request" value="del">'
1024
            '<input type="hidden" name="rank-request" value="del">'
917
- 

Return to bug 31698