From 60b5dc1e75aeb02d0bd51b026183a035d5fe3be4 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 --- ...dd_PatronSelfModificationBorrowerUnwantedField_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 9 +++++++-- opac/opac-memberentry.pl | 11 ++++++----- 4 files changed, 15 insertions(+), 7 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 0000000..11e05b8 --- /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 6296690..1fedc9a 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -349,6 +349,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 17d0b1a..0e9089c 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 @@ -652,7 +652,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: @@ -675,11 +675,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 diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index ddaf914..bda653b 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -60,11 +60,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(), @@ -225,7 +224,9 @@ elsif ( $action eq 'edit' ) { #Display logged in borrower's data } $template->param( - borrower => $borrower, ); + borrower => $borrower, + hidden => GetHiddenFields( $mandatory, 'modification' ), + ); if (C4::Context->preference('OPACpatronimages')) { my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber}); @@ -248,11 +249,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.1.0