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

(-)a/C4/Circulation.pm (-6 / +12 lines)
Lines 702-708 data is keyed in lower case! Link Here
702
702
703
=item C<$inprocess> boolean switch
703
=item C<$inprocess> boolean switch
704
704
705
=item C<$ignore_reserves> boolean switch
705
=item C<$ignore_reserves> Hashref of boolean switches
706
707
Available keys:
708
    pending - ignore pending holds
709
    waiting - ignore waiting holds
710
    processing - ignore holds in processing
711
    transferred - ignore holds in transit
706
712
707
=item C<$params> Hashref of additional parameters
713
=item C<$params> Hashref of additional parameters
708
714
Lines 1242-1248 sub CanBookBeIssued { Link Here
1242
        }
1248
        }
1243
    }
1249
    }
1244
1250
1245
    unless ( $ignore_reserves || $recall ) {
1251
    unless ($recall) {
1246
1252
1247
        # See if the item is on reserve.
1253
        # See if the item is on reserve.
1248
        my ( $restype, $res ) = C4::Reserves::CheckReserves($item_object);
1254
        my ( $restype, $res ) = C4::Reserves::CheckReserves($item_object);
Lines 1250-1256 sub CanBookBeIssued { Link Here
1250
            my $resbor = $res->{'borrowernumber'};
1256
            my $resbor = $res->{'borrowernumber'};
1251
            if ( $resbor ne $patron->borrowernumber ) {
1257
            if ( $resbor ne $patron->borrowernumber ) {
1252
                my $patron = Koha::Patrons->find($resbor);
1258
                my $patron = Koha::Patrons->find($resbor);
1253
                if ( $restype eq "Waiting" ) {
1259
                if ( $restype eq "Waiting" && !$ignore_reserves->{'waiting'} ) {
1254
1260
1255
                    # The item is on reserve and waiting, but has been
1261
                    # The item is on reserve and waiting, but has been
1256
                    # reserved by some other patron.
1262
                    # reserved by some other patron.
Lines 1269-1275 sub CanBookBeIssued { Link Here
1269
                            "item is on reserve and waiting, but has been reserved by some other patron"
1275
                            "item is on reserve and waiting, but has been reserved by some other patron"
1270
                        );
1276
                        );
1271
                    }
1277
                    }
1272
                } elsif ( $restype eq "Reserved" ) {
1278
                } elsif ( $restype eq "Reserved" && !$ignore_reserves->{'pending'} ) {
1273
1279
1274
                    # The item is on reserve for someone else.
1280
                    # The item is on reserve for someone else.
1275
                    $needsconfirmation{RESERVED}            = 1;
1281
                    $needsconfirmation{RESERVED}            = 1;
Lines 1284-1290 sub CanBookBeIssued { Link Here
1284
                    if ($issueconfirmed) {
1290
                    if ($issueconfirmed) {
1285
                        push( @message_log, "item is on reserve for someone else" );
1291
                        push( @message_log, "item is on reserve for someone else" );
1286
                    }
1292
                    }
1287
                } elsif ( $restype eq "Transferred" ) {
1293
                } elsif ( $restype eq "Transferred" && !$ignore_reserves->{'transferred'} ) {
1288
1294
1289
                    # The item is determined hold being transferred for someone else.
1295
                    # The item is determined hold being transferred for someone else.
1290
                    $needsconfirmation{TRANSFERRED}         = 1;
1296
                    $needsconfirmation{TRANSFERRED}         = 1;
Lines 1299-1305 sub CanBookBeIssued { Link Here
1299
                    if ($issueconfirmed) {
1305
                    if ($issueconfirmed) {
1300
                        push( @message_log, "item is determined hold being transferred for someone else" );
1306
                        push( @message_log, "item is determined hold being transferred for someone else" );
1301
                    }
1307
                    }
1302
                } elsif ( $restype eq "Processing" ) {
1308
                } elsif ( $restype eq "Processing" && !$ignore_reserves->{'processing'} ) {
1303
1309
1304
                    # The item is determined hold being processed for someone else.
1310
                    # The item is determined hold being processed for someone else.
1305
                    $needsconfirmation{PROCESSING}          = 1;
1311
                    $needsconfirmation{PROCESSING}          = 1;
(-)a/Koha/REST/V1/Checkouts.pm (-1 / +1 lines)
Lines 109-115 sub _check_availability { Link Here
109
    my ( $c, $patron, $item ) = @_;
109
    my ( $c, $patron, $item ) = @_;
110
110
111
    my $inprocess       = 0;                   # What does this do?
111
    my $inprocess       = 0;                   # What does this do?
112
    my $ignore_reserves = 0;                   # Don't ignore reserves
112
    my $ignore_reserves = undef;               # Don't ignore reserves
113
    my $params          = { item => $item };
113
    my $params          = { item => $item };
114
114
115
    my ( $impossible, $confirmation, $alerts, $messages ) = C4::Circulation::CanBookBeIssued(
115
    my ( $impossible, $confirmation, $alerts, $messages ) = C4::Circulation::CanBookBeIssued(
(-)a/t/db_dependent/Circulation.t (-7 / +65 lines)
Lines 7448-7454 subtest 'Tests for RecordLocalUseOnReturn' => sub { Link Here
7448
};
7448
};
7449
7449
7450
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
7450
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
7451
    plan tests => 4;
7451
    plan tests => 16;
7452
7452
7453
    my $homebranch    = $builder->build( { source => 'Branch' } );
7453
    my $homebranch    = $builder->build( { source => 'Branch' } );
7454
    my $holdingbranch = $builder->build( { source => 'Branch' } );
7454
    my $holdingbranch = $builder->build( { source => 'Branch' } );
Lines 7491-7516 subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { Link Here
7491
            reservation_date => dt_from_string,
7491
            reservation_date => dt_from_string,
7492
            expiration_date  => dt_from_string,
7492
            expiration_date  => dt_from_string,
7493
            itemnumber       => $item->id,
7493
            itemnumber       => $item->id,
7494
            found            => 'W',
7495
        }
7494
        }
7496
    );
7495
    );
7497
7496
7497
    my $reserve_obj = Koha::Holds->find($reserve_id);
7498
7498
    set_userenv($holdingbranch);
7499
    set_userenv($holdingbranch);
7499
7500
7500
    my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 0 );
7501
    my $ignore_reserves = {
7502
        'pending'     => 1,
7503
        'waiting'     => 1,
7504
        'processing'  => 1,
7505
        'transferred' => 1,
7506
    };
7507
7508
    # Test pending hold
7509
    my ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef );
7510
    is(
7511
        keys(%$error) + keys(%$alerts), 0,
7512
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7513
    );
7514
    is( exists $question->{RESERVED}, 1, 'RESERVED should be set' );
7515
7516
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves );
7517
    is(
7518
        keys(%$error) + keys(%$alerts), 0,
7519
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7520
    );
7521
    isnt( exists $question->{RESERVED}, 1, 'RESERVED should not be set' );
7522
7523
    # Test processing hold
7524
    $reserve_obj->set_processing();
7525
7526
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef );
7527
    is(
7528
        keys(%$error) + keys(%$alerts), 0,
7529
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7530
    );
7531
    is( exists $question->{PROCESSING}, 1, 'PROCESSING should be set' );
7532
7533
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves );
7534
    is(
7535
        keys(%$error) + keys(%$alerts), 0,
7536
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7537
    );
7538
    isnt( exists $question->{PROCESSING}, 1, 'PROCESSING should not be set' );
7539
7540
    # Test transferred hold
7541
    $reserve_obj->set_transfer();
7542
7543
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef );
7544
    is(
7545
        keys(%$error) + keys(%$alerts), 0,
7546
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7547
    );
7548
    is( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should be set' );
7549
7550
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves );
7501
    is(
7551
    is(
7502
        keys(%$error) + keys(%$alerts), 0,
7552
        keys(%$error) + keys(%$alerts), 0,
7503
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7553
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7504
    );
7554
    );
7505
    is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is set' );
7555
    isnt( exists $question->{TRANSFERRED}, 1, 'TRANSFERRED should not be set' );
7556
7557
    # Test waiting hold
7558
    $reserve_obj->set_waiting();
7506
7559
7507
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, 1 );
7560
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, undef );
7508
    is(
7561
    is(
7509
        keys(%$error) + keys(%$alerts), 0,
7562
        keys(%$error) + keys(%$alerts), 0,
7510
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7563
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7511
    );
7564
    );
7512
    isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING is not set' );
7565
    is( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should be set' );
7513
7566
7567
    ( $error, $question, $alerts ) = CanBookBeIssued( $patron_2, $item->barcode, undef, undef, $ignore_reserves );
7568
    is(
7569
        keys(%$error) + keys(%$alerts), 0,
7570
        'There should not be any errors or alerts (impossible)' . str( $error, $question, $alerts )
7571
    );
7572
    isnt( exists $question->{RESERVE_WAITING}, 1, 'RESERVE_WAITING should not be set' );
7514
};
7573
};
7515
7574
7516
subtest 'NoRefundOnLostFinesPaidAge' => sub {
7575
subtest 'NoRefundOnLostFinesPaidAge' => sub {
7517
- 

Return to bug 21572