Bugzilla – Attachment 133752 Details for
Bug 21978
Add middle name field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21978: Add middle_name field to the database
Bug-21978-Add-middlename-field-to-the-database.patch (text/plain), 5.48 KB, created by
Martin Renvoize (ashimema)
on 2022-04-25 11:49:22 UTC
(
hide
)
Description:
Bug 21978: Add middle_name field to the database
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-04-25 11:49:22 UTC
Size:
5.48 KB
patch
obsolete
>From 5adda468b3810eb3a0ef41e94efecd4945ce19f9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 19 Apr 2022 15:34:31 +0100 >Subject: [PATCH] Bug 21978: Add middle_name field to the database > >This patch adds a new field, middle_name, to the borrowers, >deletedborrowers and borrower_modifications tables. > >It also updates the DefaultPatronSearchFields preference to include the >new field if the preference is still set to it's default settings from >install. >--- > .../data/mysql/atomicupdate/bug_21978.pl | 47 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 3 ++ > 2 files changed, 50 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_21978.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_21978.pl b/installer/data/mysql/atomicupdate/bug_21978.pl >new file mode 100755 >index 0000000000..8abb859971 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_21978.pl >@@ -0,0 +1,47 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "21978", >+ description => "Add middle_name to borrowers table", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ if( !column_exists( 'borrowers', 'middle_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE borrowers >+ ADD COLUMN middle_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's middle name" >+ AFTER firstname >+ }); >+ say $out "Added middle name column to borrowers table"; >+ } >+ if( !column_exists( 'deletedborrowers', 'middle_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE deletedborrowers >+ ADD COLUMN middle_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's middle name" >+ AFTER firstname >+ }); >+ say $out "Added middle name column to deletedborrowers table"; >+ } >+ if( !column_exists( 'borrower_modifications', 'middle_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE borrower_modifications >+ ADD COLUMN middle_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's middle name" >+ AFTER firstname >+ }); >+ say $out "Added middle name column to borrower_modifications table"; >+ } >+ my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields')); >+ unless( grep /middle_name/, @default_patron_search_fields ){ >+ if( grep /firstname/, @default_patron_search_fields ){ >+ push @default_patron_search_fields,'middle_name'; >+ C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) ); >+ say $out "Added middle name to DefaultPatronSearchFields"; >+ } else { >+ say $out "Please add 'middlename' to DefaultPatronSearchFields if you want it searched by default"; >+ } >+ } >+ }, >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 8f5f7b438f..5b17e5f723 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1264,6 +1264,7 @@ CREATE TABLE `borrower_modifications` ( > `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, >+ `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name', > `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, >@@ -1382,6 +1383,7 @@ CREATE TABLE `borrowers` ( > `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers', > `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)', > `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name', >+ `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name', > `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.', > `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower', > `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower', >@@ -2392,6 +2394,7 @@ CREATE TABLE `deletedborrowers` ( > `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers', > `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)', > `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name', >+ `middle_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s middle name', > `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.', > `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower', > `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower', >-- >2.20.1
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 21978
:
133431
|
133432
|
133433
|
133434
|
133435
|
133436
|
133437
|
133438
|
133453
|
133454
|
133455
|
133456
|
133534
|
133535
|
133536
|
133537
|
133544
|
133545
|
133546
|
133547
|
133751
|
133752
|
133753
|
133754
|
133755
|
133756
|
133757
|
134254
|
134255
|
134256
|
134257
|
134258
|
134259
|
134495
|
134497
|
134498
|
134499
|
134500
|
134501
|
134502
|
134503
|
134745
|
134746
|
134747
|
134748
|
134749
|
134750
|
134751
|
135147
|
135148
|
135149
|
135150
|
135151
|
135152
|
135153
|
135154
|
135155
|
135180
|
135181
|
135182
|
135183
|
135184
|
135185
|
135186
|
135187
|
135188
|
135189
|
136513
|
136514
|
136515
|
136516
|
136517
|
136518
|
136519
|
136520
|
136521
|
136522
|
137612