Bugzilla – Attachment 91726 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), 10.27 KB, created by
Alex Buckley
on 2019-07-23 04:59:36 UTC
(
hide
)
Description:
Bug 12949: (follow-up) Disable syspref by default
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2019-07-23 04:59:36 UTC
Size:
10.27 KB
patch
obsolete
>From 63f525352a08544d8eea759644757d31b0973292 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: > >* Renamed syspref now called: >RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult > >* Also set 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 RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult syspref and confirm it >is disabled > >15. Repeat steps 1-5 and notice that the guarantor information is >displayed on the new adult's record (i.e. when the >RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult syspref is >disabled the current Koha behaviour occurs). > >16. In the database confirm the >guarantorid is NULL and contactname, contactfirstname and relationship >are not set to NULL. > >17. Repeat steps 7-10 and notice that the guarantor information is >displayed on the new adult's record > >Also repeat step 16 and confirm the same outcome > >18. Set GuarantorsMustBeLinkedToPatronAccount syspref to enabled > >19. Repeat steps 1-5 and confirm the guarantor information is not displayed >on the new adult's record (i.e. setting >GuarantorsMustBeLinkedToPatronAccount >syspref to enabled implements the behaviour change). > >Also repeat step 16 and confirm the guarantorid, contactname, >contactfirstname and relationship are all NULL > >20. Repeat steps 7-10 and confirm the guarantor information is not displayed > >Also repeat step 16 and confirm the guarantorid, >contactname, contactfirstname and relationship are NULL > >21. Sign off > >Sponsored-By: Brimbank Library, Australia >--- > ...g_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql | 1 - > ...ontrol_removal_of_guarantor_information_upon_update_to_adult.sql | 1 + > installer/data/mysql/sysprefs.sql | 2 +- > .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref | 4 ++-- > members/memberentry.pl | 5 +++++ > members/moremember.pl | 2 +- > members/update-child.pl | 6 ++++++ > 7 files changed, 16 insertions(+), 5 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_removal_of_guarantor_information_upon_update_to_adult.sql > >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 >deleted file mode 100644 >index bfe39a0..0000000 >--- a/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_display_of_unlinked_guarantor.sql >+++ /dev/null >@@ -1 +0,0 @@ >-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'); >diff --git a/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_removal_of_guarantor_information_upon_update_to_adult.sql b/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_removal_of_guarantor_information_upon_update_to_adult.sql >new file mode 100644 >index 0000000..b88d0b5 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12949-add_syspref_to_control_removal_of_guarantor_information_upon_update_to_adult.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult', 0, NULL, 'If enabled when a guarantee is updated to an Adult patron category all guarantor information will be removed from guarantee account', 'YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 4555258..5fe3065 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'), >+('RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult', 0, NULL, 'If Enabled when a guarantee is updated to an Adult patron category all guarantor information will be removed from guarantee 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..5487ef3 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 >@@ -228,11 +228,11 @@ Patrons: > - "to access/change superlibrarian privileges." > - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)." > - >- - pref: GuarantorsMustBeLinkedToPatronAccount >+ - pref: RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult > 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 >+ - when a guarantee is updated to an Adult patron category all guarantor information will be removed from guarantee account > > Privacy: > - >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 2f84d92..34108d5 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('RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult')) { >+ $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/moremember.pl b/members/moremember.pl >index 5938473..22c66cf 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -103,7 +103,7 @@ if ( my $guarantor = $patron->guarantor ) { > $template->param( guarantor => $guarantor ); > push @relatives, $guarantor->borrowernumber; > push @relatives, $_->borrowernumber for $patron->siblings; >-} elsif (( !C4::Context->preference('GuarantorsMustBeLinkedToPatronAccount')) && ( $patron->contactname || $patron->contactfirstname )) { >+} elsif (( !C4::Context->preference('RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult')) && ( $patron->contactname || $patron->contactfirstname )) { > $template->param( > guarantor => { > firstname => $patron->contactfirstname, >diff --git a/members/update-child.pl b/members/update-child.pl >index b0aff0d..4f69000 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('RemoveGuarantorDataFromGuaranteeWhenUpdatedToAdult')) { >+ $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