@@ -, +, @@ streetnumber|address|address2|city|state|zipcode|country| branchcode|phonepro|mobile|email|emailpro|fax --- 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(-) --- a/C4/Members/Attributes.pm +++ a/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; } --- a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql +++ a/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 -- --- a/installer/data/mysql/sysprefs.sql +++ a/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'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -234,8 +234,8 @@ Patrons: - "to access/change superlibrarian privileges." - "
NOTE: A permitted user needs to have the 'permissions' flag (if no superlibrarian)." - - - "These additional following database columns will be transferred from guarantor to guarantee:" - - pref: AdditionalGuarantorField + - "These following database columns will be transferred from guarantor to guarantee:" + - pref: GuarantorFields class: multi - (separate columns with |) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ a/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) ); }); --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ a/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]; + } } } } --