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

(-)a/opac/opac-reserve.pl (-42 / +40 lines)
Lines 131-173 $template->param( branch => $branch ); Link Here
131
131
132
#
132
#
133
#
133
#
134
# Build hashes of the requested biblio(item)s and items.
134
# Here we are carrying out the hold request, possibly
135
#
136
#
137
138
my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
139
foreach my $biblioNumber (@biblionumbers) {
140
141
    my $biblioData = GetBiblioData($biblioNumber);
142
    $biblioDataHash{$biblioNumber} = $biblioData;
143
144
    my @itemInfos = GetItemsInfo($biblioNumber);
145
146
    my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber });
147
148
    # flag indicating existence of at least one item linked via a host record
149
    # adding items linked via host biblios
150
    my @hostitemInfos = GetHostItemsInfo($marcrecord);
151
    if (@hostitemInfos){
152
        push (@itemInfos,@hostitemInfos);
153
    }
154
155
    $biblioData->{itemInfos} = \@itemInfos;
156
157
    # Compute the priority rank.
158
    my $biblio = Koha::Biblios->find( $biblioNumber );
159
    next unless $biblio;
160
161
    $biblioData->{object} = $biblio;
162
    my $reservecount = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count;
163
    $biblioData->{reservecount} = $reservecount;
164
    $biblioData->{rank} = $reservecount + 1;
165
}
166
167
#
168
#
169
# If this is the second time through this script, it
170
# means we are carrying out the hold request, possibly
171
# with a specific item for each biblionumber.
135
# with a specific item for each biblionumber.
172
#
136
#
173
#
137
#
Lines 239-246 if ( $query->param('place_reserve') ) { Link Here
239
            $biblioNum = $item->biblionumber;
203
            $biblioNum = $item->biblionumber;
240
        }
204
        }
241
205
242
        my $biblioData = $biblioDataHash{$biblioNum};
243
244
        # Check for user supplied reserve date
206
        # Check for user supplied reserve date
245
        my $startdate;
207
        my $startdate;
246
        if (   C4::Context->preference('AllowHoldDateInFuture')
208
        if (   C4::Context->preference('AllowHoldDateInFuture')
Lines 251-257 if ( $query->param('place_reserve') ) { Link Here
251
213
252
        my $patron_expiration_date = $query->param("expiration_date_$biblioNum");
214
        my $patron_expiration_date = $query->param("expiration_date_$biblioNum");
253
215
254
        my $rank = $biblioData->{rank};
216
        my $biblio = Koha::Biblios->find($biblioNum);
217
        my $rank = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count + 1;
218
255
        if ( $item ) {
219
        if ( $item ) {
256
            $canreserve = 1 if CanItemBeReserved( $patron, $item, $branch )->{status} eq 'OK';
220
            $canreserve = 1 if CanItemBeReserved( $patron, $item, $branch )->{status} eq 'OK';
257
        }
221
        }
Lines 292-298 if ( $query->param('place_reserve') ) { Link Here
292
                    reservation_date => $startdate,
256
                    reservation_date => $startdate,
293
                    expiration_date  => $patron_expiration_date,
257
                    expiration_date  => $patron_expiration_date,
294
                    notes            => $notes,
258
                    notes            => $notes,
295
                    title            => $biblioData->{title},
259
                    title            => $biblio->title,
296
                    itemnumber       => $itemNum,
260
                    itemnumber       => $itemNum,
297
                    found            => undef,
261
                    found            => undef,
298
                    itemtype         => $itemtype,
262
                    itemtype         => $itemtype,
Lines 307-312 if ( $query->param('place_reserve') ) { Link Here
307
    exit;
271
    exit;
308
}
272
}
309
273
274
#
275
#
276
# Build hashes of the requested biblio(item)s and items.
277
#
278
#
279
280
my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
281
foreach my $biblioNumber (@biblionumbers) {
282
283
    my $biblioData = GetBiblioData($biblioNumber);
284
    $biblioDataHash{$biblioNumber} = $biblioData;
285
286
    my @itemInfos = GetItemsInfo($biblioNumber);
287
288
    my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber });
289
290
    # flag indicating existence of at least one item linked via a host record
291
    # adding items linked via host biblios
292
    my @hostitemInfos = GetHostItemsInfo($marcrecord);
293
    if (@hostitemInfos){
294
        push (@itemInfos,@hostitemInfos);
295
    }
296
297
    $biblioData->{itemInfos} = \@itemInfos;
298
299
    # Compute the priority rank.
300
    my $biblio = Koha::Biblios->find( $biblioNumber );
301
    next unless $biblio;
302
303
    $biblioData->{object} = $biblio;
304
    my $reservecount = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count;
305
    $biblioData->{reservecount} = $reservecount;
306
    $biblioData->{rank} = $reservecount + 1;
307
}
308
310
#
309
#
311
#
310
#
312
# Here we check that the borrower can actually make reserves Stage 1.
311
# Here we check that the borrower can actually make reserves Stage 1.
313
- 

Return to bug 30847