@@ -, +, @@ button to update it - http://prntscr.com/cz7ch3 - http://prntscr.com/cz7em4 - http://prntscr.com/cz7dj1 http://prntscr.com/cz7g5q --- circ/circulation.pl | 12 ++++++++++++ .../prog/en/includes/category-out-of-age-limit.inc | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 6 +++++- .../intranet-tmpl/prog/en/modules/members/moremember.tt | 12 ++++++++---- members/moremember.pl | 10 ++++++++++ 5 files changed, 39 insertions(+), 5 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 @@ -303,6 +303,18 @@ if ($patron) { } } + # 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( 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,4 @@ +
  • + Patron's age is incorrect for their category. + Ages allowed are [% age_low %]-[% age_high %]. + Change category
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -836,10 +836,14 @@ No patron matched [% message | html %] [% IF ( odues ) %]
  • [% IF ( nonreturns ) %]Overdues: Patron has ITEMS OVERDUE. See highlighted items below[% END %]
  • [% END %] - [% IF ( charges ) %] + [% IF charges %] [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] [% END %] + [% IF age_limitations %] + [% INCLUDE 'category-out-of-age-limit.inc' %] + [% END %] + [% IF ( charges_guarantees ) %]
  • Fees & Charges: Patron's guarantees collectively owe [% chargesamount_guarantees %]. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -183,12 +183,16 @@ function validate1(date) { [% ELSE %] [% IF ( was_renewed ) %]
    Patron's account has been renewed until [% dateexpiry | $KohaDates %]
    [% END %] - [% IF fines %] + [% 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 @@ -250,6 +250,16 @@ if ( $data->{dateofbirth} ) { $template->param( age => Koha::Patron->new({ dateofbirth => $data->{dateofbirth} })->get_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( 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 .... --