|
Lines 944-964
sub CanBookBeIssued {
Link Here
|
| 944 |
# |
944 |
# |
| 945 |
|
945 |
|
| 946 |
# get $marker from preferences. Could be something like "FSK|PEGI|Alter|Age:" |
946 |
# get $marker from preferences. Could be something like "FSK|PEGI|Alter|Age:" |
| 947 |
my $marker = C4::Context->preference('AgeRestrictionMarker' ); |
|
|
| 948 |
|
947 |
|
| 949 |
if ($marker) |
948 |
my $markers = C4::Context->preference('AgeRestrictionMarker' ); |
|
|
949 |
my $agerestriction = $biblioitem->{'agerestriction'}; |
| 950 |
if ($markers && $agerestriction) |
| 950 |
{ |
951 |
{ |
| 951 |
# Split $value to something like FSK 16 or PEGI 6 |
952 |
# Split $value to something like FSK 16 or PEGI 6 |
| 952 |
my @marker = split /\|/, $marker; |
953 |
my @markers = split /\|/, $markers; |
| 953 |
my @values = split ' ', $biblioitem->{'agerestriction'} ; |
954 |
my @values = split ' ', $agerestriction; |
| 954 |
|
|
|
| 955 |
# Search first occurence of one of the markers |
955 |
# Search first occurence of one of the markers |
| 956 |
my $index = 0; |
956 |
my $index = 0; |
| 957 |
my $take = -1; |
957 |
my $take = -1; |
| 958 |
for my $value (@values) { |
958 |
for my $value (@values) { |
| 959 |
$index ++; |
959 |
$index = $index +1 ; |
| 960 |
if (grep {uc($_) eq $value} @marker) { |
960 |
for my $marker (@markers) { |
| 961 |
$take = $index; |
961 |
$marker =~ s/^\s+//; #remove leading spaces |
|
|
962 |
$marker =~ s/\s+$//; #remove trailing spaces |
| 963 |
if ($marker eq $value) { |
| 964 |
$take = $index; |
| 965 |
last; |
| 966 |
} |
| 967 |
} |
| 968 |
if ($take > -1) { |
| 962 |
last; |
969 |
last; |
| 963 |
} |
970 |
} |
| 964 |
} |
971 |
} |
|
Lines 972-978
sub CanBookBeIssued {
Link Here
|
| 972 |
if ( $borrower->{'dateofbirth'} ) { |
979 |
if ( $borrower->{'dateofbirth'} ) { |
| 973 |
my @alloweddate = split /-/,$borrower->{'dateofbirth'} ; |
980 |
my @alloweddate = split /-/,$borrower->{'dateofbirth'} ; |
| 974 |
@alloweddate[0] += $restrictionyear; |
981 |
@alloweddate[0] += $restrictionyear; |
| 975 |
#Prevent runime eror on leap year (invalid date) |
982 |
#Prevent runtime eror on leap year (invalid date) |
| 976 |
if ((@alloweddate[1] == 2) && (@alloweddate[2] == 29)) { |
983 |
if ((@alloweddate[1] == 2) && (@alloweddate[2] == 29)) { |
| 977 |
@alloweddate[2] = 28; |
984 |
@alloweddate[2] = 28; |
| 978 |
} |
985 |
} |
|
Lines 982-996
sub CanBookBeIssued {
Link Here
|
| 982 |
|
989 |
|
| 983 |
if ( Date_to_Days(Today) < Date_to_Days(@alloweddate) -1 ) { |
990 |
if ( Date_to_Days(Today) < Date_to_Days(@alloweddate) -1 ) { |
| 984 |
if (C4::Context->preference('AgeRestrictionOverride ' )) { |
991 |
if (C4::Context->preference('AgeRestrictionOverride ' )) { |
| 985 |
$needsconfirmation{AGE_RESTRICTION} = "$restrictionyear"; |
992 |
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; |
| 986 |
} |
993 |
} |
| 987 |
else { |
994 |
else { |
| 988 |
$issuingimpossible{AGE_RESTRICTION} = "$restrictionyear"; |
995 |
$issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; |
| 989 |
} |
996 |
} |
| 990 |
} |
997 |
} |
| 991 |
} |
998 |
} |
| 992 |
} |
999 |
} |
| 993 |
} |
1000 |
} |
|
|
1001 |
|
| 994 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts ); |
1002 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts ); |
| 995 |
} |
1003 |
} |
| 996 |
|
1004 |
|
| 997 |
- |
|
|