Bugzilla – Attachment 133445 Details for
Bug 28633
Add a preferred name field to patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28633: DB update
Bug-28633-DB-update.patch (text/plain), 5.89 KB, created by
Martin Renvoize (ashimema)
on 2022-04-20 10:20:08 UTC
(
hide
)
Description:
Bug 28633: DB update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-04-20 10:20:08 UTC
Size:
5.89 KB
patch
obsolete
>From 3d58d498f100162a6416dabe32a3ea0c9fac9e7a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 3 Jan 2022 15:21:52 +0000 >Subject: [PATCH] Bug 28633: DB update > >This adds the field to necessary tables and updates API and columns def > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > api/v1/swagger/definitions/patron.yaml | 5 ++ > .../data/mysql/atomicupdate/bug_28633.pl | 47 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 3 ++ > 3 files changed, 55 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_28633.pl > >diff --git a/api/v1/swagger/definitions/patron.yaml b/api/v1/swagger/definitions/patron.yaml >index 256430ae6c..cb19493fdd 100644 >--- a/api/v1/swagger/definitions/patron.yaml >+++ b/api/v1/swagger/definitions/patron.yaml >@@ -19,6 +19,11 @@ properties: > - string > - "null" > description: patron's first name >+ preferred_name: >+ type: >+ - string >+ - "null" >+ description: patron's preferred name > title: > type: > - string >diff --git a/installer/data/mysql/atomicupdate/bug_28633.pl b/installer/data/mysql/atomicupdate/bug_28633.pl >new file mode 100755 >index 0000000000..e5bbaf7c9e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_28633.pl >@@ -0,0 +1,47 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "28633", >+ description => "Add preferred_name to borrowers table", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ if( !column_exists( 'borrowers', 'preferred_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE borrowers >+ ADD COLUMN preferred_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's preferred name" >+ AFTER firstname >+ }); >+ say $out "Added preferred name column to borrowers table"; >+ } >+ if( !column_exists( 'deletedborrowers', 'preferred_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE deletedborrowers >+ ADD COLUMN preferred_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's preferred name" >+ AFTER firstname >+ }); >+ say $out "Added preferred name column to deletedborrowers table"; >+ } >+ if( !column_exists( 'borrower_modifications', 'preferred_name' ) ) { >+ $dbh->do(q{ >+ ALTER TABLE borrower_modifications >+ ADD COLUMN preferred_name longtext NULL DEFAULT NULL >+ COMMENT "patron/borrower's preferred name" >+ AFTER firstname >+ }); >+ say $out "Added preferred name column to borrower_modifications table"; >+ } >+ my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields')); >+ unless( grep /preferred_name/, @default_patron_search_fields ){ >+ if( grep /firstname/, @default_patron_search_fields ){ >+ push @default_patron_search_fields,'preferred_name'; >+ C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) ); >+ say $out "Added preferred name to DefaultPatronSearchFields"; >+ } else { >+ say $out "Please add 'preferredname' to DefaultPatronSearchFields if you want it searched by default"; >+ } >+ } >+ }, >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 0c82c00394..177238a0c7 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, >+ `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred 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', >+ `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred 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', >@@ -2390,6 +2392,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', >+ `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred 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 28633
:
123008
|
123009
|
123010
|
123658
|
125497
|
125498
|
125499
|
125500
|
126591
|
128968
|
128969
|
128970
|
130000
|
130001
|
130002
|
133445
|
133446
|
133447
|
133448
|
133449
|
133450
|
133451
|
133958
|
133959
|
133960
|
133961
|
133962
|
133963
|
133964
|
133965
|
166792
|
166793
|
166794
|
166813
|
166814
|
166815
|
166816
|
166817
|
167163
|
167164
|
173628
|
173629
|
173630
|
173631
|
173632
|
173633
|
173634
|
173664
|
173665
|
173666
|
173667
|
173668
|
173669
|
173670
|
173717
|
173718
|
173719
|
173813
|
173814
|
173815
|
173816
|
173826
|
173827
|
173828
|
173829
|
173930
|
173931
|
173932
|
173933
|
173934
|
173935
|
173936
|
174419
|
174420
|
174472
|
175177