5 description => "Add middle_name to borrowers table",
8 my ($dbh, $out) = @$args{qw(dbh out)};
9 if( !column_exists( 'borrowers', 'middle_name' ) ) {
12 ADD COLUMN middle_name longtext NULL DEFAULT NULL
13 COMMENT "patron/borrower's middle name"
16 say $out "Added middle name column to borrowers table";
18 if( !column_exists( 'deletedborrowers', 'middle_name' ) ) {
20 ALTER TABLE deletedborrowers
21 ADD COLUMN middle_name longtext NULL DEFAULT NULL
22 COMMENT "patron/borrower's middle name"
25 say $out "Added middle name column to deletedborrowers table";
27 if( !column_exists( 'borrower_modifications', 'middle_name' ) ) {
29 ALTER TABLE borrower_modifications
30 ADD COLUMN middle_name longtext NULL DEFAULT NULL
31 COMMENT "patron/borrower's middle name"
34 say $out "Added middle name column to borrower_modifications table";
36 my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields'));
37 unless( grep /middle_name/, @default_patron_search_fields ){
38 if( grep /firstname/, @default_patron_search_fields ){
39 push @default_patron_search_fields,'middle_name';
40 C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) );
41 say $out "Added middle name to DefaultPatronSearchFields";
43 say $out "Please add 'middlename' to DefaultPatronSearchFields if you want it searched by default";