From c4711e84d0175d5e6b9762b9a69e2c706489a62d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Jul 2016 15:03:18 +0100 Subject: [PATCH] Bug 16847: Remove C4::Members::GetTitles This subroutine just reads the content of a pref, split it, add an empty string and returns. It is not really useful and the code in the script (memberentry.pl) uses the only occurrence of CGI::popup_menu Let's remove it and build the dropdown list in the template. Test plan: 1/ Empty BorrowersTitles, edit a patron and confirm that the "Salutation" does not appear 2/ Fill BorrowersTitles with "Mr|Mrs|Miss|Ms", edit a patron and confirm that the "Salutation" dropdown list is correctly filled. The default option should be selected if you are editing a patron with a title defined. This should also be tested at the OPAC. --- C4/Members.pm | 21 --------------------- .../prog/en/modules/members/memberentrygen.tt | 13 +++++++++++-- .../bootstrap/en/modules/opac-memberentry.tt | 4 ++-- members/memberentry.pl | 10 +--------- opac/opac-memberentry.pl | 1 - 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 383799d..71833d8 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -71,7 +71,6 @@ BEGIN { &GetAge &GetSortDetails - &GetTitles &GetHideLostItemsPreference @@ -1744,26 +1743,6 @@ EOF return 0; } -=head2 GetTitles (OUEST-PROVENCE) - - ($borrowertitle)= &GetTitles(); - -Looks up the different title . Returns array with all borrowers title - -=cut - -sub GetTitles { - my @borrowerTitle = split (/,|\|/,C4::Context->preference('BorrowersTitles')); - unshift( @borrowerTitle, "" ); - my $count=@borrowerTitle; - if ($count == 1){ - return (); - } - else { - return ( \@borrowerTitle); - } -} - =head2 GetHideLostItemsPreference $hidelostitemspref = &GetHideLostItemsPreference($borrowernumber); 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 17eeb5b..463ef61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -199,7 +199,7 @@ $(document).ready(function() {
    [% UNLESS ( I ) %] [% UNLESS notitle %] - [% IF ( title_cgipopup ) %] + [% IF Koha.Preference('BorrowersTitles') %]
  1. [% IF ( mandatorytitle ) %]
  2. [% END %] 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 b70ab9e..ca0358d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -203,7 +203,7 @@ Identity
      - [% UNLESS hidden.defined('title') || !member_titles %] + [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %]
    1. [% IF mandatory.defined('title') %]