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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 241-247 sub AddReserve { Link Here
241
    }
241
    }
242
242
243
    #}
243
    #}
244
    ($const eq "o" || $const eq "e") or return;   # FIXME: why not have a useful return value?
244
    ($const eq "o" || $const eq "e") or return $reserve_id;
245
    $query = qq{
245
    $query = qq{
246
        INSERT INTO reserveconstraints
246
        INSERT INTO reserveconstraints
247
            (borrowernumber,biblionumber,reservedate,biblioitemnumber)
247
            (borrowernumber,biblionumber,reservedate,biblioitemnumber)
(-)a/t/db_dependent/Reserves.t (-2 / +80 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 56;
20
use Test::More tests => 63;
21
21
22
use MARC::Record;
22
use MARC::Record;
23
use DateTime::Duration;
23
use DateTime::Duration;
Lines 528-533 $dbh->do( Link Here
528
);
528
);
529
ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" );
529
ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" );
530
530
531
# Tests for bug 14464
532
533
$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
534
my ( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber );
535
ok( !$bz14464_fines, 'Bug 14464 - No fines at beginning' );
536
537
# First, test cancelling a reserve when there's no charge configured.
538
t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 0);
539
540
my $bz14464_reserve = AddReserve(
541
    'CPL',
542
    $borrowernumber,
543
    $bibnum,
544
    'a',
545
    undef,
546
    '1',
547
    undef,
548
    undef,
549
    '',
550
    $title,
551
    $itemnumber,
552
    'W'
553
);
554
555
ok( $bz14464_reserve, 'Bug 14464 - 1st reserve correctly created' );
556
557
CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 });
558
559
( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber );
560
ok( !$bz14464_fines, 'Bug 14464 - No fines after cancelling reserve with no charge configured' );
561
562
# Then, test cancelling a reserve when there's no charge desired.
563
t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 42);
564
565
$bz14464_reserve = AddReserve(
566
    'CPL',
567
    $borrowernumber,
568
    $bibnum,
569
    'a',
570
    undef,
571
    '1',
572
    undef,
573
    undef,
574
    '',
575
    $title,
576
    $itemnumber,
577
    'W'
578
);
579
580
ok( $bz14464_reserve, 'Bug 14464 - 2nd reserve correctly created' );
581
582
CancelReserve({ reserve_id => $bz14464_reserve });
583
584
( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber );
585
ok( !$bz14464_fines, 'Bug 14464 - No fines after cancelling reserve with no charge desired' );
586
587
# Finally, test cancelling a reserve when there's a charge desired and configured.
588
$bz14464_reserve = AddReserve(
589
    'CPL',
590
    $borrowernumber,
591
    $bibnum,
592
    'a',
593
    undef,
594
    '1',
595
    undef,
596
    undef,
597
    '',
598
    $title,
599
    $itemnumber,
600
    'W'
601
);
602
603
ok( $bz14464_reserve, 'Bug 14464 - 1st reserve correctly created' );
604
605
CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 });
606
607
( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber );
608
is( int( $bz14464_fines ), 42, 'Bug 14464 - Fine applied after cancelling reserve with charge desired and configured' );
609
531
$dbh->rollback;
610
$dbh->rollback;
532
611
533
sub count_hold_print_messages {
612
sub count_hold_print_messages {
534
- 

Return to bug 14464