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 715-720 $(document).ready(function () { Link Here
715
    });
715
    });
716
716
717
    var MSG_CANCEL_SELECTED = __("Cancel selected (%s)");
717
    var MSG_CANCEL_SELECTED = __("Cancel selected (%s)");
718
    var MSG_MOVE_SELECTED = __("Move selected (%s)");
718
    var MSG_CANCEL_ALERT = __(
719
    var MSG_CANCEL_ALERT = __(
719
        "This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."
720
        "This action will cancel <span class='badge bg-danger'>%s</span> hold(s)."
720
    );
721
    );
Lines 780-785 $(document).ready(function () { Link Here
780
                $(".holds_table .select_hold:checked").length
781
                $(".holds_table .select_hold:checked").length
781
            )
782
            )
782
        );
783
        );
784
        $(".move_selected_holds").html(
785
            MSG_MOVE_SELECTED.format(
786
                $(".holds_table .select_hold:checked").length
787
            )
788
        );
783
        $(".suspend_selected_holds").html(
789
        $(".suspend_selected_holds").html(
784
            MSG_SUSPEND_SELECTED.format(
790
            MSG_SUSPEND_SELECTED.format(
785
                $(".holds_table .select_hold:checked").length
791
                $(".holds_table .select_hold:checked").length
Lines 819-829 $(document).ready(function () { Link Here
819
                )
825
                )
820
                .join(",") +
826
                .join(",") +
821
            "]";
827
            "]";
828
        $(".move_selected_holds").prop("disabled", count);
822
    });
829
    });
823
830
824
    $(".holds_table").on("click", ".select_hold", function () {
831
    $(".holds_table").on("click", ".select_hold", function () {
825
        var table = $(this).parents(".holds_table");
832
        var table = $(this).parents(".holds_table");
826
        var count = $(".select_hold:not(:checked)", table).length;
833
        var count = $(".select_hold:not(:checked)", table).length;
834
        var checked_count = $(".select_hold:checked", table).length;
827
        $(".select_hold_all", table).prop("checked", !count);
835
        $(".select_hold_all", table).prop("checked", !count);
828
        updateSelectedHoldsButtonCounters();
836
        updateSelectedHoldsButtonCounters();
829
        $("#cancel_hold_alert").html(
837
        $("#cancel_hold_alert").html(
Lines 845-850 $(document).ready(function () { Link Here
845
                )
853
                )
846
                .join(",") +
854
                .join(",") +
847
            "]";
855
            "]";
856
        $(".move_selected_holds").prop("disabled", !checked_count);
848
    });
857
    });
849
858
850
    $(".cancel_selected_holds").click(function (e) {
859
    $(".cancel_selected_holds").click(function (e) {
Lines 897-902 $(document).ready(function () { Link Here
897
        return false;
906
        return false;
898
    });
907
    });
899
908
909
    $("#itemSearchForm").on("submit", function (event) {
910
        event.preventDefault();
911
        $("#move_hold_item_confirm").prop("disabled", true);
912
913
        let externalID = $("#external_id").val();
914
        let apiUrl = `/api/v1/items?external_id=${encodeURIComponent(externalID)}`;
915
916
        $.ajax({
917
            url: apiUrl,
918
            method: "GET",
919
            dataType: "json",
920
            success: function (data) {
921
                // Filter for exact matches only
922
                let exactMatches = data.filter(
923
                    item => item.external_id === externalID
924
                );
925
                if (exactMatches.length > 0) {
926
                    let resultHtml = "";
927
                    $.each(exactMatches, function (index, item) {
928
                        resultHtml += `
929
                            <div class="alert alert-success">
930
                                <strong>Biblionumber:</strong> ${item.biblio_id} <br>
931
                                <strong>Item:</strong> ${item.external_id} <br>
932
                                <input id="new_itemnumber_${item.item_id}" name="new_itemnumber" type="checkbox" value="${item.item_id}">
933
                                <label for="new_itemnumber_${item.item_id}">Move all selected item level holds to this item</label>
934
                                <input id="new_biblionumber_${item.item_id}" name="new_biblionumber" type="hidden" value="${item.biblio_id}">
935
                            </div>
936
                            <hr />
937
                        `;
938
                    });
939
                    $("#itemResultMessage").html(resultHtml);
940
                } else {
941
                    $("#itemResultMessage").html(`
942
                        <div class="alert alert-warning">No item found with barcode: ${externalID}.</div>
943
                    `);
944
                }
945
            },
946
        });
947
    });
948
949
    $("#biblioSearchForm").on("submit", function (event) {
950
        event.preventDefault();
951
        $("#move_hold_biblio_confirm").prop("disabled", true);
952
953
        let biblioID = parseInt($("#biblio_id").val());
954
        let apiUrl = `/api/v1/biblios?q={"biblio_id":"${encodeURIComponent(biblioID)}"}`;
955
        $.ajax({
956
            url: apiUrl,
957
            method: "GET",
958
            dataType: "json",
959
            headers: {
960
                Accept: "application/json",
961
            },
962
            success: function (data) {
963
                // Filter for exact matches only
964
                let exactMatches = data.filter(
965
                    item => item.biblio_id === biblioID
966
                );
967
968
                if (exactMatches.length > 0) {
969
                    let resultHtml = "";
970
                    $.each(exactMatches, function (index, item) {
971
                        resultHtml += `
972
                            <div class="alert alert-success">
973
                                <strong>Biblionumber:</strong> ${item.biblio_id} <br>
974
                                <input id="new_biblionumber_${item.biblio_id}" name="new_biblionumber" type="checkbox" value="${item.biblio_id}">
975
                                <label for="new_biblionumber_${item.biblio_id}">Move all selected record level holds to this record</label>
976
                            </div>
977
                            <hr />
978
                        `;
979
                    });
980
                    $("#biblioResultMessage").html(resultHtml);
981
                } else {
982
                    $("#biblioResultMessage").html(`
983
                        <div class="alert alert-warning">No record found with biblionumber: ${biblioID}.</div>
984
                    `);
985
                }
986
            },
987
        });
988
    });
989
990
    $(document).on("change", 'input[name="new_itemnumber"]', function () {
991
        $('input[name="new_itemnumber"]').not(this).prop("checked", false);
992
        if ($('input[name="new_itemnumber"]:checked').length) {
993
            $("#move_hold_item_confirm").prop("disabled", false);
994
        } else {
995
            $("#move_hold_item_confirm").prop("disabled", true);
996
        }
997
    });
998
999
    $(document).on("change", 'input[name="new_biblionumber"]', function () {
1000
        $('input[name="new_biblionumber"]').not(this).prop("checked", false);
1001
        if ($('input[name="new_biblionumber"]:checked').length) {
1002
            $("#move_hold_biblio_confirm").prop("disabled", false);
1003
        } else {
1004
            $("#move_hold_biblio_confirm").prop("disabled", true);
1005
        }
1006
    });
1007
900
    function _append_patron_page_cancel_hold_modal_data(hold) {
1008
    function _append_patron_page_cancel_hold_modal_data(hold) {
901
        $("#cancel_modal_form #inputs").append(
1009
        $("#cancel_modal_form #inputs").append(
902
            '<input type="hidden" name="rank-request" value="del">'
1010
            '<input type="hidden" name="rank-request" value="del">'
903
- 

Return to bug 31698