Bugzilla – Attachment 91725 Details for
Bug 12949
changing child to adult doesn't remove link to guarantor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12949: (follow-up) Disable syspref by default
Bug-12949-follow-up-Disable-syspref-by-default.patch (text/plain), 8.16 KB, created by
Alex Buckley
on 2019-07-23 04:34:25 UTC
(
hide
)
Description:
Bug 12949: (follow-up) Disable syspref by default
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2019-07-23 04:34:25 UTC
Size:
8.16 KB
patch
obsolete
>From c64dd80f20d7f6fce9805a3c457d4df63adce972 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 22 Jul 2019 16:06:47 +0000 >Subject: [PATCH] Bug 12949: (follow-up) Disable syspref by default > >Implemented fixes based on test feedback: > >* Set the GuarantorsMustBeLinkedToPatronAccount syspref to 0 (disabled) >by default > >* When syspref is enabled and a guarantee is updated to an 'Adult' >their borrowers.guarantorid, borrowers.contactname, >borrowers.contactfirstname, borrowers.relationship are reset to NULL. > >Updated test plan: >1. Create an adult patron (make sure to set a first and last name) and >select 'Add child' and save the child >record > >2. Run the following database query, and notice there are values for >guarantorid, contactname, contactfirstname, relationship: >SELECT guarantorid, contactname, contactfirstname, relationship FROM borrowers WHERE >borrowernumber=<childsborrowernumber>; > >3. On the child record select More > Update child to adult patron. > >4. Select a new adult patron category and save > >5. Notice guarantor information is still displayed on the new adults >record > >6. Repeat step 2 and notice guarantorid is empty/NULL and contactname >and contactfirstname, relationship are unchanged > >7. Now create a child record with an unlinked guarantor: In the patron >home page select 'New patron'. > >Note: Make sure the patron category you select is of category type >'Child' > >8. In the guarantor area of the patron creation page input a firstname >and surname and don't select 'Set to patron' and save/submit the page > >9. Repeat step 2 making the borrowernumber you enter the borrowernumber >of the patron you made in step 8 and notice guarantorid is empty and >contactname and contactfirstname are not empty. i.e. our guarantor is >not linked to a Koha patron > >10. Notice guarantor information is shown on the patron summary page of >our user > >11. Repeat step 3,4,5 and notice guarantor information is still >displayed > >12. Apply patch > >13. Navigate to installer/data/mysql directory > >Enter the Koha shell: >sudo koha-shell <instancename> > >Run: >./updatedatabase.pl > >14. In staff client visit Administration > Global System preferences and >search for GuarantorsMustBeLinkedToPatronAccount syspref and confirm it >is enabled > >15. Repeat steps 1-5 and notice that the guarantor information is not >displayed on the new adult's record also in the database confirm the >guarantorid, contactname, contactfirstname, relationship are set to >NULL. > >16. Repeat steps 7-10 and notice that the guarantor information is not >displayed on the new adult's record > >17. Set GuarantorsMustBeLinkedToPatronAccount syspref to disabled > >18. Repeat steps 1-5 and confirm the guarantor information is displayed >on the new adult's record (i.e. setting >GuarantorsMustBeLinkedToPatronAccount >syspref to disabled keeps the current Koha behaviour) also check in the >database and confirm that guarantorid is NULL, and contactname, >contactfirstname and relationship are not NULL. > >19. Repeat steps 7-10 and confirm the guarantor information is displayed > >Also check in the database and confirm the guarantorid is NULL and >contactname, contactfirstname and relationship are not NULL > >20. Sign off > >Sponsored-By: Brimbank Library, Australia >--- > ...g_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql | 2 +- > installer/data/mysql/sysprefs.sql | 2 +- > .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref | 2 +- > members/memberentry.pl | 5 +++++ > members/update-child.pl | 6 ++++++ > 5 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql b/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql >index bfe39a0..eaafb11 100644 >--- a/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql >+++ b/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql >@@ -1 +1 @@ >-INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('GuarantorsMustBeLinkedToPatronAccount', 1, NULL, 'When adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account', 'YesNo'); >+INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('GuarantorsMustBeLinkedToPatronAccount', 0, NULL, 'If enabled when adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account', 'YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 4555258..4039f4a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -199,7 +199,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('GoogleOpenIDConnectDefaultBranch', '','','This branch code will be used to create Google OpenID Connect patrons.','Textarea'), > ('GoogleOpenIDConnectDefaultCategory','','','This category code will be used to create Google OpenID Connect patrons.','Textarea'), > ('GoogleOpenIDConnectDomain', '', NULL, 'Restrict Google OpenID Connect to this domain (or subdomains of this domain). Leave blank for all Google domains', 'Free'), >-('GuarantorsMustBeLinkedToPatronAccount', 1, NULL, 'When adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account', 'YesNo'), >+('GuarantorsMustBeLinkedToPatronAccount', 0, NULL, 'If enabled when adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account', 'YesNo'), > ('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'), > ('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'), > ('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'), >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 617524d..bf399a6 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 >@@ -232,7 +232,7 @@ Patrons: > choices: > yes: 'Enable' > no: 'Disable' >- - When adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account >+ - If enabled when adding a guarantor to a borrower Koha will enforce that the guarantor must be linked to a patron account > > Privacy: > - >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 2f84d92..fd6493b 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -532,6 +532,11 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ > my $borrowercategory = Koha::Patron::Categories->find($newdata{categorycode}); > if (( $borrowercategory->category_type ne 'C' ) && ( $borrowercategory->category_type ne 'P' )) { > $newdata{guarantorid} = ''; >+ if (C4::Context->preference('GuarantorsMustBeLinkedToPatronAccount')) { >+ $newdata{contactname} = ''; >+ $newdata{contactfirstname} = ''; >+ $newdata{relationship} = ''; >+ } > } > > $patron->set(\%newdata)->store if scalar(keys %newdata) > 1; # bug 4508 - avoid crash if we're not >diff --git a/members/update-child.pl b/members/update-child.pl >index b0aff0d..2afdc62 100755 >--- a/members/update-child.pl >+++ b/members/update-child.pl >@@ -85,6 +85,12 @@ elsif ( $op eq 'update' ) { > die "You are doing something wrong updating this child" unless $adult_category; > > $patron->guarantorid(undef); >+ if (C4::Context->preference('GuarantorsMustBeLinkedToPatronAccount')) { >+ $patron->contactname(undef); >+ $patron->contactfirstname(undef); >+ $patron->relationship(undef); >+ } >+ > $patron->categorycode($adult_category->categorycode); > $patron->store; > >-- >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 12949
:
91057
|
91121
|
91724
|
91725
|
91726
|
91790