@@ -, +, @@
---
circ/circulation.pl | 13 +++++++++++++
.../prog/en/includes/category-out-of-age-limit.inc | 6 ++++++
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 13 +++++++++----
.../intranet-tmpl/prog/en/modules/members/moremember.tt | 11 +++++++++--
members/moremember.pl | 11 +++++++++++
5 files changed, 48 insertions(+), 6 deletions(-)
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc
--- a/circ/circulation.pl
+++ a/circ/circulation.pl
@@ -312,6 +312,19 @@ if ($borrowernumber) {
}
}
+ # Calculate and display patron's age
+ my $dateofbirth = $borrower->{ 'dateofbirth' };
+ my $age = GetAge($dateofbirth);
+
+ my $borrowercategory = Koha::Patron::Categories->find($borrower->{ 'categorycode' });
+ my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit);
+ if (($high && ($age > $high)) or ($age < $low)) {
+ $template->param( flagged => 1 );
+ $template->param( age_limitations => 1 );
+ $template->param( age_low => $low );
+ $template->param( age_high => $high );
+ }
+
}
#
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc
@@ -0,0 +1,6 @@
+[% IF age_limitations %]
+
+ Patron's age is incorrect for their category.
+ Ages allowed are [% age_low %]-[% age_high %].
+ Change category
+[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -790,10 +790,15 @@ No patron matched [% message | html %]
[% IF ( odues ) %][% IF ( nonreturns ) %]Overdues: Patron has ITEMS OVERDUE. See highlighted items below[% END %]
[% END %]
- [% IF ( charges ) %]
- [% INCLUDE 'blocked-fines.inc'
- fines = chargesamount
- %]
+ [% IF ( charges || age_limitations ) %]
+ [% IF charges %]
+ [% INCLUDE 'blocked-fines.inc'
+ fines = chargesamount
+ %]
+ [% END %]
+ [% IF age_limitations %]
+ [% INCLUDE 'category-out-of-age-limit.inc' %]
+ [% END %]
[% END %]
[% IF ( charges_guarantees ) %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -179,8 +179,15 @@ function validate1(date) {
[% ELSE %]
[% IF ( was_renewed ) %]Patron's account has been renewed until [% dateexpiry | $KohaDates %]
[% END %]
- [% IF fines %]
- [% INCLUDE 'blocked-fines.inc' %]
+ [% IF fines || age_limitations %]
+
+ [% IF fines %]
+ [% INCLUDE 'blocked-fines.inc' %]
+ [% END %]
+ [% IF age_limitations %]
+ [% INCLUDE 'category-out-of-age-limit.inc' %]
+ [% END %]
+
[% END %]
[% IF ( flagged ) %]
--- a/members/moremember.pl
+++ a/members/moremember.pl
@@ -240,6 +240,17 @@ my $dateofbirth = $data->{ 'dateofbirth' };
my $age = GetAge($dateofbirth);
$template->param( age => $age );
+# Check patron's category against age
+my $borrowercategory = Koha::Patron::Categories->find($data->{ 'categorycode' });
+my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit);
+if (($high && ($age > $high)) or ($age < $low)) {
+ $template->param( flagged => 1 );
+ $template->param( age_limitations => 1 );
+ $template->param( age_low => $low );
+ $template->param( age_high => $high );
+}
+
+
### ###############################################################################
# BUILD HTML
# show all reserves of this borrower, and the position of the reservation ....
--