Bugzilla – Attachment 68139 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.39 KB, created by
Katrin Fischer
on 2017-10-14 20:41:28 UTC
(
hide
)
Description:
Bug 17492: Add a warning about age being of-limits and a button to update it
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-10-14 20:41:28 UTC
Size:
6.39 KB
patch
obsolete
>From e0123586a5058fc1d6372dd885a51d08bb81c234 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> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > 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 > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 130d350..c921fd4 100755 >--- a/circ/circulation.pl >+++ b/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 ); >+ } >+ > } > > # >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 d5507c0..43cb8b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -836,10 +836,14 @@ 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 | $Price %]. >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 b40c29a..6ec9234 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -183,12 +183,16 @@ function validate1(date) { > [% ELSE %] > [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %] > >- [% IF fines %] >+ [% IF fines || age_limitations %] > <div id="circmessages" class="circmessage attention"> > <ul> >- [% INCLUDE 'blocked-fines.inc' %] >- </ul> >- </div> >+ [% 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 30e8ce0..64c994b 100755 >--- a/members/moremember.pl >+++ b/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 .... >-- >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