@@ -, +, @@ to searches Add preferredname if not --- C4/Utils/DataTables/Members.pm | 2 +- circ/ysearch.pl | 2 +- .../{bug_28633.perl => bug_28633.pl} | 18 +++++++++++++----- .../prog/en/includes/patronfields.inc | 2 +- .../en/modules/admin/preferences/patrons.pref | 2 +- .../prog/en/modules/members/moremember.tt | 6 ++++++ 6 files changed, 23 insertions(+), 9 deletions(-) rename installer/data/mysql/atomicupdate/{bug_28633.perl => bug_28633.pl} (56%) --- a/C4/Utils/DataTables/Members.pm +++ a/C4/Utils/DataTables/Members.pm @@ -113,7 +113,7 @@ sub search { } my $searchfields = { - standard => C4::Context->preference('DefaultPatronSearchFields') || 'surname,firstname,othernames,cardnumber,userid', + standard => C4::Context->preference('DefaultPatronSearchFields') || 'surname,firstname,preferredname,othernames,cardnumber,userid', email => 'email,emailpro,B_email', borrowernumber => 'borrowernumber', phone => 'phone,phonepro,B_phone,altcontactphone,mobile', --- a/circ/ysearch.pl +++ a/circ/ysearch.pl @@ -84,7 +84,7 @@ while ( my $b = $borrowers_rs->next ) { push @borrowers, { borrowernumber => $b->borrowernumber, surname => $b->surname // '', - firstname => $b->firstname // '', + firstname => $b->effective_name // '', cardnumber => $b->cardnumber // '', dateofbirth => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '', age => $b->get_age // '', --- a/installer/data/mysql/atomicupdate/bug_28633.perl +++ a/installer/data/mysql/atomicupdate/bug_28633.perl @@ -13,7 +13,7 @@ return { COMMENT "patron/borrower's preferred name" AFTER firstname }); - say $out "Add preferred name column to borrowers table"; + say $out "Added preferred name column to borrowers table"; } if( !column_exists( 'deletedborrowers', 'preferredname' ) ) { $dbh->do(q{ @@ -22,7 +22,7 @@ return { COMMENT "patron/borrower's preferred name" AFTER firstname }); - say $out "Add preferred name column to deletedborrowers table"; + say $out "Added preferred name column to deletedborrowers table"; } if( !column_exists( 'borrower_modifications', 'preferredname' ) ) { $dbh->do(q{ @@ -31,9 +31,17 @@ return { COMMENT "patron/borrower's preferred name" AFTER firstname }); - say $out "Add preferred name column to borrower_modifications table"; + say $out "Added preferred name column to borrower_modifications table"; + } + my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields')); + unless( grep /preferredname/, @default_patron_search_fields ){ + if( grep /firstname/, @default_patron_search_fields ){ + push @default_patron_search_fields,'preferredname'; + C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) ); + say $out "Added preferred name to DefaultPatronSearchFields"; + } else { + say $out "Please add 'preferredname' to DefaultPatronSearchFields if you want it searched by default"; + } } - $dbh->do(q{}); - # Print useful stuff here }, } --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc @@ -5,7 +5,7 @@ [%- CASE 'cardnumber' -%]Card number [%- CASE 'surname' -%]Surname [%- CASE 'firstname' -%]First name - [%- CASE 'firstname' -%]Preferred name + [%- CASE 'preferredname' -%]Preferred name [%- CASE 'title' -%]Salutation [%- CASE 'othernames' -%]Other name [%- CASE 'initials' -%]Initials --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -48,7 +48,7 @@ Patrons: - "Comma separated list defining the default fields to be used during a patron search using the \"standard\" option:" - pref: DefaultPatronSearchFields class: multi - - "If empty Koha will default to \"surname,firstname,othernames,cardnumber,userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page." + - "If empty Koha will default to \"surname,firstname,preferredname,othernames,cardnumber,userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page." - - "Show the following fields from the items database table as columns on the statistics tab on the patron record: " - pref: StatisticsFields --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -124,6 +124,12 @@
    + [% IF ( patron.preferredname && patron.firstname ) %] + + [% END %] [% IF ( patron.phone ) %]
  1. Primary phone: --