From f6a5d7493fcc9dc03ca2252cccef35b4ce154e4e Mon Sep 17 00:00:00 2001 From: Jon Knight Date: Tue, 29 May 2018 09:59:37 +0000 Subject: [PATCH] Bug 20028: Export all patron related personal data in one package Add a system preference to determine whether patron data export is permitted, and if it is an extra option in the staff UI to initiate the export. At this stage the API for patron data isn't ready so as a placeholder it just goes to the readingrec.pl script. Testing plan: * Apply patch. * Turn the AllowGDPRPatronExport in the administration sysprefs * Search for a patron (eg Mabel in the standard test data) and then click on the "More" button on the right hand side of the button bar. You should see "Export patron's GDPR data" option. Selecting that will currently just go to the readingrec.pl page. * Turn off AllowGDPRPatronExport in the administration sysprefs * The "Export patron's GDPR data" option should no long be visible from the "More" button in the patron page. Full description of what the patch does --- .../bug_20028-add_allowgdprpatronexport_syspref.perl | 16 ++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/includes/members-toolbar.inc | 3 +++ .../prog/en/modules/admin/preferences/patrons.pref | 6 ++++++ koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 8 ++++++++ 5 files changed, 34 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_20028-add_allowgdprpatronexport_syspref.perl diff --git a/installer/data/mysql/atomicupdate/bug_20028-add_allowgdprpatronexport_syspref.perl b/installer/data/mysql/atomicupdate/bug_20028-add_allowgdprpatronexport_syspref.perl new file mode 100644 index 0000000..03354d0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_20028-add_allowgdprpatronexport_syspref.perl @@ -0,0 +1,16 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # you can use $dbh here like: + # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + $dbh->do( "INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('AllowGDPRPatronExport', '1', '', 'Allow patron GDPR export from staff interface.', 'yesno')" ); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 20028 - Export all patron related personal data in one package)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2ea76a4..f55a266 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -17,6 +17,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllFinesNeedOverride','1','0','If on, staff will be asked to override every fine, even if it is below noissuescharge.','YesNo'), ('AllowAllMessageDeletion','0','','Allow any Library to delete any message','YesNo'), ('AllowFineOverride','0','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','YesNo'), +('AllowGDPRPatronExport','1','','If set all data for a patron can be exported from the staff interface.','YesNo'), ('AllowHoldDateInFuture','0','','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','YesNo'), ('AllowHoldItemTypeSelection','0','','If enabled, patrons and staff will be able to select the itemtype when placing a hold','YesNo'), ('AllowHoldPolicyOverride','0',NULL,'Allow staff to override hold policies when placing holds','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 9b5524d..4905715 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -91,6 +91,9 @@
  • Export today's checked in barcodes
  • [% END %] [% END %] + [% IF Koha.Preference('AllowGDPRPatronExport') %] +
  • Export patron's GDPR data
  • + [% END %] 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 348e1dd..6321755 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 @@ -1,6 +1,12 @@ Patrons: General: - + - pref: AllowGDPRPatronExport + choices: + yes: "Allow export" + no: "Don't allow export" + - of patron data for GDPR compliance. + - - pref: AutoEmailOpacUser choices: yes: Send diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js index 8fdb538..33f6a47 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -73,6 +73,11 @@ $(document).ready(function(){ $(".btn-group").removeClass("open"); return false; }); + $("#exportgdprdata").click(function(){ + export_gdpr_data(); + $(".btn-group").removeClass("open"); + return false; + }); $("#printsummary").click(function(){ printx_window("page"); $(".btn-group").removeClass("open"); @@ -144,6 +149,9 @@ function confirm_reregistration() { function export_barcodes() { window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=' + borrowernumber + '&op=export_barcodes'); } +function export_gdpr_data() { + window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=' + borrowernumber + '&op=export_gdprdata'); +} var slip_re = /slip/; function printx_window(print_type) { var handler = print_type.match(slip_re) ? "printslip" : "summary-print"; -- 2.1.4