Bugzilla – Attachment 91482 Details for
Bug 12133
Guarantor requirements when registering a patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12133: Guarantor requirements when registering a patron
0001-Bug-12133-Guarantor-requirements-when.patch (text/plain), 6.79 KB, created by
Emmi Takkinen
on 2019-07-12 10:54:02 UTC
(
hide
)
Description:
Bug 12133: Guarantor requirements when registering a patron
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2019-07-12 10:54:02 UTC
Size:
6.79 KB
patch
obsolete
>From 7126e7a4ddd047c4295c52c82852ef023d5c9a80 Mon Sep 17 00:00:00 2001 >From: Emmi <emmi.takkinen@outlook.com> >Date: Fri, 12 Jul 2019 13:50:16 +0300 >Subject: [PATCH] Bug 12133: Guarantor requirements when... ...registering a > patron > >Add two requirements when registering a new patron: > >- A child patron must have a guarantor. This is controlled by > a new syspref ChildNeedsGuarantor. >- A guarantor doesn't have to be a patron. This is controlled by > a new syspref GuarantorHasToBePatron. >- A guarantor cannot be a guarantee. > >Note that syspref "GuarantorHasToBePatron" depends on >"ChildNeedsGuarantor" being ON. > >Test plan: >- Add a child patron without a guarantor. Saving the patron >is successful. >- Add a child patron with a guarantor who has a guarantor. Saving is >successful. >- Apply this patch. >- Turn syspref "ChildNeedsGuarantor" ON. >- Add a child patron with a guarantor who has a guarantor. Error >- Add a child patron without a guarantor and error "Child needs a >guarantor" is raised. >- Add the guarantor info (only surname is needed) and saving the patron > should be succesful. >- Turn syspref "GuarantorNeedsToBePatron" ON. >- Add a child patron this time with guarantor info and error >"Guarantor has to be a patron" is raised. >- Add existing patron as guarantor and now saving the patron >should be succesful. >- Add a child patron with a guarantor who is also a guarantee. >Error is raised. >- Turn syspref "ChildNeedsGuarantor" OFF. >- Add a child patron without a guarantor. Saving patron should >be successful. > >Sponsored-by: Koha-Suomi Oy >--- > installer/data/mysql/atomicupdate/bug_12133.perl | 16 ++++++++++++++++ > .../en/modules/admin/preferences/patrons.pref | 15 ++++++++++++++- > .../prog/en/modules/members/memberentrygen.tt | 11 +++++++++++ > members/memberentry.pl | 13 +++++++++++++ > 4 files changed, 54 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_12133.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_12133.perl b/installer/data/mysql/atomicupdate/bug_12133.perl >new file mode 100644 >index 0000000000..111c3fbfe8 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12133.perl >@@ -0,0 +1,16 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # you can use $dbh here like: >+ $dbh->do( q{ >+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) >+ VALUES('ChildNeedsGuarantor', 0, 'If ON, a child patron must have a guarantor when adding the patron.', '', 'YesNo')} ); >+ >+ # or perform some test and warn >+ # if( !column_exists( 'biblio', 'biblionumber' ) ) { >+ # warn "There is something wrong"; >+ # } >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 12133 - Guarantor requirements when registering a patron)\n"; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 9007da96a4..086441c6ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -66,6 +66,13 @@ Patrons: > softno: "Unless overridden by patron category, do not" > hardno: "Do not" > - " check borrower checkout history to see if the current item has been checked out before." >+ - >+ - "A child patron" >+ - pref: "ChildNeedsGuarantor" >+ choices: >+ yes: "must have" >+ no: "doesn't need" >+ - a guarantor when adding the patron. > - > - pref: EnhancedMessagingPreferences > choices: >@@ -227,7 +234,13 @@ Patrons: > no: Allow all permitted users > - "to access/change superlibrarian privileges." > - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)." >- >+ - >+ - "The guarantor" >+ - pref: "GuarantorHasToBePatron" >+ choices: >+ yes: "has to be" >+ no: "doesn't have to be" >+ - a patron. > Privacy: > - > - Use the following URL >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 62fc2db2de..ba57676d75 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -78,6 +78,15 @@ > <div class="dialog alert"> > <p>The following fields are wrong. Please fix them.</p> > <ul> >+ [% IF ( ERROR_child_no_guarantor ) %] >+ <li id="ERROR_child_no_guarantor">A child patron needs a guarantor.</li> >+ [% END %] >+ [% IF ( ERROR_guarantor_is_guarantee ) %] >+ <li id="ERROR_guarantor_is_guarantee">A guarantor cannot be a guarantee.</li> >+ [% END %] >+ [% IF ( ERROR_guarantor_not_patron ) %] >+ <li id="ERROR_guarantor_not_patron ">Guarantor has to be a patron.</li> >+ [% END %] > [% IF ( ERROR_login_exist ) %] > <li id="ERROR_login_exist">Username/password already exists.</li> > [% END %] >@@ -344,6 +353,7 @@ > </li> > [% ELSE %] > [% IF ( C ) %] >+ [% IF ( Koha.Preference('ChildNeedsGuarantor') && Koha.Preference('GuarantorHasToBePatron') ) %]<li id="guarantor_required"><span class="required">Required</span></li>[% END %] > [% IF ( guarantorid ) %] > <li id="contact-details"> > [% ELSE %] >@@ -367,6 +377,7 @@ > [% ELSE %] > <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" /> > [% END %] >+ [% IF ( Koha.Preference('ChildNeedsGuarantor') && !Koha.Preference('GuarantorHasToBePatron')) %]<span class="required">Required</span>[% END %] > </li> > [% END %] > [% UNLESS nocontactfirstname %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index bd86e36b67..0d5c986b36 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -265,6 +265,19 @@ if ( $guarantorid ) { > $newdata{$_} = $guarantordata->{$_}; > } > } >+ >+ push @errors, 'ERROR_guarantor_is_guarantee' if ( $guarantordata->{'guarantorid'} && >+ ($op eq 'save' || $op eq 'insert') ); >+ } >+} >+ >+my $valid_guarantor = $guarantorid ? $guarantorid : $newdata{'contactname'}; >+ >+if($category_type eq 'C' && ($op eq 'save' || $op eq 'insert') && C4::Context->preference('ChildNeedsGuarantor')){ >+ if(!$valid_guarantor){ >+ push @errors, 'ERROR_child_no_guarantor'; >+ }elsif(!$guarantorid && C4::Context->preference('GuarantorHasToBePatron')){ >+ push @errors, 'ERROR_guarantor_not_patron'; > } > } > >-- >2.17.1 >
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 12133
:
27517
|
27584
|
33459
|
91482
|
94371
|
94538
|
94544
|
99629
|
113099
|
113100
|
134013
|
134014
|
134015
|
146827
|
147440
|
148058
|
148070
|
152706
|
153082
|
153154
|
154300
|
154316
|
156387
|
156446
|
156447
|
158344
|
158345
|
158346
|
158919
|
158979