Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 50; |
20 |
use Test::More tests => 53; |
21 |
|
21 |
|
22 |
use MARC::Record; |
22 |
use MARC::Record; |
23 |
use DateTime::Duration; |
23 |
use DateTime::Duration; |
Lines 471-476
is($cancancel, 0, 'Reserve in waiting status cant be canceled');
Link Here
|
471 |
|
471 |
|
472 |
# End of tests for bug 12876 |
472 |
# End of tests for bug 12876 |
473 |
|
473 |
|
|
|
474 |
#### |
475 |
####### Testing Bug 13113 - Prevent juvenile/children from reserving ageRestricted material >>> |
476 |
#### |
477 |
|
478 |
C4::Context->set_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' ); |
479 |
|
480 |
#Reserving an not-agerestricted Biblio by a Borrower with no dateofbirth is tested previously. |
481 |
|
482 |
#Set the ageRestriction for the Biblio |
483 |
my $record = GetMarcBiblio( $bibnum ); |
484 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction", '' ); |
485 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
486 |
C4::Biblio::ModBiblio( $record, $bibnum, '' ); |
487 |
|
488 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 1, "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
489 |
|
490 |
#Set the dateofbirth for the Borrower making him "too young". |
491 |
my $now = DateTime->now(); |
492 |
C4::Members::SetAge( $borrower, '0015-00-00' ); |
493 |
C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $borrower->{dateofbirth} ); |
494 |
|
495 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 0, "Reserving a 'PEGI 16' Biblio by a 15 year old borrower fails"); |
496 |
|
497 |
#Set the dateofbirth for the Borrower making him "too old". |
498 |
C4::Members::SetAge( $borrower, '0030-00-00' ); |
499 |
C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $borrower->{dateofbirth} ); |
500 |
|
501 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 1, "Reserving a 'PEGI 16' Biblio by a 30 year old borrower succeeds"); |
502 |
#### |
503 |
####### EO Bug 13113 <<< |
504 |
#### |
505 |
|
474 |
$dbh->rollback; |
506 |
$dbh->rollback; |
475 |
|
507 |
|
476 |
sub count_hold_print_messages { |
508 |
sub count_hold_print_messages { |
477 |
- |
|
|