Bugzilla – Attachment 134013 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: Add requirements for guarantor and guarantee
0001-Bug-12133-Add-requirements-for-guarantor-and-guarant.patch (text/plain), 7.52 KB, created by
Emmi Takkinen
on 2022-04-27 09:40:15 UTC
(
hide
)
Description:
Bug 12133: Add requirements for guarantor and guarantee
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2022-04-27 09:40:15 UTC
Size:
7.52 KB
patch
obsolete
>From 9c36aa01836a6b62d5b332189927f517f3ac0417 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@outlook.com> >Date: Thu, 17 Oct 2019 11:18:13 +0300 >Subject: [PATCH 1/3] Bug 12133: Add requirements for guarantor and guarantee > >Add three requirements when registering a new patron: > >- A child patron must have a guarantor. This is controlled by > a new syspref ChildNeedsGuarantor. >- A guarantor has to be a patron. This is controlled by > a new syspref GuarantorHasToBePatron. >- A guarantor cannot be a guarantee. > >Test plan: >-Add child patron without guarantor or child patron with guarantee >as guarantor succesfully. >- Apply this patch. >- Add a child patron with a guarantee as guarantor. Error is raised. >- Turn syspref "ChildNeedsGuarantor" ON. >- Add a child patron without a guarantor and error "Child needs a >guarantor" is raised. >- Add guarantor. Guarantor can either be existing patron or added with >"Contact" section. Save without errors. >- Turn syspref "GuarantorNeedsToBePatron" ON. >- Form fields for "Contact" section aren't displayed and only existing >patron can be added as guarantor. > >Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> >--- > .../data/mysql/atomicupdate/bug_12133.perl | 20 +++++++++++++++++++ > .../en/modules/admin/preferences/patrons.pref | 15 +++++++++++++- > .../prog/en/modules/members/memberentrygen.tt | 8 +++++++- > members/memberentry.pl | 19 +++++++++++++++++- > 4 files changed, 59 insertions(+), 3 deletions(-) > 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..c944dff2b9 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12133.perl >@@ -0,0 +1,20 @@ >+$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'); >+ } ); >+ $dbh->do( q{ >+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) >+ VALUES('GuarantorHasToBePatron', 0, 'If ON guarantor has to be a 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 76ebd9fd09..53effabf82 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 >@@ -106,7 +106,13 @@ Patrons: > class: integer > - days. Leave empty to disable this behavior. > - "<br><strong>NOTE:</strong> This system preference requires the misc/cronjobs/cleanup_database.pl cronjob. Ask your system administrator to schedule it." >- >+ - >+ - "A child patron" >+ - pref: "ChildNeedsGuarantor" >+ choices: >+ yes: "must have" >+ no: "doesn't need" >+ - a guarantor when adding the patron. > Membership expiry: > - > - When renewing borrowers, base the new expiry date on >@@ -329,6 +335,13 @@ Patrons: > 1: Allow > 0: "Don't allow" > - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC. >+ - >+ - "The guarantor" >+ - pref: "GuarantorHasToBePatron" >+ choices: >+ 1: "has to be" >+ 0: "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 d01b2316bc..18a6e0ad66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -139,6 +139,12 @@ legend:hover { > <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_login_exist ) %] > <li id="ERROR_login_exist">Username/password already exists.</li> > [% END %] >@@ -655,7 +661,7 @@ legend:hover { > [% PROCESS 'main-address-style' %] > [% END # /UNLESS nostreet && nocity etc group%] > >- [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %] >+ [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax || Koha.Preference('GuarantorHasToBePatron') %] > <fieldset class="rows" id="memberentry_contact"> > <legend id="contact_lgd">Contact information</legend> > <ol> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 4e25891dd0..e2ebcc6644 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -103,7 +103,8 @@ my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1; > my $empty_relationship_allowed = grep {$_ eq ""} @relations; > $template->param( empty_relationship_allowed => $empty_relationship_allowed ); > >-my $guarantor_id = $input->param('guarantor_id'); >+my $guarantorinfo = $input->param('guarantorinfo'); >+my $guarantor_id = $input->param('new_guarantor_id'); > my $guarantor = undef; > $guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id; > $template->param( guarantor => $guarantor ); >@@ -279,6 +280,22 @@ if ( ( $op eq 'insert' ) and !$nodouble ) { > } > } > >+if ( $guarantor_id ) { >+ if (my $guarantor = Koha::Patrons->find( $guarantor_id )) { >+ my $guarantor_category = $guarantor->category->category_type; >+ push @errors, 'ERROR_guarantor_is_guarantee' if ( ($guarantor_category eq 'C') && >+ ($op eq 'save' || $op eq 'insert') ); >+ } >+} >+ >+my $valid_guarantor = $guarantor_id ? $guarantor_id : $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'; >+ } >+} >+ > ###############test to take the right zipcode, country and city name ############## > # set only if parameter was passed from the form > $newdata{'city'} = $input->param('city') if defined($input->param('city')); >-- >2.25.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