From f91afa713aece32f02d975414cc1fde4117472f0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 18 Jun 2013 11:50:13 -0400 Subject: [PATCH] Bug 6254 - can't set patron privacy by default There is currently no way to set the privacy setting for newly created patrons. This patch adds the system preference NewPatronPrivacySetting to define what privacy setting new patrons should have. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Create a new patron 4) Verify the patron's privacy is set to 1 5) Set NewPatronPrivacySetting to "never" 6) Create a new patron 7) Verify the patron's privacy is set to 2 8) Set NewPatronPrivacySetting to "forever" 9) Create a new patron 10) Verify the patron's privacy is set to 0 Signed-off-by: Liz Rea Tested per plan, all looks ok. Signed-off-by: Katrin Fischer Passes all tests and QA script. Additional tests done: - Verified syspref.sql insert works alright - Checked editing patrons left privacy untouched. - Checked importing patrons with overlay leaves privacy alone if not provided. --- C4/Members.pm | 7 ++++++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 21 ++++++++++++++++++++ .../prog/en/modules/admin/preferences/patrons.pref | 7 ++++++ 4 files changed, 36 insertions(+), 0 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index b04cc64..ed68e67 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -807,6 +807,13 @@ sub AddMember { $data{'dateenrolled'} = C4::Dates->new()->output("iso"); } + my $NewPatronPrivacySetting = C4::Context->preference('NewPatronPrivacySetting'); + $data{'privacy'} = + $NewPatronPrivacySetting eq 'default' ? 1 + : $NewPatronPrivacySetting eq 'never' ? 2 + : $NewPatronPrivacySetting eq 'forever' ? 0 + : undef; + # create a disabled account if no password provided $data{'password'} = ($data{'password'})? hash_password($data{'password'}) : '!'; $data{'borrowernumber'}=InsertInTable("borrowers",\%data); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6438483..6ffb297 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -183,6 +183,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('memberofinstitution','0',NULL,'If ON, patrons can be linked to institutions','YesNo'), ('minPasswordLength','3',NULL,'Specify the minimum length of a patron/staff password','free'), ('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''), +( 'NewPatronPrivacySetting', 'default', 'default|never|forever', "Define the default borrower.privacy setting for new patrons, i.e. how long do we keep a patron's issue history. 1 = default, 2 = never, 0 = forever.", 'Choice' ), ('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'), ('noItemTypeImages','0',NULL,'If ON, disables item-type images','YesNo'), ('NotesBlacklist','',NULL,'List of notes fields that should not appear in the title notes/description separator of details','free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a9bfbbf..e3fdbdf 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7778,6 +7778,27 @@ if(CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + INSERT INTO systempreferences ( + variable, + value, + options, + explanation, + type + ) VALUES ( + 'NewPatronPrivacySetting', + 'default', + 'default|never|forever', + "Define the default borrower.privacy setting for new patrons, i.e. how long do we keep a patron's issue history. 1 = default, 2 = never, 0 = forever.", + 'Choice' + ) + }); + print "Upgrade to $DBversion done (Bug 6254 - can't set patron privacy by default)\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 74d14af..e356490 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 @@ -139,3 +139,10 @@ Patrons: yes: Do no: "Don't" - enable the ability to upload and attach arbitrary files to a borrower record. + - + - New patrons should have a privacy setting of + - pref: NewPatronPrivacySetting + choices: + default: default + never: never + forever: forever -- 1.7.2.5