From 8cd8cde9b23ea8fd2a65b1f5382823ce02d57187 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 30 Apr 2012 13:02:58 -0400 Subject: [PATCH] Bug 8029 - Allow ExtendedPatronAttributes to *not* be searched when enabled. Right now, if extended patron attributes are enabled, all those fields are searched on when searching for patrons. A library using Koha should be able to use extended attributes without necessarily being able to search on them. Adds the system preference ExtendedPatronAttributesSearch, which will by default be set to the same value as ExtendedPatronAttributes, so upgrading will retain the same functionality. --- C4/Members.pm | 2 +- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 11 +++++++++++ .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 6161ac9..038f6ee 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -227,7 +227,7 @@ sub Search { } } - if ( !$found_borrower && C4::Context->preference('ExtendedPatronAttributes') && $search_string ) { + if ( !$found_borrower && C4::Context->preference('ExtendedPatronAttributesSearch') && $search_string ) { my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($search_string); if(scalar(@$matching_records)>0) { if ( my $fr = ref $filter ) { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..df1df14 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -195,6 +195,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributes','0','Use extended patron IDs and attributes',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ExtendedPatronAttributesSearch','0','Search on extended patron IDs and attributes',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion','0','If ON, adds a new suggestion at serial subscription renewal',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GoogleJackets','0','if ON, displays jacket covers from Google Books API',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..01aea12 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,17 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(" + INSERT INTO systempreferences (variable,value,explanation,options,type) + VALUES ('ExtendedPatronAttributesSearch',?,'Search on extended patron IDs and attributes',NULL,'YesNo')", + undef, C4::Context->preference("ExtendedPatronAttributes") + ); + print "Upgrade to $DBversion done\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 55b4457..a5376d1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -68,6 +68,12 @@ Patrons: no: "Don't enable" - searching, editing and display of custom attributes on patrons. - + - pref: ExtendedPatronAttributesSearch + choices: + yes: Search + no: "Don't search" + - on a patron's extended attributes. + - - pref: intranetreadinghistory choices: yes: "Allow" -- 1.7.2.5