Bugzilla – Attachment 118992 Details for
Bug 25946
borrowerRelationship can no longer be empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25946: borrowerRelationship can be empty
Bug-25946-borrowerRelationship-can-be-empty.patch (text/plain), 3.18 KB, created by
Peter Vashchuk
on 2021-03-30 11:43:46 UTC
(
hide
)
Description:
Bug 25946: borrowerRelationship can be empty
Filename:
MIME Type:
Creator:
Peter Vashchuk
Created:
2021-03-30 11:43:46 UTC
Size:
3.18 KB
patch
obsolete
>From ec7054b6af8abe84a8655564a520fa001697ea05 Mon Sep 17 00:00:00 2001 >From: Petro Vashchuk <stalkernoid@gmail.com> >Date: Mon, 29 Mar 2021 16:59:32 +0300 >Subject: [PATCH] Bug 25946: borrowerRelationship can be empty > >When borrowerRelationship is empty in system preferences, Relationship >dropdown is not required and we accept empty value. > >Also fixes bug that didn't let you to pick empty value even when you >specified that it should be possible in system preferences but in the >end of the string (i.e. "|father|mother" worked, >but "father|mother|" don't). > >To reproduce (borrowerRelationship can be empty): > 1) Go to system preferences and make borrowerRelationship empty. > 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. Try to save your changes. > 4) Observe that relationship field is required in order to save but > you can't actually choose anything as it doesn't contain anything. > 5) Apply the patch. > 6) Repeat steps above. > 7) Observe that it allows you to save the form now. > >To reproduce (can't choose empty value bug): > 1) Go to system preferences and set borrowerRelationship exactly > to "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. > 4) Observe that there's no option to leave relationship field empty. > 5) Apply the patch. > 6) Repeat steps above. > 7) Observe that it has empty option that you can choose and save > the form. > >Mentored-by: Andrew Nugged <nugged@gmail.com> >--- > Koha/Patron/Relationship.pm | 3 ++- > members/memberentry.pl | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patron/Relationship.pm b/Koha/Patron/Relationship.pm >index 1058f27cac..d8cbb1c18e 100644 >--- a/Koha/Patron/Relationship.pm >+++ b/Koha/Patron/Relationship.pm >@@ -48,7 +48,8 @@ Overloaded method that makes some checks before storing on the DB > sub store { > my ( $self ) = @_; > >- my @valid_relationships = split /\|/, C4::Context->preference('borrowerRelationship'); >+ my @valid_relationships = split /\|/, C4::Context->preference('borrowerRelationship'), -1; >+ @valid_relationships = ('') unless @valid_relationships; > > Koha::Exceptions::Patron::Relationship::InvalidRelationship->throw( > no_relationship => 1 ) >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 462cebd7a1..022bef7770 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -107,7 +107,8 @@ my @messages; > ## Deal with guarantor stuff > $template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; > >-my @relations = split /\|/, C4::Context->preference('borrowerRelationship'); >+my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1; >+@relations = ('') unless @relations; > my $empty_relationship_allowed = grep {$_ eq ""} @relations; > $template->param( empty_relationship_allowed => $empty_relationship_allowed ); > >-- >2.28.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 25946
:
107469
|
108048
|
118991
|
118992
|
118993
|
118997
|
118998
|
118999
|
119011
|
119012
|
119013
|
119015