Bugzilla – Attachment 147405 Details for
Bug 31498
Allow for custom primary contact method values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31498: Make primary_contact_method values configurable
Bug-31498-Make-primarycontactmethod-values-configu.patch (text/plain), 17.34 KB, created by
Lucas Gass (lukeg)
on 2023-02-24 21:05:06 UTC
(
hide
)
Description:
Bug 31498: Make primary_contact_method values configurable
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-02-24 21:05:06 UTC
Size:
17.34 KB
patch
obsolete
>From 3c9d919fe8706b8a84c2bd8eebf4f77093c895ff Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 24 Feb 2023 20:55:25 +0000 >Subject: [PATCH] Bug 31498: Make primary_contact_method values configurable > >This patch makes the primary_contact_method field configurable by tying the values to the new CONTACT_METHODS authorized value. > >To test: >1. Apply patch, updatedatabase, and restart_all >2. Now to go edit or create a new patron and check the 'Main contact method' dropdown. The values should be the same as they were previuosly. ( Primary phone, Secondary phone, Other phone, Primary email, Secondary email, and Fax ) >3. Try editing some patrons and changing these values, making sure they save correctly. >4. Go to the patron detail tab and make sure the correct values are displaying under 'Main contact method'. >5. Go to the OPAC and trying saving and changing the values on both the self registratin form and the modification form. >6. Now go to Administration > Authorized values > CONTACT_METHODS. Add some new CONTACT_METHODS. >7. With some ew values added try going through steps 3, 4, and 5 again. Make sure everything is displaying and saving correctly. >8. Make sure you can still hide and make required the primary_contact_method via these system prefs: > >BorrowerUnwantedField, PatronSelfModificationBorrowerUnwantedField, PatronSelfRegistrationBorrowerUnwantedField >BorrowerMandatoryField, PatronSelfRegistrationBorrowerMandatoryField >--- > .../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 > >diff --git a/installer/data/mysql/atomicupdate/bug_31498_add_primary_contact_av.pl b/installer/data/mysql/atomicupdate/bug_31498_add_primary_contact_av.pl >new file mode 100755 >index 0000000000..5c522abf3a >--- /dev/null >+++ b/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"; >+ }, >+}; >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 9dd015b99e..5d810938a9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -809,52 +809,19 @@ legend:hover { > <label for="primary_contact_method"> > [% END %] > Main contact method: </label> >- >- <select id="primary_contact_method" name="primary_contact_method"> >- <option value=""></option> >- [% UNLESS nophone %] >- [% IF ( borrower_data.primary_contact_method == 'phone' ) %] >- <option value="phone" selected="selected">Primary phone</option> >- [% ELSE %] >- <option value="phone">Primary phone</option> >- [% END %] >- [% END %] >- [% UNLESS nophonepro %] >- [% IF ( borrower_data.primary_contact_method == 'phonepro' ) %] >- <option value="phonepro" selected="selected">Secondary phone</option> >- [% ELSE %] >- <option value="phonepro">Secondary phone</option> >- [% END %] >- [% END %] >- [% UNLESS nomobile %] >- [% IF ( borrower_data.primary_contact_method == 'mobile' ) %] >- <option value="mobile" selected="selected">Other phone</option> >- [% ELSE %] >- <option value="mobile">Other phone</option> >- [% END %] >- [% END %] >- [% UNLESS noemail %] >- [% IF ( borrower_data.primary_contact_method == 'email' ) %] >- <option value="email" selected="selected">Primary email</option> >- [% ELSE %] >- <option value="email">Primary email</option> >- [% END %] >- [% END %] >- [% UNLESS noemailpro %] >- [% IF ( borrower_data.primary_contact_method == 'emailpro' ) %] >- <option value="emailpro" selected="selected">Secondary email</option> >- [% ELSE %] >- <option value="emailpro">Secondary email</option> >- [% END %] >- [% END %] >- [% UNLESS nofax %] >- [% IF ( borrower_data.primary_contact_method == 'fax' ) %] >- <option value="fax" selected="selected">Fax</option> >- [% ELSE %] >- <option value="fax">Fax</option> >- [% END %] >- [% END %] >- </select> >+ [% SET contact_methods = AuthorisedValues.GetAuthValueDropbox('CONTACT_METHODS') %] >+ [% IF contact_methods.count %] >+ <select id="primary_contact_method" name="primary_contact_method"> >+ <option value=""></option> >+ [% FOR contact_method IN contact_methods %] >+ [% IF contact_method.authorised_value == borrower_data.primary_contact_method %] >+ <option value="[% contact_method.authorised_value | html %]" selected="selected">[% contact_method.lib | html %]</option> >+ [% ELSE %] >+ <option value="[% contact_method.authorised_value | html %]">[% contact_method.lib | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ [% END %] > [% IF mandatoryprimary_contact_method %] > <span class="required">Required</span> > [% END %] >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 e37050d1af..276c25fdd5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -245,20 +245,7 @@ > [% IF ( patron.primary_contact_method ) %] > <li> > <span class="label">Main contact method: </span> >- [% SWITCH patron.primary_contact_method %] >- [% CASE 'phone' %] >- <span>Primary phone</span> >- [% CASE 'phonepro' %] >- <span>Secondary phone</span> >- [% CASE 'mobile' %] >- <span>Other phone</span> >- [% CASE 'email' %] >- <span>Primary email</span> >- [% CASE 'emailpro' %] >- <span>Secondary email</span> >- [% CASE 'fax' %] >- <span>Fax</span> >- [% END %] >+ <span>[% AuthorisedValues.GetByCode('CONTACT_METHODS', patron.primary_contact_method) | html %]</span> > </li> > [% END %] > </ol> >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 04c8c3e655..0bccd017b4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -606,51 +606,19 @@ > <label for="borrower_primary_contact_method">Main contact method:</label> > [% END %] > >- <select id="borrower_primary_contact_method" name="borrower_primary_contact_method"> >+ [% SET contact_methods = AuthorisedValues.GetAuthValueDropbox('CONTACT_METHODS') %] >+ [% IF contact_methods.count %] >+ <select id="borrower_primary_contact_method" name="borrower_primary_contact_method"> > <option value=""></option> >- [% UNLESS hidden.defined('phone') %] >- [% IF ( borrower.primary_contact_method == 'phone' ) %] >- <option value="phone" selected="selected">Primary phone</option> >- [% ELSE %] >- <option value="phone">Primary phone</option> >- [% END %] >- [% END %] >- [% UNLESS hidden.defined('phonepro') %] >- [% IF ( borrower.primary_contact_method == 'phonepro' ) %] >- <option value="phonepro" selected="selected">Secondary phone</option> >- [% ELSE %] >- <option value="phonepro">Secondary phone</option> >- [% END %] >- [% END %] >- [% UNLESS hidden.defined('mobile') %] >- [% IF ( borrower.primary_contact_method == 'mobile' ) %] >- <option value="mobile" selected="selected">Other phone</option> >- [% ELSE %] >- <option value="mobile">Other phone</option> >- [% END %] >- [% END %] >- [% UNLESS hidden.defined('email') %] >- [% IF ( borrower.primary_contact_method == 'email' ) %] >- <option value="email" selected="selected">Primary email</option> >- [% ELSE %] >- <option value="email">Primary email</option> >- [% END %] >- [% END %] >- [% UNLESS hidden.defined('emailpro') %] >- [% IF ( borrower.primary_contact_method == 'emailpro' ) %] >- <option value="emailpro" selected="selected">Secondary email</option> >- [% ELSE %] >- <option value="emailpro">Secondary email</option> >- [% END %] >- [% END %] >- [% UNLESS hidden.defined('fax') %] >- [% IF ( borrower.primary_contact_method == 'fax' ) %] >- <option value="fax" selected="selected">Fax</option> >- [% ELSE %] >- <option value="fax">Fax</option> >+ [% FOR contact_method IN contact_methods %] >+ [% IF contact_method.authorised_value == patron.primary_contact_method %] >+ <option value="[% contact_method.authorised_value | html %]" selected="selected">[% contact_method.lib | html %]</option> >+ [% ELSE %] >+ <option value="[% contact_method.authorised_value | html %]">[% contact_method.lib | html %]</option> >+ [% END %] > [% END %] >- [% END %] >- </select> >+ </select> >+ [% END %] > [% IF ( mandatory.defined('primary_contact_method') ) %]<span class="required">Required</span>[% END %] > </li> > [% END %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31498
:
147405
|
147410
|
150351