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

(-)a/C4/Reserves.pm (+1 lines)
Lines 572-577 sub CanItemBeReserved{ Link Here
572
sub CanReserveBeCanceledFromOpac {
572
sub CanReserveBeCanceledFromOpac {
573
    my ($reserve_id, $borrowernumber) = @_;
573
    my ($reserve_id, $borrowernumber) = @_;
574
574
575
    return unless $reserve_id and $borrowernumber;
575
    my $reserve = GetReserve($reserve_id);
576
    my $reserve = GetReserve($reserve_id);
576
577
577
    return 0 unless $reserve->{borrowernumber} == $borrowernumber;
578
    return 0 unless $reserve->{borrowernumber} == $borrowernumber;
(-)a/t/db_dependent/Reserves.t (-2 / +15 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 39;
5
use Test::More tests => 42;
6
6
7
use MARC::Record;
7
use MARC::Record;
8
use DateTime::Duration;
8
use DateTime::Duration;
Lines 402-407 AddReserve('CPL', $requesters{'CPL'}, $item_bibnum, Link Here
402
           $title,      $checkitem, '');
402
           $title,      $checkitem, '');
403
my (undef, $canres, undef) = CheckReserves($itemnumber);
403
my (undef, $canres, undef) = CheckReserves($itemnumber);
404
404
405
is( CanReserveBeCanceledFromOpac(), undef,
406
    'CanReserveBeCanceledFromOpac should return undef if called without any parameter'
407
);
408
is(
409
    CanReserveBeCanceledFromOpac( $canres->{resserve_id} ),
410
    undef,
411
    'CanReserveBeCanceledFromOpac should return undef if called without the reserve_id'
412
);
413
is(
414
    CanReserveBeCanceledFromOpac( undef, $requesters{CPL} ),
415
    undef,
416
    'CanReserveBeCanceledFromOpac should return undef if called without borrowernumber'
417
);
418
405
my $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'});
419
my $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'});
406
is($cancancel, 1, 'Can user cancel its own reserve');
420
is($cancancel, 1, 'Can user cancel its own reserve');
407
421
408
- 

Return to bug 12876