From 351c23e071ce3ce133e7b19ed889b7ff75ede011 Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Tue, 20 Oct 2020 11:56:42 -0400 Subject: [PATCH] Bug 11879: (follow up) Some fixes and code cleanup - Display the value in the patron detail page - Adds support for BorrowerUnwantedField (staff) - Removes unecessary code in opac/opac-memberentry.pl Sponsored-by: CCSR ( http://www.ccsr.qc.ca ) Signed-off-by: David Nind --- .../borrowers_primary_contact_method.perl | 6 +- .../en/modules/admin/preferences/borrowers.json | 3 +- .../prog/en/modules/members/memberentrygen.tt | 100 +++++++++++---------- .../prog/en/modules/members/moremember.tt | 4 +- .../bootstrap/en/modules/opac-memberentry.tt | 72 ++++++--------- opac/opac-memberentry.pl | 14 --- 6 files changed, 87 insertions(+), 112 deletions(-) diff --git a/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.perl b/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.perl index e34fc015a2..a422b78fdd 100644 --- a/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.perl +++ b/installer/data/mysql/atomicupdate/borrowers_primary_contact_method.perl @@ -1,15 +1,15 @@ $DBversion = 'XXX'; # will be replaced by the RM if( CheckVersion( $DBversion ) ) { if( !column_exists( 'borrowers', 'primary_contact_method' ) ) { - $dbh->do( "ALTER TABLE `borrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `anonymized`" ); + $dbh->do( "ALTER TABLE `borrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `autorenew_checkouts`" ); } if( !column_exists( 'deletedborrowers', 'primary_contact_method' ) ) { - $dbh->do( "ALTER TABLE `deletedborrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `anonymized`" ); + $dbh->do( "ALTER TABLE `deletedborrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `autorenew_checkouts`" ); } if( !column_exists( 'borrower_modifications', 'primary_contact_method' ) ) { - $dbh->do( "ALTER TABLE `borrower_modifications` ADD COLUMN `primary_contact_method` VARCHAR(45) NULL DEFAULT NULL AFTER `gdpr_proc_consent`" ); + $dbh->do( "ALTER TABLE `borrower_modifications` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `gdpr_proc_consent`" ); } SetVersion( $DBversion ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json index 62b75d2705..1a3f77e051 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/borrowers.json @@ -51,5 +51,6 @@ "altcontactzipcode": "altcontactzipcode", "altcontactcountry": "altcontactcountry", "altcontactphone": "altcontactphone", - "smsalertnumber": "smsalertnumber" + "smsalertnumber": "smsalertnumber", + "primary_contact_method": "primary_contact_method" } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index f19d269750..a289c0ee7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -741,63 +741,65 @@ legend:hover { [% END #/UNLESS nofax %] -
  • - [% IF mandatoryprimary_contact_method %] -
  • + [% IF mandatoryprimary_contact_method %] +
  • + + [% END %] [% END # hide fieldset %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index ee44e3cc9d..5c56406ba8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -311,10 +311,10 @@ [% END %] - [% IF ( primary_contact_method ) %] + [% IF ( patron.primary_contact_method ) %]
  • Main contact method: - [% SWITCH primary_contact_method %] + [% SWITCH patron.primary_contact_method %] [% CASE 'phone' %] Primary phone [% CASE 'phonepro' %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index 70381a3bf9..77fc62151a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -634,49 +634,35 @@ [% IF ( mandatory.defined('primary_contact_method') ) %]Required[% END %] diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index ab26559eb6..6b7afc0175 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -101,20 +101,6 @@ $template->param( OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), ); -my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField"); -my @field_check=split(/\|/,$check_BorrowerMandatoryField); -my @contactprincipalloop; -my @fieldArray = qw(phone phonepro mobile email emailpro fax); -foreach my $field (@fieldArray) { - if ( !(grep { $field eq $_ } @field_check)){ - push @contactprincipalloop,{ - 'currentis_' . $field => 1 - }; - } -} - -$template->param('contactprincipalloop' => \@contactprincipalloop); - my $attributes = ParsePatronAttributes($borrowernumber,$cgi); my $conflicting_attribute = 0; -- 2.11.0