View | Details | Raw Unified | Return to bug 28633
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
  middle_name:
27
  middle_name:
23
    type:
28
    type:
24
      - string
29
      - string
(-)a/installer/data/mysql/atomicupdate/bug_28633.pl (+53 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(
11
                q{
12
                ALTER TABLE borrowers
13
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
14
                COMMENT "patron/borrower's preferred name"
15
                AFTER firstname
16
            }
17
            );
18
            say $out "Added preferred name column to borrowers table";
19
        }
20
        if ( !column_exists( 'deletedborrowers', 'preferred_name' ) ) {
21
            $dbh->do(
22
                q{
23
                ALTER TABLE deletedborrowers
24
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
25
                COMMENT "patron/borrower's preferred name"
26
                AFTER firstname
27
            }
28
            );
29
            say $out "Added preferred name column to deletedborrowers table";
30
        }
31
        if ( !column_exists( 'borrower_modifications', 'preferred_name' ) ) {
32
            $dbh->do(
33
                q{
34
                ALTER TABLE borrower_modifications
35
                ADD COLUMN preferred_name longtext NULL DEFAULT NULL
36
                COMMENT "patron/borrower's preferred name"
37
                AFTER firstname
38
            }
39
            );
40
            say $out "Added preferred name column to borrower_modifications table";
41
        }
42
        my @default_patron_search_fields = split( '\|', C4::Context->preference('DefaultPatronSearchFields') );
43
        unless ( grep /preferred_name/, @default_patron_search_fields ) {
44
            if ( grep /firstname/, @default_patron_search_fields ) {
45
                push @default_patron_search_fields, 'preferred_name';
46
                C4::Context->set_preference( 'DefaultPatronSearchFields', join( '|', @default_patron_search_fields ) );
47
                say $out "Added preferred name to DefaultPatronSearchFields";
48
            } else {
49
                say $out "Please add 'preferred_name' to DefaultPatronSearchFields if you want it searched by default";
50
            }
51
        }
52
    },
53
    }
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 1408-1413 CREATE TABLE `borrower_modifications` ( Link Here
1408
  `cardnumber` varchar(32) DEFAULT NULL,
1408
  `cardnumber` varchar(32) DEFAULT NULL,
1409
  `surname` longtext DEFAULT NULL,
1409
  `surname` longtext DEFAULT NULL,
1410
  `firstname` mediumtext DEFAULT NULL,
1410
  `firstname` mediumtext DEFAULT NULL,
1411
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1411
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1412
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1412
  `title` longtext DEFAULT NULL,
1413
  `title` longtext DEFAULT NULL,
1413
  `othernames` longtext DEFAULT NULL,
1414
  `othernames` longtext DEFAULT NULL,
Lines 1529-1534 CREATE TABLE `borrowers` ( Link Here
1529
  `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1530
  `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
1530
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1531
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1531
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1532
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1533
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1532
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1534
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1533
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1535
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1534
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1536
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
Lines 2664-2669 CREATE TABLE `deletedborrowers` ( Link Here
2664
  `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2666
  `cardnumber` varchar(32) DEFAULT NULL COMMENT 'unique key, library assigned ID number for patrons/borrowers',
2665
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2667
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2666
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2668
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2669
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2667
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2670
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2668
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2671
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2669
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2672
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2670
- 

Return to bug 28633