Bugzilla – Attachment 106170 Details for
Bug 25322
Adding a guarantor with no relationship defaults to first available relationship name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25322: fix for not selected "relationship" defaults to father
Bug-25322-fix-for-not-selected-relationship-defaul.patch (text/plain), 8.05 KB, created by
Katrin Fischer
on 2020-06-22 22:14:08 UTC
(
hide
)
Description:
Bug 25322: fix for not selected "relationship" defaults to father
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-06-22 22:14:08 UTC
Size:
8.05 KB
patch
obsolete
>From 01cee866685d974e24fd16ac5edc893cdf7b9827 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Wed, 17 Jun 2020 16:44:42 +0300 >Subject: [PATCH] Bug 25322: fix for not selected "relationship" defaults to > father > >When a user creates a patron's guarantor on /cgi-bin/koha/members/memberentry.pl but doesn't select the relationship from a dropdown, the relationship defaults to first value, which in default sysprefs is "father". This may or may not be correct as this is not a conscious choice from the user. > >The solution is to make the "Relationship" field mandatory when there is no empty entry in the system preferences, always starting with an empty option but not allowing the user to save an empty entry. >And if there is an empty option in sysprefs, it allows to save empty, as well as makes it default choice. > >To reproduce with default system preferences: > 1) Create a new patron who is assumed to have a guarantor or modify the existing one. > 2) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes. > 3) Observe that relationship is set as "father". > 4) Apply the patch. > 5) Repeat steps 1 and 2. > 6) Observe that it doesn't allow you to save the form until you pick a relationship type. > >To reproduce with empty entry added to system preferences: > 1) Add an empty entry to borrowerRelationship at /cgi-bin/koha/admin/preferences.pl?tab=patrons in Patron relationships section (example: "|father|mother"). > 2) Create a new patron who is assumed to have a guarantor or modify the existing one. > 3) Under "Guarantor Information" click on "Search to add" button. After performing the search, select a user to act as guarantor. Don't use the dropdown menu to select a relationship. Save your changes. > 4) Observe that relationship is set as "father". > 5) Apply the patch. > 6) Repeat steps 1, 2 and 3. > 7) Observe when you save the empty entry it does set the relationship as empty. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/members/memberentrygen.tt | 34 ++++++++++++++++++---- > members/memberentry.pl | 4 +++ > 2 files changed, 32 insertions(+), 6 deletions(-) > >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 25c32db057..9ff3b1a8e7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -477,12 +477,23 @@ legend:hover { > </li> > > <li> >- <label for="guarantor_relationship">Relationship: </label> >- <select class="new_guarantor_relationship" name="new_guarantor_relationship"> >+ [% UNLESS empty_relationship_allowed %] >+ <label for="guarantor_relationship" class="required">Relationship: </label> >+ <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required"> >+ [% ELSE %] >+ <label for="guarantor_relationship">Relationship: </label> >+ <select class="new_guarantor_relationship" name="new_guarantor_relationship"> >+ [% END %] >+ <option value="" selected>Empty option</option> > [% FOREACH pr IN possible_relationships.split('\|') %] >- <option value="[% pr | html %]">[% pr | html %]</option> >+ [% IF pr != "" %] >+ <option value="[% pr | html %]">[% pr | html %]</option> >+ [% END %] > [% END %] > </select> >+ [% UNLESS empty_relationship_allowed %] >+ <span class="required">Required</span> >+ [% END %] > </li> > > <li> >@@ -513,12 +524,23 @@ legend:hover { > </li> > > <li> >- <label for="guarantor_relationship">Relationship: </label> >- <select class="new_guarantor_relationship" name="new_guarantor_relationship"> >+ [% UNLESS empty_relationship_allowed %] >+ <label for="guarantor_relationship" class="required">Relationship: </label> >+ <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required"> >+ [% ELSE %] >+ <label for="guarantor_relationship">Relationship: </label> >+ <select class="new_guarantor_relationship" name="new_guarantor_relationship"> >+ [% END %] >+ <option value="" selected></option> > [% FOREACH pr IN possible_relationships.split('\|') %] >- <option value="[% pr | html %]">[% pr | html %]</option> >+ [% IF pr != "" %] >+ <option value="[% pr | html %]">[% pr | html %]</option> >+ [% END %] > [% END %] > </select> >+ [% UNLESS empty_relationship_allowed %] >+ <span class="required">Required</span> >+ [% END %] > </li> > > <li> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index cfdc06032e..ec6c08c4c5 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -107,6 +107,10 @@ my @messages; > ## Deal with guarantor stuff > $template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; > >+my @relations = split /,|\|/, C4::Context->preference('borrowerRelationship'); >+my $empty_relationship_allowed = grep {$_ eq ""} @relations; >+$template->param( empty_relationship_allowed => $empty_relationship_allowed ); >+ > my $guarantor_id = $input->param('guarantor_id'); > my $guarantor = undef; > $guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id; >-- >2.11.0
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 25322
:
105419
|
105420
|
105677
|
105972
|
106170
|
106318