Bugzilla – Attachment 106754 Details for
Bug 12446
Enable an adult to have a guarantor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12446: (follow-up) Remove mandatory transfered values
Bug-12446-follow-up-Remove-mandatory-transfered-va.patch (text/plain), 10.56 KB, created by
Maryse Simard
on 2020-07-09 18:17:36 UTC
(
hide
)
Description:
Bug 12446: (follow-up) Remove mandatory transfered values
Filename:
MIME Type:
Creator:
Maryse Simard
Created:
2020-07-09 18:17:36 UTC
Size:
10.56 KB
patch
obsolete
>From f1447353ba70baa5558273abf6cf8c6a07600765 Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Tue, 1 Oct 2019 12:12:53 -0400 >Subject: [PATCH] Bug 12446: (follow-up) Remove mandatory transfered values > >With the new system preference AdditionalGuarantorField, one can add >data to be transfered to the guarantee, but cannot remove default ones. > >This patch renames the syspref to GuarantorFields and set hardcoded >default values as the preference's default. > >To test: >1. After database update, check that the default value for the syspref >GuarantorFields contains these columns: > streetnumber|address|address2|city|state|zipcode|country| > branchcode|phonepro|mobile|email|emailpro|fax >2. Set the value as empty >3. Try adding a guarantor to a patron (from the guarantor's page or the >guarantee's): no values should be imported. >4. Check that it still works with different values for the preference. >--- > C4/Utils/DataTables/Members.pm | 7 ++----- > installer/data/mysql/atomicupdate/bug_12446.perl | 2 +- > installer/data/mysql/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/patrons.pref | 4 ++-- > .../prog/en/modules/common/patron_search.tt | 2 ++ > koha-tmpl/intranet-tmpl/prog/js/members.js | 10 ++++++---- > members/memberentry.pl | 7 +++---- > svc/members/search | 7 +++---- > 8 files changed, 20 insertions(+), 21 deletions(-) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 5fb9b5150f..f5a0b10458 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -80,13 +80,10 @@ sub search { > > $dbh = C4::Context->dbh; > my @columns = qw( borrowernumber surname firstname othernames flags streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro); >- my @guarantor_attributes = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax ); >- if( my @additional_guarantor_attributes = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){ >- $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional_guarantor_attributes); # Trim whitespaces >- @guarantor_attributes = ( @guarantor_attributes, @additional_guarantor_attributes); >- } >+ my @guarantor_attributes = split(/\|/, C4::Context->preference("GuarantorFields")); > if( @guarantor_attributes ){ > foreach my $item (@guarantor_attributes) { >+ $item =~ s/(?:^\s+)|(?:\s+$)//g; # Trim whitespaces > if (! grep {$_ eq $item} @columns) { > push @columns, $item; > } >diff --git a/installer/data/mysql/atomicupdate/bug_12446.perl b/installer/data/mysql/atomicupdate/bug_12446.perl >index 9575afe186..9b13510f8a 100644 >--- a/installer/data/mysql/atomicupdate/bug_12446.perl >+++ b/installer/data/mysql/atomicupdate/bug_12446.perl >@@ -5,7 +5,7 @@ if( CheckVersion( $DBversion ) ) { > ## ******** ## > $dbh->do(q{ > INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >- VALUES ('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'); >+ VALUES ('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free') > }); > > ## ********* ## >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index edc3bbf0d8..df24bf59f5 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -9,7 +9,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'), > ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), > ('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'), >-('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'), > ('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'), > ('AdlibrisCoversEnabled','0',NULL,'Display cover images in OPAC results and detail listing from Swedish retailer Adlibris.','YesNo'), > ('AdlibrisCoversURL','http://www.adlibris.com/se/organisationer/showimagesafe.aspx',NULL,'Base URL for Adlibris cover image web service.','Free'), >@@ -216,6 +215,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'), >+('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free'), > ('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 5498913c72..c8b59f70c7 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 >@@ -281,8 +281,8 @@ Patrons: > no: "Don't allow" > - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC. > - >- - "These additional following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will be transferred from guarantor to guarantee:" >- - pref: AdditionalGuarantorField >+ - "These following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will be transferred from guarantor to guarantee:" >+ - pref: GuarantorFields > class: multi > - (separate columns with |) > Privacy: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >index 9b628126b6..d647e90e20 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt >@@ -226,6 +226,8 @@ > var borrowernumber = $(this).data("borrowernumber"); > var borrower_data = $("#borrower_data"+borrowernumber).val(); > var guarantor_attributes = $("#guarantor_attributes").val(); >+ if ( !guarantor_attributes ) >+ guarantor_attributes = "{}"; > select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) ); > }); > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index 6d18d6286b..3eb177eb9e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -210,10 +210,12 @@ function select_user(borrowernumber, borrower, relationship, attributes) { > fieldset.find('.new_guarantor_relationship').val(relationship); > } > >- for (var i = 0; i < parseInt(attributes.length, 10); i++) { >- var attribute = attributes[i]; >- if (borrower[attribute] != null){ >- document.forms.entryform[attribute].value = borrower[attribute]; >+ if ( attributes ) { >+ for (var i = 0; i < parseInt(attributes.length, 10); i++) { >+ var attribute = attributes[i]; >+ if (borrower[attribute] != null){ >+ document.forms.entryform[attribute].value = borrower[attribute]; >+ } > } > } > } >diff --git a/members/memberentry.pl b/members/memberentry.pl >index a67276e016..bcc43025d2 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -808,10 +808,9 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > > $template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are > >-my @guarantor_attributes = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax ); >-if( my @additional_guarantor_attributes = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){ >- $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional_guarantor_attributes); # Trim whitespaces >- @guarantor_attributes = ( @guarantor_attributes, @additional_guarantor_attributes); >+my @guarantor_attributes = split(/\|/, C4::Context->preference("GuarantorFields")); >+if (@guarantor_attributes) { >+ $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@guarantor_attributes); # Trim whitespaces > } > $template->param( "guarantor_attributes" => \@guarantor_attributes ); > $debug and warn "memberentry step: $step"; >diff --git a/svc/members/search b/svc/members/search >index 38a0a3ffef..1a236bb83b 100755 >--- a/svc/members/search >+++ b/svc/members/search >@@ -91,10 +91,9 @@ $results = C4::Utils::DataTables::Members::search( > } > ) unless $results; > >-my @attributes = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax ); >-if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){ >- $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces >- @attributes = ( @attributes, @additional); >+my @attributes = split(/\|/, C4::Context->preference("GuarantorFields")); >+if (@attributes) { >+ $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@attributes); # Trim whitespaces > } > $template->param( > sEcho => $sEcho, >-- >2.17.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 12446
:
29278
|
36176
|
39744
|
42469
|
42470
|
42535
|
46277
|
46278
|
46327
|
46328
|
46345
|
46486
|
49793
|
50953
|
53534
|
53535
|
53536
|
53913
|
60929
|
60930
|
60934
|
63148
|
63149
|
63214
|
64793
|
64794
|
64828
|
72295
|
72883
|
77766
|
77767
|
77768
|
79343
|
79344
|
79345
|
79347
|
79348
|
85069
|
88364
|
88365
|
88366
|
88367
|
90389
|
90390
|
90391
|
90392
|
90470
|
90471
|
90472
|
90473
|
93388
|
93389
|
93390
|
93391
|
93392
|
93393
|
93394
|
95411
|
95853
|
95854
|
95855
|
95856
|
95857
|
95858
|
95859
|
95860
|
106753
|
106754
|
106755
|
106756
|
106757
|
107611
|
111052
|
111053
|
111317
|
111318
|
112102
|
112160
|
112161
|
112162
|
112163
|
113583
|
121925
|
121926
|
121927
|
121928
|
121929
|
122084
|
122085
|
122086
|
122087
|
122088
|
122089
|
122090
|
122091
|
122184
|
122185
|
122186
|
122187
|
130398
|
130399
|
130400
|
130401
|
130402
|
131965
|
131966
|
131967
|
131968
|
131969
|
133691
|
133952
|
133953
|
133954
|
133955
|
133956
|
133957
|
134930
|
134931
|
134932
|
134933
|
134934
|
134935
|
134936
|
135506
|
135507
|
135508
|
135509
|
135510
|
135511
|
135512
|
135519
|
135520
|
135521
|
135522
|
135523
|
135544
|
135545
|
142401
|
142408
|
142431
|
142432
|
142433
|
142434
|
142435
|
142436
|
142437
|
142438
|
142439