@@ -, +, @@ --- .../bug_31498_add_primary_contact_av.pl | 31 ++++++++++ .../prog/en/modules/members/memberentrygen.tt | 59 ++++--------------- .../prog/en/modules/members/moremember.tt | 15 +---- .../bootstrap/en/modules/opac-memberentry.tt | 54 ++++------------- 4 files changed, 56 insertions(+), 103 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_31498_add_primary_contact_av.pl --- a/installer/data/mysql/atomicupdate/bug_31498_add_primary_contact_av.pl +++ a/installer/data/mysql/atomicupdate/bug_31498_add_primary_contact_av.pl @@ -0,0 +1,31 @@ +use Modern::Perl; + +return { + bug_number => "31498", + description => "Add CONTACT_METHODS authorized value category", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories (category_name, is_system) + VALUES + ('CONTACT_METHODS', 1) + }); + + say $out "Added CONTACT_METHODS authorized value category"; + + $dbh->do(q{ + INSERT IGNORE INTO authorised_values (category, authorised_value, lib) + VALUES + ('CONTACT_METHODS', 'phone', 'Primary phone'), + ('CONTACT_METHODS', 'phonepro', 'Secondary phone'), + ('CONTACT_METHODS', 'mobile', 'Other phone'), + ('CONTACT_METHODS', 'email', 'Primary email'), + ('CONTACT_METHODS', 'emailpro', 'Secondary email'), + ('CONTACT_METHODS', 'fax', 'Fax') + }); + + say $out "Add values to CONTACT_METHODS"; + }, +}; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -809,52 +809,19 @@ legend:hover { - - + [% SET contact_methods = AuthorisedValues.GetAuthValueDropbox('CONTACT_METHODS') %] + [% IF contact_methods.count %] + + [% END %] [% IF mandatoryprimary_contact_method %] Required [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -245,20 +245,7 @@ [% IF ( patron.primary_contact_method ) %]
  • Main contact method: - [% SWITCH patron.primary_contact_method %] - [% CASE 'phone' %] - Primary phone - [% CASE 'phonepro' %] - Secondary phone - [% CASE 'mobile' %] - Other phone - [% CASE 'email' %] - Primary email - [% CASE 'emailpro' %] - Secondary email - [% CASE 'fax' %] - Fax - [% END %] + [% AuthorisedValues.GetByCode('CONTACT_METHODS', patron.primary_contact_method) | html %]
  • [% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -606,51 +606,19 @@ [% END %] - - [% UNLESS hidden.defined('phone') %] - [% IF ( borrower.primary_contact_method == 'phone' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% UNLESS hidden.defined('phonepro') %] - [% IF ( borrower.primary_contact_method == 'phonepro' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% UNLESS hidden.defined('mobile') %] - [% IF ( borrower.primary_contact_method == 'mobile' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% UNLESS hidden.defined('email') %] - [% IF ( borrower.primary_contact_method == 'email' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% UNLESS hidden.defined('emailpro') %] - [% IF ( borrower.primary_contact_method == 'emailpro' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% UNLESS hidden.defined('fax') %] - [% IF ( borrower.primary_contact_method == 'fax' ) %] - - [% ELSE %] - + [% FOR contact_method IN contact_methods %] + [% IF contact_method.authorised_value == patron.primary_contact_method %] + + [% ELSE %] + + [% END %] [% END %] - [% END %] - + + [% END %] [% IF ( mandatory.defined('primary_contact_method') ) %]Required[% END %] [% END %] --