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 <msauers@dospace.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jesse Weaver 2015-08-17 15:00:10 -06:00 committed by Kyle M Hall
parent eaaea6ed27
commit d2f5f4c90a
4 changed files with 13 additions and 6 deletions

View file

@ -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';

View file

@ -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'),

View file

@ -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 <a href='http://schema.koha-community.org/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron entry screen:"
- "The following <a href='http://schema.koha-community.org/tables/borrowers.html' target='blank'>database columns</a> will not appear on the patron self-registration screen:"
- pref: PatronSelfRegistrationBorrowerUnwantedField
class: multi
- (separate columns with |)
-
- "The following <a href='http://schema.koha-community.org/tables/borrowers.html' target='blank'>database columns</a> 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

View file

@ -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) {