Bugzilla – Attachment 56934 Details for
Bug 17492
Show warning if patron's age is out of category limits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17492: Added warning about age being of-of-limits
Added-warning-about-age-being-of-of-limits.patch (text/plain), 5.57 KB, created by
Marc Véron
on 2016-10-28 06:05:56 UTC
(
hide
)
Description:
Bug 17492: Added warning about age being of-of-limits
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-10-28 06:05:56 UTC
Size:
5.57 KB
patch
obsolete
>From 718002ba2116d474a0ab3dac5ab1fe1fcff51f7b Mon Sep 17 00:00:00 2001 >From: radiuscz <radek.siman@centrum.cz> >Date: Mon, 24 Oct 2016 03:41:02 +0200 >Subject: [PATCH] Added warning about age being of-of-limits >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: >1) Apply patch >2) Create a patron and assign him a category having age limits set >3) Change patron's age to be older/younger than category's limits >4) At "Check out" and "Details" tabs you should see a warning with a >button allowing to change the category >5) Set a valid category according to patron's age >6) Warning should disappear >7) Perform similar test again, but instead of changing the age change >the limits of a category > >https://bugs.koha-community.org/show_bug.cgi?id=17492 > >Tested all 4 patches together, works as expected >Signed-off-by: Marc Véron <veron@veron.ch> >--- > 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 > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 45322b2..857a2cb 100755 >--- a/circ/circulation.pl >+++ b/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 ); >+ } >+ > } > > # >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc >new file mode 100644 >index 0000000..2aac474 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc >@@ -0,0 +1,6 @@ >+[% IF age_limitations %] >+ <li> >+ <span class="circ-hlt">Patron's age is incorrect for their category.</span> >+ Ages allowed are [% age_low %]-[% age_high %]. >+ <a href="memberentry.pl?op=modify&borrowernumber=[% borrowernumber %]&step=3" class="btn btn-mini">Change category</a></li> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 7111ef9..7ec8bb7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -790,10 +790,15 @@ No patron matched <span class="ex">[% message | html %]</span> > [% IF ( odues ) %]<li>[% IF ( nonreturns ) %]<span class="circ-hlt">Overdues: Patron has ITEMS OVERDUE.</span> <a href="#checkouts">See highlighted items below</a>[% END %]</li> > [% 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 ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index a5008ca..683066b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -179,8 +179,15 @@ function validate1(date) { > [% ELSE %] > [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %] > >- [% IF fines %] >- [% INCLUDE 'blocked-fines.inc' %] >+ [% IF fines || age_limitations %] >+ <ul class="circmessage"> >+ [% IF fines %] >+ [% INCLUDE 'blocked-fines.inc' %] >+ [% END %] >+ [% IF age_limitations %] >+ [% INCLUDE 'category-out-of-age-limit.inc' %] >+ [% END %] >+ </ul> > [% END %] > > [% IF ( flagged ) %] >diff --git a/members/moremember.pl b/members/moremember.pl >index 01d16b6..4a4bb9b 100755 >--- a/members/moremember.pl >+++ b/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 .... >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17492
:
56805
|
56806
|
56874
|
56933
|
56934
|
56935
|
56936
|
56937
|
56976
|
56985
|
56986
|
56987
|
56988
|
56989
|
56990
|
56995
|
62860
|
67040
|
67041
|
67042
|
67850
|
67851
|
67867
|
67868
|
68139
|
68140
|
68141
|
68142
|
68143
|
68144
|
68145
|
91028
|
91029
|
91044
|
91045
|
91098
|
91099
|
91100