@@ -, +, @@ - In Administration -> Authorized values, locate the category 'PATRON_TITLE'. - Create two or more authorized values with new patron titles. - In Administration -> System preferences -> Patrons, there should be no entry for BorrowersTitles. - Create or edit a patron. Under "Salutation" your authorized values should appear correctly. - Log in to the OPAC and go to "Your personal details." Confirm that the correct values are shown there. - Remove all PATRON_TITLE authorized values and confirm that the "Salutation" field no longer appears on the staff client or OPAC patron entry form. --- ...bug_11815-convert-borrowertitle-to-authval.perl | 23 ++++++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 - .../prog/en/modules/admin/authorised_values.tt | 2 ++ .../prog/en/modules/admin/preferences/patrons.pref | 5 ----- .../prog/en/modules/members/memberentrygen.tt | 12 +++++------ .../bootstrap/en/modules/opac-memberentry.tt | 10 +++++----- members/memberentry.pl | 3 +++ opac/opac-memberentry.pl | 3 +++ 8 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl --- a/installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl +++ a/installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl @@ -0,0 +1,23 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + my ( $BorrowersTitles ) = $dbh->selectrow_array( q| + SELECT value FROM systempreferences WHERE variable='BorrowersTitles'; + |); + if( $BorrowersTitles ){ + $dbh->do(" + INSERT INTO authorised_value_categories( category_name ) VALUES ('PATRON_TITLE') + "); + my @titles; + push @titles, split ('\|', $BorrowersTitles); + my $sth = $dbh->prepare(" + INSERT INTO authorised_values(category, authorised_value, lib, lib_opac) VALUES ('PATRON_TITLE', ?, ?, ?) + "); + foreach my $patron_title ( @titles ) { + $sth->execute( $patron_title, $patron_title, $patron_title ); + } + } + # Remove the BorrowersTitles system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='BorrowersTitles'"); + SetVersion ($DBversion); + print "Upgrade to $DBversion done (Bug 11815: convert BorrowersTitles to an authorised value)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -101,7 +101,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'), ('BorrowerRenewalPeriodBase','now','dateexpiry|now|combination','Set whether the borrower renewal date should be counted from the dateexpiry, from the current date or by combination: if the dateexpiry is in future use dateexpiry, else use current date ','Choice'), ('BorrowersLog','1',NULL,'If ON, log edit/create/delete actions on patron data','YesNo'), -('BorrowersTitles','Mr|Mrs|Miss|Ms',NULL,'Define appropriate Titles for patrons','free'), ('BorrowerUnwantedField','',NULL,'Name the fields you don\'t need to store for a patron\'s account','free'), ('BranchTransferLimitsType','ccode','itemtype|ccode','When using branch transfer limits, choose whether to limit by itemtype or collection code.','Choice'), ('BrowseResultSelection','0',NULL,'Enable/Disable browsing search results fromt the bibliographic record detail page in staff client','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -420,6 +420,8 @@

A list of reasons displayed in the suggestion form on the OPAC.

[% CASE 'ORDER_CANCELLATION_REASON' %]

Reasons why an order might have been cancelled

+ [% CASE 'PATRON_TITLE' %] +

Titles or honorifics which can be added to a patron record

[% CASE 'PAYMENT_TYPE' %]

Populates a dropdown list of custom payment types when paying fines

[% CASE 'qualif' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -53,11 +53,6 @@ Patrons: class: multi - (input multiple choices separated by |). Leave empty to deactivate - - - "Borrowers can have the following titles:" - - pref: BorrowersTitles - class: multi - - (separate multiple choices with |) - - - pref: CheckPrevCheckout default: no choices: --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -240,7 +240,7 @@
    [% UNLESS ( I ) %] [% UNLESS notitle %] - [% IF Koha.Preference('BorrowersTitles') %] + [% IF ( patron_titles ) %]
  1. [% IF ( mandatorytitle ) %] @@ -262,7 +262,7 @@ Required [% END %]
  2. - [% END # /IF Koha.Preference('BorrowersTitles') %] + [% END # /IF ( patron_titles ) %] [% END # /UNLESS notitle %] [% END # /UNLESS ( I ) %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -274,7 +274,7 @@ Identity
      - [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %] + [% UNLESS hidden.defined('title') || !patron_titles %]
    1. [% IF mandatory.defined('title') %] @@ -284,11 +284,11 @@ --- a/members/memberentry.pl +++ a/members/memberentry.pl @@ -654,9 +654,12 @@ $template->param( my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } ); my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' ); +my $patron_titles = C4::Koha::GetAuthorisedValues( 'PATRON_TITLE' ); + $template->param( roadtypes => $roadtypes, cities => $cities, + patron_titles => $patron_titles, ); my $default_borrowertitle = ''; --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -28,6 +28,7 @@ use C4::Output; use C4::Members; use C4::Members::Attributes qw( GetBorrowerAttributes ); use C4::Form::MessagingPreferences; +use Koha::AuthorisedValues; use Koha::AuthUtils; use Koha::Patrons; use Koha::Patron::Consent; @@ -74,6 +75,7 @@ if ( $action eq q{} ) { } my $mandatory = GetMandatoryFields($action); +my $patron_titles = C4::Koha::GetAuthorisedValues( 'PATRON_TITLE' ); my @libraries = Koha::Libraries->search; if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) { @@ -93,6 +95,7 @@ $template->param( mandatory => $mandatory, libraries => \@libraries, OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), + patron_titles => $patron_titles, ); my $attributes = ParsePatronAttributes($borrowernumber,$cgi); --