Bugzilla – Attachment 98657 Details for
Bug 11815
Convert BorrowersTitles to an authorised value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11815: Convert BorrowersTitles to an authorised value
Bug-11815-Convert-BorrowersTitles-to-an-authorised.patch (text/plain), 12.63 KB, created by
Owen Leonard
on 2020-02-10 13:59:36 UTC
(
hide
)
Description:
Bug 11815: Convert BorrowersTitles to an authorised value
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-02-10 13:59:36 UTC
Size:
12.63 KB
patch
obsolete
>From 28a5e2441b012e77c2c5ec13bc7723dab8e8a219 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 10 Jan 2019 19:08:59 +0000 >Subject: [PATCH] Bug 11815: Convert BorrowersTitles to an authorised value > >This patch removes the BorrowersTitles system preference in favor of >using authorized values to store patron titles. > >To test, apply the patch and run the database update. > > - 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 > >diff --git a/installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl b/installer/data/mysql/atomicupdate/bug_11815-convert-borrowertitle-to-authval.perl >new file mode 100644 >index 00000000000..57a00a3e42b >--- /dev/null >+++ b/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"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index cfa295e1970..8bb7ec83780 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/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'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index 8f71938964e..45c408e6c29 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -390,6 +390,8 @@ > <p>A list of reasons displayed in the suggestion form on the OPAC.</p> > [% CASE 'ORDER_CANCELLATION_REASON' %] > <p>Reasons why an order might have been cancelled</p> >+ [% CASE 'PATRON_TITLE' %] >+ <p>Titles or honorifics which can be added to a patron record</p> > [% CASE 'PAYMENT_TYPE' %] > <p>Populates a dropdown list of custom payment types when paying fines</p> > [% CASE 'qualif' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 9e37372f4e4..02be9e532bb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/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: >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 cbb8ae2d0ef..68472438634 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -240,7 +240,7 @@ > <ol> > [% UNLESS ( I ) %] > [% UNLESS notitle %] >- [% IF Koha.Preference('BorrowersTitles') %] >+ [% IF ( patron_titles ) %] > <li> > [% IF ( mandatorytitle ) %] > <label for="btitle" class="required"> >@@ -250,11 +250,11 @@ > Salutation: </label> > <select id="btitle" name="title"> > <option value=""></option> >- [% FOREACH t IN Koha.Preference('BorrowersTitles').split('\|') %] >- [% IF btitle == t %] >- <option value="[% t | html %]" selected="selected">[% t | html %]</option> >+ [% FOREACH ptitle IN patron_titles %] >+ [% IF btitle == ptitle.lib %] >+ <option value="[% ptitle.lib | html %]" selected="selected">[% ptitle.lib | html %]</option> > [% ELSE %] >- <option value="[% t | html %]">[% t | html %]</option> >+ <option value="[% ptitle.lib | html %]">[% ptitle.lib | html %]</option> > [% END %] > [% END %] > </select> >@@ -262,7 +262,7 @@ > <span class="required">Required</span> > [% END %] > </li> >- [% END # /IF Koha.Preference('BorrowersTitles') %] >+ [% END # /IF ( patron_titles ) %] > [% END # /UNLESS notitle %] > [% END # /UNLESS ( I ) %] > >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 8761cc88ae5..70970abc24c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -274,7 +274,7 @@ > <legend id="identity_legend">Identity</legend> > > <ol> >- [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %] >+ [% UNLESS hidden.defined('title') || !patron_titles %] > <li> > [% IF mandatory.defined('title') %] > <label for="borrower_title" class="required">Salutation:</label> >@@ -284,11 +284,11 @@ > > <select id="borrower_title" name="borrower_title"> > <option value=""></option> >- [% FOREACH mt IN Koha.Preference('BorrowersTitles').split('\|') %] >- [% IF mt == borrower.title %] >- <option value="[% mt | html %]" selected="selected">[% mt | html %]</option> >+ [% FOREACH ptitle IN patron_titles %] >+ [% IF borrower.title == ptitle.lib %] >+ <option value="[% ptitle.lib | html %]" selected="selected">[% ptitle.lib | html %]</option> > [% ELSE %] >- <option value="[% mt | html %]">[% mt | html %]</option> >+ <option value="[% ptitle.lib | html %]">[% ptitle.lib | html %]</option> > [% END %] > [% END %] > </select> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 902beeb0e87..2fa2a88b161 100755 >--- a/members/memberentry.pl >+++ b/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 = ''; >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 2272f169215..b66c76a4373 100755 >--- a/opac/opac-memberentry.pl >+++ b/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); >-- >2.11.0
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 11815
:
94637
|
98656
|
98657
|
98668