Bugzilla – Attachment 95858 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), 8.08 KB, created by
Maryse Simard
on 2019-11-27 16:19:20 UTC
(
hide
)
Description:
Bug 12446: (follow-up) Remove mandatory transfered values
Filename:
MIME Type:
Creator:
Maryse Simard
Created:
2019-11-27 16:19:20 UTC
Size:
8.08 KB
patch
obsolete
>From dea569912007436ae8ddb77ab3bae999ffdcaa9b 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/Members/Attributes.pm | 7 +++---- > .../data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql | 2 +- > installer/data/mysql/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/patrons.pref | 4 ++-- > .../intranet-tmpl/prog/en/modules/common/patron_search.tt | 2 ++ > koha-tmpl/intranet-tmpl/prog/js/members.js | 10 ++++++---- > 6 files changed, 15 insertions(+), 12 deletions(-) > >diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm >index 41490a1..3a64114 100644 >--- a/C4/Members/Attributes.pm >+++ b/C4/Members/Attributes.pm >@@ -374,10 +374,9 @@ sub _sort_by_code { > =cut > > sub get_guarantor_shared_attributes{ >- 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; >+ if( @attributes = split(/\|/, C4::Context->preference("GuarantorFields")) ){ >+ $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@attributes); # Trim whitespaces > } > return \@attributes; > } >diff --git a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >index 233d765..ded53de 100644 >--- a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >+++ b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >@@ -2,7 +2,7 @@ > -- SYSPREFS -- > -- ******** -- > 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') > > -- ********* -- > -- STRUCTURE -- >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index de2500d..d4d79c8 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -8,7 +8,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'), >@@ -208,6 +207,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 42ab3d6..b0e5b35 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 >@@ -234,8 +234,8 @@ Patrons: > - "to access/change superlibrarian privileges." > - "<br><strong>NOTE:</strong> A permitted user needs to have the 'permissions' flag (if no superlibrarian)." > - >- - "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 |) > >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 22a9c7b..0d1938a 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 >@@ -221,6 +221,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 1860783..761037e 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]; >+ } > } > } > } >-- >2.7.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 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