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 |
#Make the borrower too young for our Biblio, the Biblio has been ageRestricted during initialization |
479 |
C4::Context->set_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' ); |
480 |
|
481 |
#Reserving an not-agerestricted Biblio by a Borrower with no dateofbirth is tested previously. |
482 |
|
483 |
#Set the ageRestriction for the Biblio |
484 |
my $record = GetMarcBiblio( $bibnum ); |
485 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction", '' ); |
486 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
487 |
C4::Biblio::ModBiblio( $record, $bibnum, '' ); |
488 |
|
489 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 1, "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
490 |
|
491 |
#Set the dateofbirth for the Borrower making him "too young". |
492 |
my $now = DateTime->now(); |
493 |
my $duration_15years = DateTime::Duration->new(years => 15); |
494 |
my $past15yearsAgo = DateTime->now()->subtract_duration($duration_15years); |
495 |
C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $past15yearsAgo->ymd() ); |
496 |
|
497 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 0, "Reserving a 'PEGI 16' Biblio by a 15 year old borrower fails"); |
498 |
|
499 |
#Set the dateofbirth for the Borrower making him "too old". |
500 |
my $duration_30years = DateTime::Duration->new(years => 30); |
501 |
my $past30yearsAgo = DateTime->now()->subtract_duration($duration_30years); |
502 |
C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $past30yearsAgo->ymd() ); |
503 |
|
504 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 1, "Reserving a 'PEGI 16' Biblio by a 30 year old borrower succeeds"); |
505 |
#### |
506 |
####### EO Bug 13113 <<< |
507 |
#### |
508 |
|
474 |
$dbh->rollback; |
509 |
$dbh->rollback; |
475 |
|
510 |
|
476 |
sub count_hold_print_messages { |
511 |
sub count_hold_print_messages { |
477 |
- |
|
|