Bugzilla – Attachment 56995 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: Add a warning about age being of-limits and a button to update it
Bug-17492-Add-a-warning-about-age-being-of-limits-.patch (text/plain), 6.28 KB, created by
Jonathan Druart
on 2016-10-31 11:48:57 UTC
(
hide
)
Description:
Bug 17492: Add a warning about age being of-limits and a button to update it
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-10-31 11:48:57 UTC
Size:
6.28 KB
patch
obsolete
>From 1c54a9a4c578a504a656ab49755655f9c3a8cfc5 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Radek=20=C5=A0iman?= <rbit@rbit.cz> >Date: Mon, 24 Oct 2016 03:41:02 +0200 >Subject: [PATCH] Bug 17492: Add a warning about age being of-limits and a > button to update it >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds a warning if a patron's age is out of limits if an assigned category. >It also adds a button allowing to change the category. > >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, eg.: > - http://prntscr.com/cz7ch3 > - http://prntscr.com/cz7em4 > - http://prntscr.com/cz7dj1 >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 >8) During tests verify "Change category" button everytime opens "Modify >patron" page: > http://prntscr.com/cz7g5q > >Tested all 4 patches together, works as expected >Signed-off-by: Marc Véron <veron@veron.ch> > >Bug 17492: Removed a line setting 'flagged' template parameter by mistake > >Signed-off-by: Marc Véron <veron@veron.ch> > >Bug 17492: Fixed URL generation of "Change category" button > >Signed-off-by: Marc Véron <veron@veron.ch> > >Bug 17492: Fixed forbidden patterns > >Signed-off-by: Marc Véron <veron@veron.ch> > >Bug 17492: Removed extra IFs > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > 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 | 11 +++++++++-- > members/moremember.pl | 10 ++++++++++ > 5 files changed, 40 insertions(+), 3 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 ded56c4..6ad9c1b 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -313,6 +313,18 @@ 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( 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..982df7b >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/category-out-of-age-limit.inc >@@ -0,0 +1,4 @@ >+ <li> >+ <span class="circ-hlt">Patron's age is incorrect for their category.</span> >+ Ages allowed are [% age_low %]-[% age_high %]. >+ <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=[% borrowernumber %]&step=3" class="btn btn-mini">Change category</a></li> >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 a937bf1..8855025 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -790,12 +790,16 @@ 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 ) %] >+ [% IF charges %] > [% INCLUDE 'blocked-fines.inc' > fines = chargesamount > %] > [% END %] > >+ [% IF age_limitations %] >+ [% INCLUDE 'category-out-of-age-limit.inc' %] >+ [% END %] >+ > [% IF ( charges_guarantees ) %] > <li> > <span class="circ-hlt">Fees & Charges:</span> Patron's guarantees collectively owe [% chargesamount_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 209671e..a6e902a 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..d5a25f0 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -240,6 +240,16 @@ 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( 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