@@ -, +, @@ - 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 | 8 ++++++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 23 +++++++++++++++++++- .../prog/en/modules/admin/preferences/patrons.pref | 7 ++++++ 4 files changed, 37 insertions(+), 2 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -766,11 +766,17 @@ 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'})? md5_base64($data{'password'}) : '!'; $data{'borrowernumber'}=InsertInTable("borrowers",\%data); - # mysql_insertid is probably bad. not necessarily accurate and mysql-specific at best. logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog"); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -428,3 +428,4 @@ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo'); +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' ); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7036,7 +7036,6 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } - $DBversion = "3.13.00.012"; if ( CheckVersion($DBversion) ) { $dbh->do("ALTER TABLE issuingrules MODIFY COLUMN overduefinescap decimal(28,6) DEFAULT NULL;"); @@ -7044,6 +7043,28 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } + +$DBversion = "3.13.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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/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 --