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

(-)a/Koha/REST/V1/Holds.pm (-2 / +5 lines)
Lines 84-89 sub add { Link Here
84
        my $item_type         = $body->{item_type};
84
        my $item_type         = $body->{item_type};
85
        my $expiration_date   = $body->{expiration_date};
85
        my $expiration_date   = $body->{expiration_date};
86
        my $notes             = $body->{notes};
86
        my $notes             = $body->{notes};
87
        my $hold_date         = C4::Context->preference( 'AllowHoldDateInFuture' )?$body->{hold_date}:undef;
87
88
88
        if ( $item_id and $biblio_id ) {
89
        if ( $item_id and $biblio_id ) {
89
90
Lines 135-141 sub add { Link Here
135
            ? C4::Reserves::CanItemBeReserved( $patron_id, $item_id )
136
            ? C4::Reserves::CanItemBeReserved( $patron_id, $item_id )
136
            : C4::Reserves::CanBookBeReserved( $patron_id, $biblio_id );
137
            : C4::Reserves::CanBookBeReserved( $patron_id, $biblio_id );
137
138
138
        unless ( $can_place_hold->{status} eq 'OK' ) {
139
        my $can_override = C4::Context->preference('AllowHoldPolicyOverride');
140
141
        unless ($can_override || $can_place_hold->{status} eq 'OK' ) {
139
            return $c->render(
142
            return $c->render(
140
                status => 403,
143
                status => 403,
141
                openapi =>
144
                openapi =>
Lines 156-162 sub add { Link Here
156
            $biblio_id,
159
            $biblio_id,
157
            undef,    # $bibitems param is unused
160
            undef,    # $bibitems param is unused
158
            $priority,
161
            $priority,
159
            undef,    # hold date, we don't allow it currently
162
            $hold_date,
160
            $expiration_date,
163
            $expiration_date,
161
            $notes,
164
            $notes,
162
            $biblio->title,
165
            $biblio->title,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-3 / +18 lines)
Lines 948-953 Link Here
948
            [% END %][% END %][% END %]
948
            [% END %][% END %][% END %]
949
        };
949
        };
950
        var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
950
        var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
951
        var ERROR_MAP = {
952
            damaged: _("Item damaged"),
953
            ageRestricted: _("Age restricted"),
954
            tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
955
            tooManyReservesToday: _("Daily hold limit reached for patron"),
956
            tooManyReserves: _("Too many holds"),
957
            notReservable: _("Not holdable"),
958
            cannotReserveFromOtherBranches: _("Patron is from different library"),
959
            itemAlreadyOnHold: _("Patron already has hold for this item"),
960
            cannotBeTransferred: _("Cannot be transferred to pickup library")
961
        }
951
        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
962
        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
952
963
953
        $(document).ready(function() {
964
        $(document).ready(function() {
Lines 1005-1011 Link Here
1005
1016
1006
            $("#club-request-form, #hold-request-form").on("submit", function() {
1017
            $("#club-request-form, #hold-request-form").on("submit", function() {
1007
                let $t = $(this);
1018
                let $t = $(this);
1008
                $('.clubalert').addClass('hide');
1019
                $('.clubalert, .holdalert').addClass('hide');
1009
                let biblionumbers = [biblionumber];
1020
                let biblionumbers = [biblionumber];
1010
                let biblionumbers_text;
1021
                let biblionumbers_text;
1011
                const data = {
1022
                const data = {
Lines 1048-1054 Link Here
1048
                            document.location = url;
1059
                            document.location = url;
1049
                        })
1060
                        })
1050
                        .fail(function(err) {
1061
                        .fail(function(err) {
1051
                            $('.clubalert, .holdalert').removeClass('hide').html(err.responseJSON.error);
1062
                            var message = err.responseJSON.error;
1063
                            var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1064
                            if(match && ERROR_MAP[match[1]]) {
1065
                                message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1066
                            }
1067
                            $('.clubalert, .holdalert').removeClass('hide').html(message);
1052
                        });
1068
                        });
1053
                    }
1069
                    }
1054
                });
1070
                });
1055
- 

Return to bug 23710