View | Details | Raw Unified | Return to bug 24633
Collapse All | Expand All

(-)a/api/v1/swagger/definitions/patron.yaml (+5 lines)
Lines 19-24 properties: Link Here
19
      - string
19
      - string
20
      - "null"
20
      - "null"
21
    description: patron's first name
21
    description: patron's first name
22
  preferred_name:
23
    type:
24
      - string
25
      - "null"
26
    description: patron's preferred name
22
  title:
27
  title:
23
    type:
28
    type:
24
      - string
29
      - string
(-)a/installer/data/mysql/atomicupdate/bug_28633.pl (+47 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "28633",
5
    description => "Add preferred_name to borrowers table",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        if( !column_exists( 'borrowers', 'preferred_name' ) ) {
10
            $dbh->do(q{
11
                ALTER TABLE borrowers
12
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
13
                COMMENT "patron/borrower's preferred name"
14
                AFTER firstname
15
            });
16
            say $out "Added preferred name column to borrowers table";
17
        }
18
        if( !column_exists( 'deletedborrowers', 'preferred_name' ) ) {
19
            $dbh->do(q{
20
                ALTER TABLE deletedborrowers
21
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
22
                COMMENT "patron/borrower's preferred name"
23
                AFTER firstname
24
            });
25
            say $out "Added preferred name column to deletedborrowers table";
26
        }
27
        if( !column_exists( 'borrower_modifications', 'preferred_name' ) ) {
28
            $dbh->do(q{
29
                ALTER TABLE borrower_modifications
30
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
31
                COMMENT "patron/borrower's preferred name"
32
                AFTER firstname
33
            });
34
            say $out "Added preferred name column to borrower_modifications table";
35
        }
36
        my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields'));
37
        unless( grep /preferred_name/, @default_patron_search_fields ){
38
            if( grep /firstname/, @default_patron_search_fields ){
39
                push @default_patron_search_fields,'preferred_name';
40
                C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) );
41
                say $out "Added preferred name to DefaultPatronSearchFields";
42
            } else {
43
                say $out "Please add 'preferredname' to DefaultPatronSearchFields if you want it searched by default";
44
            }
45
        }
46
    },
47
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 1264-1269 CREATE TABLE `borrower_modifications` ( Link Here
1264
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1264
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1265
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1265
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1266
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1266
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1267
  `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1267
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1268
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1268
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1269
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1269
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1270
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
Lines 1382-1387 CREATE TABLE `borrowers` ( Link Here
1382
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1383
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1383
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1384
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1384
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
1385
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
1386
  `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1385
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1387
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1386
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1388
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1387
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
1389
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
Lines 2390-2395 CREATE TABLE `deletedborrowers` ( Link Here
2390
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2392
  `cardnumber` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2391
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2393
  `surname` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2392
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
2394
  `firstname` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s first name',
2395
  `preferred_name` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2393
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2396
  `title` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2394
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2397
  `othernames` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2395
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
2398
  `initials` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'initials for your patron/borrower',
2396
- 

Return to bug 24633