From b23ecb5882872487395ef740f9bae0e074ad3868 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 Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- .../borrowers_primary_contact_method.perl | 6 +- .../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 73fe89c427..49ab35f70f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -765,63 +765,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 2ddd848e62..71f3449a6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -327,10 +327,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 e1fe1e188a..c9e6a9979a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -589,49 +589,35 @@ [% IF ( mandatory.defined('primary_contact_method') ) %]Required[% END %] diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 4f13a14cbe..c9a4790efd 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -102,20 +102,6 @@ $template->param( defaultCategory => $defaultCategory, ); -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.39.5