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

(-)a/opac/opac-reserve.pl (-4 / +25 lines)
Lines 44-49 use Koha::Libraries; Link Here
44
use Koha::Patrons;
44
use Koha::Patrons;
45
use Date::Calc qw/Today Date_to_Days/;
45
use Date::Calc qw/Today Date_to_Days/;
46
use List::MoreUtils qw/uniq/;
46
use List::MoreUtils qw/uniq/;
47
use Data::Dumper;
47
48
48
my $maxreserves = C4::Context->preference("maxreserves");
49
my $maxreserves = C4::Context->preference("maxreserves");
49
50
Lines 192-197 if ( $query->param('place_reserve') ) { Link Here
192
        my @itemnumbers = $query->param("checkitem_$biblioNum");
193
        my @itemnumbers = $query->param("checkitem_$biblioNum");
193
        my $branch = $query->param("branch_$biblioNum");
194
        my $branch = $query->param("branch_$biblioNum");
194
        my $reqtype = $query->param("reqtype_$biblioNum");
195
        my $reqtype = $query->param("reqtype_$biblioNum");
196
        warn $biblioNum;
197
        if (!$reqtype) {
198
            #If no $reqtype value has been passed from the form this means both reqany and reqspecific radio buttons are disabled because a hold has been placed on this biblio previously and so a forced_hold_level exists.
199
            # Determine what the forced_hold_level is.
200
            my $holds = Koha::Holds->search(
201
                {
202
                     borrowernumber => $borrowernumber,
203
                     biblionumber   => $biblioNum,
204
                     found          => undef,
205
                }
206
            );
207
            my $forced_hold_level = $holds->forced_hold_level();
208
            if ($forced_hold_level eq "item") {
209
                $reqtype = "Specific";
210
            } elsif ($forced_hold_level eq "record") {
211
                $reqtype = "Any";
212
            }
213
        }
195
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
214
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
196
        my $notes = $query->param('notes_'.$biblioNum) || '';
215
        my $notes = $query->param('notes_'.$biblioNum) || '';
197
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
216
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
Lines 242-257 if ( $query->param('place_reserve') ) { Link Here
242
                if ( $hostbiblioNum ne $biblioNum ) {
261
                if ( $hostbiblioNum ne $biblioNum ) {
243
                    $biblionumber = $hostbiblioNum;
262
                    $biblionumber = $hostbiblioNum;
244
                }
263
                }
245
264
                my $reservestatus = CanItemBeReserved( $borrowernumber, $itemnumber);
246
                $canreserve = 0 unless CanItemBeReserved( $borrowernumber, $itemnumber ) eq 'OK';
265
                $canreserve = 0 if !($reservestatus->{status} eq 'OK');
247
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
266
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
248
                my $item = GetItem($itemnumber);
267
                my $item = GetItem($itemnumber);
249
                if ( $item->{'holdingbranch'} eq $branch ) {
268
                if ( $item->{'holdingbranch'} eq $branch ) {
250
                    $found = 'W'
269
                    $found = 'W'
251
                      unless C4::Context->preference('ReservesNeedReturns');
270
                      unless C4::Context->preference('ReservesNeedReturns');
252
                }
271
                }
253
272
                warn $itemnumber;
273
                warn $canreserve;
254
                if ($canreserve) {
274
                if ($canreserve) {
275
                    warn $canreserve;
255
                    my $reserve_id = AddReserve(
276
                    my $reserve_id = AddReserve(
256
                        $branch,         $borrowernumber,
277
                        $branch,         $borrowernumber,
257
                        $biblionumber,
278
                        $biblionumber,
Lines 605-610 foreach my $biblioNum (@biblionumbers) { Link Here
605
        }
626
        }
606
    );
627
    );
607
    my $forced_hold_level = $holds->forced_hold_level();
628
    my $forced_hold_level = $holds->forced_hold_level();
629
    warn $forced_hold_level;
608
    if ($forced_hold_level) {
630
    if ($forced_hold_level) {
609
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
631
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
610
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
632
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
611
- 

Return to bug 15565