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 191-196 if ( $query->param('place_reserve') ) { Link Here
191
        my @itemnumbers = $query->param("checkitem_$biblioNum");
192
        my @itemnumbers = $query->param("checkitem_$biblioNum");
192
        my $branch = $query->param("branch_$biblioNum");
193
        my $branch = $query->param("branch_$biblioNum");
193
        my $reqtype = $query->param("reqtype_$biblioNum");
194
        my $reqtype = $query->param("reqtype_$biblioNum");
195
        warn $biblioNum;
196
        if (!$reqtype) {
197
            #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.
198
            # Determine what the forced_hold_level is.
199
            my $holds = Koha::Holds->search(
200
                {
201
                     borrowernumber => $borrowernumber,
202
                     biblionumber   => $biblioNum,
203
                     found          => undef,
204
                }
205
            );
206
            my $forced_hold_level = $holds->forced_hold_level();
207
            if ($forced_hold_level eq "item") {
208
                $reqtype = "Specific";
209
            } elsif ($forced_hold_level eq "record") {
210
                $reqtype = "Any";
211
            }
212
        }
194
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
213
        my $holds_to_place_count = $query->param("holds_to_place_count_$biblioNum") || 1;
195
        my $notes = $query->param('notes_'.$biblioNum) || '';
214
        my $notes = $query->param('notes_'.$biblioNum) || '';
196
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
215
        my $nbRequested = $reqtype eq 'Specific' ? @itemnumbers : $holds_to_place_count;
Lines 241-256 if ( $query->param('place_reserve') ) { Link Here
241
                if ( $hostbiblioNum ne $biblioNum ) {
260
                if ( $hostbiblioNum ne $biblioNum ) {
242
                    $biblionumber = $hostbiblioNum;
261
                    $biblionumber = $hostbiblioNum;
243
                }
262
                }
244
263
                my $reservestatus = CanItemBeReserved( $borrowernumber, $itemnumber);
245
                $canreserve = 0 unless CanItemBeReserved( $borrowernumber, $itemnumber ) eq 'OK';
264
                $canreserve = 0 if !($reservestatus->{status} eq 'OK');
246
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
265
                $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
247
                my $item = GetItem($itemnumber);
266
                my $item = GetItem($itemnumber);
248
                if ( $item->{'holdingbranch'} eq $branch ) {
267
                if ( $item->{'holdingbranch'} eq $branch ) {
249
                    $found = 'W'
268
                    $found = 'W'
250
                      unless C4::Context->preference('ReservesNeedReturns');
269
                      unless C4::Context->preference('ReservesNeedReturns');
251
                }
270
                }
252
271
                warn $itemnumber;
272
                warn $canreserve;
253
                if ($canreserve) {
273
                if ($canreserve) {
274
                    warn $canreserve;
254
                    my $reserve_id = AddReserve(
275
                    my $reserve_id = AddReserve(
255
                        $branch,         $borrowernumber,
276
                        $branch,         $borrowernumber,
256
                        $biblionumber,
277
                        $biblionumber,
Lines 598-603 foreach my $biblioNum (@biblionumbers) { Link Here
598
        }
619
        }
599
    );
620
    );
600
    my $forced_hold_level = $holds->forced_hold_level();
621
    my $forced_hold_level = $holds->forced_hold_level();
622
    warn $forced_hold_level;
601
    if ($forced_hold_level) {
623
    if ($forced_hold_level) {
602
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
624
        #$biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
603
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
625
        #$biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
604
- 

Return to bug 15565