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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-1 / +45 lines)
Lines 67-73 Link Here
67
                    [% IF failed_holds %]
67
                    [% IF failed_holds %]
68
                        <div class="alert alert-info">
68
                        <div class="alert alert-info">
69
                            <h2>Notice:</h2>
69
                            <h2>Notice:</h2>
70
                            <p>One or more holds were not placed due to existing holds.</p>
70
                            <p>One or more holds were not placed due to following errors:</p>
71
                            <ul>
72
                            [% FOREACH fail IN failed_holds.split('\|') %]
73
                                <li>
74
                                [% SWITCH fail %]
75
                                [% CASE 'damaged' %]
76
                                    <span>Item damaged</span>
77
                                [% CASE 'ageRestricted' %]
78
                                    <span>Age restricted</span>
79
                                [% CASE 'tooManyHoldsForThisRecord' %]
80
                                    <span>Exceeded max holds per record</span>
81
                                [% CASE 'tooManyReservesToday' %]
82
                                    <span>Daily hold limit reached for patron</span>
83
                                [% CASE 'tooManyReserves' %]
84
                                    <span>Too many holds</span>
85
                                [% CASE 'notReservable' %]
86
                                    <span>Not holdable</span>
87
                                [% CASE 'cannotReserveFromOtherBranches' %]
88
                                    <span>Patron is from different library</span>
89
                                [% CASE 'branchNotInHoldGroup' %]
90
                                    <span>Cannot place hold from patron's library</span>
91
                                [% CASE 'itemAlreadyOnHold' %]
92
                                    <span>Patron already has hold for this item</span>
93
                                [% CASE 'cannotBeTransferred' %]
94
                                    <span>Cannot be transferred to pickup library</span>
95
                                [% CASE 'pickupNotInHoldGroup' %]
96
                                    <span>Only pickup locations within the same hold group are allowed</span>
97
                                [% CASE 'noReservesAllowed' %]
98
                                    <span>No holds are allowed on this item</span>
99
                                [% CASE 'libraryNotPickupLocation' %]
100
                                    <span>Library is not a pickup location</span>
101
                                [% CASE 'no_valid_pickup_location' %]
102
                                    <span>No valid pickup location</span>
103
                                [% CASE 'notforloan' %]
104
                                    <span>Not for loan</span>
105
                                [% CASE 'items_available' %]
106
                                    <span>There are items available in the library, please visit to check them out</span>
107
                                [% CASE 'not_placed' %]
108
                                    <span>Error when placing hold, please report this to the library</span>
109
                                [% CASE %]
110
                                    <span>Error: [% fail | html %]</span>
111
                                [% END %]
112
                                </li>
113
                            [% END %]
114
                            </ul>
71
                        </div>
115
                        </div>
72
                    [% END %]
116
                    [% END %]
73
117
(-)a/opac/opac-reserve.pl (-9 / +23 lines)
Lines 212-218 if ( $query->param('place_reserve') ) { Link Here
212
        exit;
212
        exit;
213
    }
213
    }
214
214
215
    my $failed_holds = 0;
215
    my @failed_holds;
216
    while (@selectedItems) {
216
    while (@selectedItems) {
217
        my $biblioNum = shift(@selectedItems);
217
        my $biblioNum = shift(@selectedItems);
218
        my $itemNum   = shift(@selectedItems);
218
        my $itemNum   = shift(@selectedItems);
Lines 264-274 if ( $query->param('place_reserve') ) { Link Here
264
        my $biblio = Koha::Biblios->find($biblioNum);
264
        my $biblio = Koha::Biblios->find($biblioNum);
265
        my $rank = $biblio->holds->search( { found => [ { "!=" => "W" }, undef ] } )->count + 1;
265
        my $rank = $biblio->holds->search( { found => [ { "!=" => "W" }, undef ] } )->count + 1;
266
        if ( $item ) {
266
        if ( $item ) {
267
            $canreserve = 1 if CanItemBeReserved( $patron, $item, $branch )->{status} eq 'OK';
267
            my $status = CanItemBeReserved( $patron, $item, $branch )->{status};
268
            if( $status eq 'OK' ){
269
                $canreserve = 1;
270
            } else {
271
                push @failed_holds, $status;
272
            }
273
268
        }
274
        }
269
        else {
275
        else {
270
            $canreserve = 1
276
            my $status = CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { itemtype => $itemtype } )->{status};
271
              if CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { itemtype => $itemtype } )->{status} eq 'OK';
277
            if( $status eq 'OK'){
278
                $canreserve = 1;
279
            } else {
280
                push @failed_holds, $status;
281
            }
272
282
273
            # Inserts a null into the 'itemnumber' field of 'reserves' table.
283
            # Inserts a null into the 'itemnumber' field of 'reserves' table.
274
            $itemNum = undef;
284
            $itemNum = undef;
Lines 279-284 if ( $query->param('place_reserve') ) { Link Here
279
        if (   $maxreserves
289
        if (   $maxreserves
280
            && $reserve_cnt >= $maxreserves )
290
            && $reserve_cnt >= $maxreserves )
281
        {
291
        {
292
            push @failed_holds, 'tooManyReserves';
282
            $canreserve = 0;
293
            $canreserve = 0;
283
        }
294
        }
284
295
Lines 287-293 if ( $query->param('place_reserve') ) { Link Here
287
            my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
298
            my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
288
            my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } });
299
            my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } });
289
            if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) {
300
            if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) {
290
                $canreserve = 0
301
                $canreserve = 0;
302
                push @failed_holds, 'items_available';
291
            }
303
            }
292
        }
304
        }
293
305
Lines 309-320 if ( $query->param('place_reserve') ) { Link Here
309
                    item_group_id    => $item_group_id,
321
                    item_group_id    => $item_group_id,
310
                }
322
                }
311
            );
323
            );
312
            $failed_holds++ unless $reserve_id;
324
            if( $reserve_id ){
313
            ++$reserve_cnt;
325
                ++$reserve_cnt;
326
            } else {
327
                push @failed_holds, 'not_placed';
328
            }
314
        }
329
        }
315
    }
330
    }
316
331
317
    print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds");
332
    print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( @failed_holds ? "failed_holds=" . join('|',@failed_holds) : q|| ) . "#opac-user-holds");
318
    exit;
333
    exit;
319
}
334
}
320
335
321
- 

Return to bug 33302