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 1402-1407 CREATE TABLE `borrower_modifications` ( Link Here
1402
  `surname` longtext DEFAULT NULL,
1402
  `surname` longtext DEFAULT NULL,
1403
  `firstname` mediumtext DEFAULT NULL,
1403
  `firstname` mediumtext DEFAULT NULL,
1404
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1404
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1405
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
1405
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1406
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1406
  `title` longtext DEFAULT NULL,
1407
  `title` longtext DEFAULT NULL,
1407
  `othernames` longtext DEFAULT NULL,
1408
  `othernames` longtext DEFAULT NULL,
Lines 1524-1529 CREATE TABLE `borrowers` ( Link Here
1524
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1525
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
1525
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1526
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
1526
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1527
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
1528
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
1527
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1529
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
1528
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1530
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
1529
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
1531
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
Lines 2661-2666 CREATE TABLE `deletedborrowers` ( Link Here
2661
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2663
  `surname` longtext DEFAULT NULL COMMENT 'patron/borrower''s last name (surname)',
2662
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2664
  `firstname` mediumtext DEFAULT NULL COMMENT 'patron/borrower''s first name',
2663
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2665
  `preferred_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s preferred name',
2666
  `sort_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s name to be used for sorting',
2664
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2667
  `middle_name` longtext DEFAULT NULL COMMENT 'patron/borrower''s middle name',
2665
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2668
  `title` longtext DEFAULT NULL COMMENT 'patron/borrower''s title, for example: Mr. or Mrs.',
2666
  `othernames` longtext DEFAULT NULL COMMENT 'any other names associated with the patron/borrower',
2669
  `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 536-542 Link Here
536
                            }
536
                            }
537
                            [% CASE 'name-address' %]
537
                            [% CASE 'name-address' %]
538
                            {
538
                            {
539
                                "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",
539
                                "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",
540
                                "searchable": true,
540
                                "searchable": true,
541
                                "orderable": true,
541
                                "orderable": true,
542
                                "render": function( data, type, row, meta ) {
542
                                "render": function( data, type, row, meta ) {
Lines 561-567 Link Here
561
                            }
561
                            }
562
                            [% CASE 'name' %]
562
                            [% CASE 'name' %]
563
                            {
563
                            {
564
                                "data": "me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames",
564
                                "data": "me.surname:me.sort_name:me.middle_name:me.othernames",
565
                                "searchable": true,
565
                                "searchable": true,
566
                                "orderable": true,
566
                                "orderable": true,
567
                                "render": function( data, type, row, meta ) {
567
                                "render": function( data, type, row, meta ) {
568
- 

Return to bug 28633