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

(-)a/Koha/Patron.pm (+3 lines)
Lines 251-256 sub store { Link Here
251
                }
251
                }
252
            }
252
            }
253
253
254
            # Set the sorting name for the patron
255
            $self->sort_name( $self->effective_name );
256
254
            unless ( $self->in_storage ) {    #AddMember
257
            unless ( $self->in_storage ) {    #AddMember
255
258
256
                # Generate a valid userid/login if needed
259
                # Generate a valid userid/login if needed
(-)a/api/v1/swagger/definitions/patron.yaml (+5 lines)
Lines 24-29 properties: Link Here
24
      - string
24
      - string
25
      - "null"
25
      - "null"
26
    description: patron's preferred name
26
    description: patron's preferred name
27
  sort_name:
28
    type:
29
      - string
30
      - "null"
31
    description: patron's name for sorting
27
  middle_name:
32
  middle_name:
28
    type:
33
    type:
29
      - string
34
      - string
(-)a/api/v1/swagger/paths/patrons.yaml (+5 lines)
Lines 34-39 Link Here
34
        description: Case insensitive search on preferred name
34
        description: Case insensitive search on preferred name
35
        required: false
35
        required: false
36
        type: string
36
        type: string
37
      - name: sort_name
38
        in: query
39
        description: Case insensitive search on name used for sorting
40
        required: false
41
        type: string
37
      - name: title
42
      - name: title
38
        in: query
43
        in: query
39
        description: Case insensitive search on title
44
        description: Case insensitive search on title
(-)a/installer/data/mysql/atomicupdate/bug_28633.pl (+41 lines)
Lines 39-44 return { Link Here
39
            );
39
            );
40
            say $out "Added column 'borrower_modifications.preferred_name'";
40
            say $out "Added column 'borrower_modifications.preferred_name'";
41
        }
41
        }
42
        if ( !column_exists( 'borrowers', 'sort_name' ) ) {
43
            $dbh->do(
44
                q{
45
                ALTER TABLE borrowers
46
                ADD COLUMN sort_name longtext NULL DEFAULT NULL
47
                COMMENT "patron/borrower's name for sorting purposes"
48
                AFTER preferred_name
49
            }
50
            );
51
            say $out "Added column 'borrowers.sort_name'";
52
            $dbh->do(
53
            q{
54
                UPDATE borrowers
55
                SET sort_name = firstname
56
            }
57
            );
58
            say $out "Populated sort_name with borrowers firstname"
59
60
        }
61
        if ( !column_exists( 'deletedborrowers', 'sort_name' ) ) {
62
            $dbh->do(
63
                q{
64
                ALTER TABLE deletedborrowers
65
                ADD COLUMN sort_name longtext NULL DEFAULT NULL
66
                COMMENT "patron/borrower's name for sorting purposes"
67
                AFTER preferred_name
68
            }
69
            );
70
            say $out "Added column 'deletedborrowers.sort_name'";
71
        }
72
        if ( !column_exists( 'borrower_modifications', 'sort_name' ) ) {
73
            $dbh->do(
74
                q{
75
                ALTER TABLE borrower_modifications
76
                ADD COLUMN sort_name longtext NULL DEFAULT NULL
77
                COMMENT "patron/borrower's name for sorting purposes"
78
                AFTER preferred_name
79
            }
80
            );
81
            say $out "Added column 'borrower_modifications.sort_name'";
82
        }
42
        my @default_patron_search_fields = split( '\|', C4::Context->preference('DefaultPatronSearchFields') );
83
        my @default_patron_search_fields = split( '\|', C4::Context->preference('DefaultPatronSearchFields') );
43
        unless ( grep /preferred_name/, @default_patron_search_fields ) {
84
        unless ( grep /preferred_name/, @default_patron_search_fields ) {
44
            if ( grep /firstname/, @default_patron_search_fields ) {
85
            if ( grep /firstname/, @default_patron_search_fields ) {
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 1410-1415 CREATE TABLE `borrower_modifications` ( Link Here
1410
  `surname` longtext DEFAULT NULL,
1410
  `surname` longtext DEFAULT NULL,
1411
  `firstname` mediumtext DEFAULT NULL,
1411
  `firstname` mediumtext DEFAULT NULL,
1412
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1412
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1413
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
1413
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1414
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1414
  `title` longtext DEFAULT NULL,
1415
  `title` longtext DEFAULT NULL,
1415
  `othernames` longtext DEFAULT NULL,
1416
  `othernames` longtext DEFAULT NULL,
Lines 1532-1537 CREATE TABLE `borrowers` ( Link Here
1532
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1533
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1533
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1534
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1534
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1535
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1536
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
1535
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1537
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1536
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1538
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1537
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1539
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
Lines 2668-2673 CREATE TABLE `deletedborrowers` ( Link Here
2668
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2670
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2669
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2671
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2670
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2672
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2673
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
2671
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2674
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2672
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2675
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2673
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2676
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-3 / +2 lines)
Lines 493-499 Link Here
493
                            }
493
                            }
494
                            [% CASE 'name-address' %]
494
                            [% CASE 'name-address' %]
495
                            {
495
                            {
496
                                "data": "me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",
496
                                "data": "me.surname:me.sort_name:me.middle_name:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",
497
                                "searchable": true,
497
                                "searchable": true,
498
                                "orderable": true,
498
                                "orderable": true,
499
                                "render": function( data, type, row, meta ) {
499
                                "render": function( data, type, row, meta ) {
Lines 518-524 Link Here
518
                            }
518
                            }
519
                            [% CASE 'name' %]
519
                            [% CASE 'name' %]
520
                            {
520
                            {
521
                                "data": "me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames",
521
                                "data": "me.surname:me.sort_name:me.middle_name:me.othernames",
522
                                "searchable": true,
522
                                "searchable": true,
523
                                "orderable": true,
523
                                "orderable": true,
524
                                "render": function( data, type, row, meta ) {
524
                                "render": function( data, type, row, meta ) {
525
- 

Return to bug 28633