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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-1 / +1 lines)
Lines 191-197 Link Here
191
            [% END %]
191
            [% END %]
192
192
193
            <td>
193
            <td>
194
                <a class="cancel-hold" title="Cancel hold" href="request.pl?action=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
194
                <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
195
                    <img src="[% interface | html %]/[% theme | html %]/img/x.png" alt="Cancel" />
195
                    <img src="[% interface | html %]/[% theme | html %]/img/x.png" alt="Cancel" />
196
                </a>
196
                </a>
197
            </td>
197
            </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-30 / +68 lines)
Lines 801-806 Link Here
801
                        <h2>Existing holds</h2>
801
                        <h2>Existing holds</h2>
802
                        <div id="toolbar" class="btn-toolbar">
802
                        <div id="toolbar" class="btn-toolbar">
803
                            <input type="submit" name="submit" value="Update hold(s)" />
803
                            <input type="submit" name="submit" value="Update hold(s)" />
804
                        <fieldset id="cancellation-reason-fieldset" class="action">
805
                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
806
                            [% IF hold_cancellation %]
807
                                <label for="cancellation-reason">Cancellation reason: </label>
808
                                <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
809
                                    <option value="">No reason given</option>
810
                                    [% FOREACH reason IN hold_cancellation %]
811
                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
812
                                    [% END %]
813
                                </select>
814
                            [% END %]
815
                        </fieldset>
804
                        </div>
816
                        </div>
805
817
806
                        [% FOREACH biblioloo IN biblioloop %]
818
                        [% FOREACH biblioloo IN biblioloop %]
Lines 909-930 Link Here
909
921
910
                            [% END # /IF biblioloo.reserveloop %]
922
                            [% END # /IF biblioloo.reserveloop %]
911
                        [% END # FOREACH biblioloo %]
923
                        [% END # FOREACH biblioloo %]
912
                            <fieldset class="action">
913
                                [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
914
                                [% IF hold_cancellation %]
915
                                    <label for="cancellation-reason">Cancellation reason: </label>
916
                                    <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
917
                                        <option value="">No reason given</option>
918
                                        [% FOREACH reason IN hold_cancellation %]
919
                                            <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
920
                                        [% END %]
921
                                    </select>
922
                                [% END %]
923
                            </fieldset>
924
925
                            <fieldset class="action">
926
                                <input type="submit" name="submit" value="Update hold(s)" />
927
                            </fieldset>
928
                        </fieldset> <!-- /.rows -->
924
                        </fieldset> <!-- /.rows -->
929
                    </form> <!-- /name=TTime -->
925
                    </form> <!-- /name=TTime -->
930
                [% END # IF reserveloop %]
926
                [% END # IF reserveloop %]
Lines 944-949 Link Here
944
        [% END %]
940
        [% END %]
945
    </div> <!-- /.row -->
941
    </div> <!-- /.row -->
946
942
943
    <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
944
        <div class="modal-dialog" role="document">
945
            <div class="modal-content">
946
                <div class="modal-header">
947
                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
948
                    <h3>Confirm deletion</h3>
949
                </div>
950
951
                <div class="modal-body">
952
                    <p>Are you sure you want to cancel this hold?</p>
953
954
                    <fieldset class="action">
955
                        [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
956
                        [% IF hold_cancellation %]
957
                            <label for="cancellation-reason">Cancellation reason: </label>
958
                            <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
959
                                <option value="">No reason given</option>
960
                                [% FOREACH reason IN hold_cancellation %]
961
                                    <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
962
                                [% END %]
963
                            </select>
964
                        [% END %]
965
                    </fieldset>
966
                </div>
967
968
                <div class="modal-footer">
969
                    <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
970
                    <a href="#" data-dismiss="modal">Cancel</a>
971
                </div>
972
            </div>
973
        </div>
974
    </div>
947
975
948
[% MACRO jsinclude BLOCK %]
976
[% MACRO jsinclude BLOCK %]
949
    [% INCLUDE 'datatables.inc' %]
977
    [% INCLUDE 'datatables.inc' %]
Lines 955-962 Link Here
955
        var Sticky;
983
        var Sticky;
956
        var biblionumber = "[% biblionumber | $raw %]";
984
        var biblionumber = "[% biblionumber | $raw %]";
957
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
985
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
958
        var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
959
        var REASON_LABEL = _("Reason: ");
960
        var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
986
        var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
961
        var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
987
        var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
962
        [% itemloo.itemnumber | html %]: {
988
        [% itemloo.itemnumber | html %]: {
Lines 980-985 Link Here
980
        columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
1006
        columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
981
1007
982
        $(document).ready(function() {
1008
        $(document).ready(function() {
1009
            $('#cancellation-reason-fieldset').hide();
1010
            $('.rank-request').on('change', function() {
1011
                if ( $(".rank-request option:selected[value='del']").length ) {
1012
                    $('#cancellation-reason-fieldset').show();
1013
                } else {
1014
                    $('#cancellation-reason-fieldset').hide();
1015
                }
1016
            });
1017
983
            [% SET active = clubs ? 1 : 0 %]
1018
            [% SET active = clubs ? 1 : 0 %]
984
            $('#circ_holds_select').tabs({
1019
            $('#circ_holds_select').tabs({
985
                active: [% active | $raw %],
1020
                active: [% active | $raw %],
Lines 1244-1263 Link Here
1244
                $("#" + fieldID).val("");
1279
                $("#" + fieldID).val("");
1245
            });
1280
            });
1246
1281
1247
            // Confirm cancelation of hold
1282
            // Confirm cancellation of hold
1283
            let cancel_link;
1248
            $(".cancel-hold").on("click",function(e) {
1284
            $(".cancel-hold").on("click",function(e) {
1249
                e.preventDefault;
1285
                e.preventDefault;
1250
                let msg = MSG_CONFIRM_DELETE_HOLD ;
1286
                cancel_link = $(this);
1251
                if ( $("#cancellation-reason").val() ) {
1287
                $('#cancelModal').modal();
1252
                    const reason = $("#cancellation-reason option:selected").text();
1288
                return false;
1253
                    msg += "\n\n" + REASON_LABEL + reason;
1289
            });
1254
                }
1290
            $("#cancelModalConfirmBtn").on("click",function(e) {
1255
                const confirm = confirmDelete(msg);
1291
                let borrowernumber = cancel_link.data('borrowernumber');
1256
                if ( confirm ) {
1292
                let biblionumber = cancel_link.data('biblionumber');
1257
                    let href = $(this).attr('href');
1293
                let reserve_id = cancel_link.data('id');
1258
                    href += "&cancellation-reason=" + $("#cancellation-reason").val();
1294
                let reason = $("#modal-cancellation-reason").val();
1259
                    window.location = href;
1295
                let link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
1296
                if ( reason ) {
1297
                    link += "&amp;cancellation-reason=" + reason
1260
                }
1298
                }
1299
                window.location.href = link;
1261
                return false;
1300
                return false;
1262
            });
1301
            });
1263
1302
1264
- 

Return to bug 25534