From d2f5f4c90a6d1de84c721fc4ae335c77a646bb2a Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Mon, 17 Aug 2015 15:00:10 -0600 Subject: [PATCH] Bug 14658 - Split PatronSelfRegistrationBorrowerUnwantedField into two preferences for creating and editing Test plan: 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. Signed-off-by: Michael Sauers Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- ...tronSelfModificationBorrowerUnwantedField_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../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 diff --git a/installer/data/mysql/atomicupdate/bug_14658-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql b/installer/data/mysql/atomicupdate/bug_14658-add_PatronSelfModificationBorrowerUnwantedField_syspref.sql new file mode 100644 index 0000000000..11e05b8432 --- /dev/null +++ b/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'; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index bfc8c317f2..e56f5ee223 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -356,6 +356,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'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 3e63f3cc78..5d1fca0d76 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -666,7 +666,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: @@ -689,10 +689,15 @@ 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 diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 72cb2560c6..f3cd3fc414 100755 --- a/opac/opac-memberentry.pl +++ b/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) { -- 2.39.5