@@ -, +, @@ into two preferences for creating and editing 1) Make sure there is at least one field in PatronSelfRegistrationBorrowerUnwantedField. 2) Apply patch, and update database. 3) Check to make sure that the new system preference PatronSelfModificationBorrowerUnwantedField has the same value as PatronSelfRegistrationBorrowerUnwantedField. 4) Verify that the same fields are hidden for self-registering a new borrower and edting a new one (both on the OPAC). 5) Change PatronSelfModificationBorrowerUnwantedField, and verify that the two preferences correctly apply to editing vs. creating. --- ...8-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 9 +++++++-- opac/opac-memberentry.pl | 8 ++++---- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14658-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql --- a/installer/data/mysql/atomicupdate/bug_14658-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql +++ a/installer/data/mysql/atomicupdate/bug_14658-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) SELECT 'PatronSelfModificationBorrowerUnwantedField',value,NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free' FROM systempreferences WHERE variable = 'PatronSelfRegistrationBorrowerUnwantedField'; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -355,6 +355,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'), ('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'), ('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'), +('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'), ('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'), ('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'), ('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -673,7 +673,7 @@ OPAC: choices: yes: Allow no: "Don't allow" - - "library patrons to register an account via the OPAC." + - "library patrons to register or modify their account via the OPAC." - - pref: PatronSelfRegistrationVerifyByEmail choices: @@ -696,11 +696,16 @@ OPAC: class: multi - (separate columns with |) - - - "The following database columns will not appear on the patron entry screen:" + - "The following database columns will not appear on the patron self-registration screen:" - pref: PatronSelfRegistrationBorrowerUnwantedField class: multi - (separate columns with |) - + - "The following database columns will not appear on the patron self-modification screen:" + - pref: PatronSelfModificationBorrowerUnwantedField + class: multi + - (separate columns with |) + - - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):" - pref: PatronSelfRegistrationAdditionalInstructions type: htmlarea --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -61,11 +61,10 @@ if ( $action eq q{} ) { } my $mandatory = GetMandatoryFields($action); -my $hidden = GetHiddenFields($mandatory); $template->param( action => $action, - hidden => $hidden, + hidden => GetHiddenFields( $mandatory, 'registration' ), mandatory => $mandatory, member_titles => GetTitles() || undef, branches => GetBranchesLoop(), @@ -228,6 +227,7 @@ elsif ( $action eq 'edit' ) { #Display logged in borrower's data $template->param( borrower => $borrower, guarantor => scalar Koha::Borrowers->find($borrowernumber)->guarantor(), + hidden => GetHiddenFields( $mandatory, 'modification' ), ); if (C4::Context->preference('OPACpatronimages')) { @@ -251,11 +251,11 @@ $template->param( output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 }; sub GetHiddenFields { - my ($mandatory) = @_; + my ( $mandatory, $action ) = @_; my %hidden_fields; my $BorrowerUnwantedField = - C4::Context->preference("PatronSelfRegistrationBorrowerUnwantedField"); + C4::Context->preference( "PatronSelf" . ucfirst($action) . "BorrowerUnwantedField" ); my @fields = split( /\|/, $BorrowerUnwantedField ); foreach (@fields) { --