From ae87707d87b9ca8136457228344bf56ba94b09a8 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 10 Feb 2020 00:50:51 +0000 Subject: [PATCH] Bug 4461: Database and syspref changes adding problem_reports table and OPACReportProblem syspref Signed-off-by: David Nind --- .../bug-4461_add-OPACReportProblem-syspref.perl | 7 +++++++ .../bug-4461_add-problem-reports-table.perl | 23 ++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 21 ++++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ 5 files changed, 58 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl create mode 100644 installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl diff --git a/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl b/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl new file mode 100644 index 0000000000..4c858b56ea --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl @@ -0,0 +1,7 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACReportProblem', 0, NULL, 'Allow patrons to submit problem reports for OPAC pages to the library or Koha Administrator', 'YesNo') }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 4461 - Add OPACReportProblem system preference)\n"; +} diff --git a/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl b/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl new file mode 100644 index 0000000000..884c301cd4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl @@ -0,0 +1,23 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ DROP TABLE IF EXISTS `problem_reports` }); + + $dbh->do(q{ CREATE TABLE problem_reports ( + reportid int(11) NOT NULL auto_increment, -- unqiue identifier assigned by Koha + title varchar(40) NOT NULL default '', -- report subject line + content varchar(255) NOT NULL default '', -- report message content + borrowernumber int(11) default NULL, -- the user who created the problem report + branchcode varchar(10) NOT NULL default '', -- borrower's branch + username varchar(75) default NULL, -- OPAC username + problempage varchar(255) default NULL, -- page the user triggered the problem report form from + recipient enum('admin','library') NOT NULL default 'library', -- the 'to-address' of the problem report + reportdate datetime default NULL, -- date and time of report submission + status varchar(1) NOT NULL default 'N', -- status of the report. N=new, V=viewed, C=closed + PRIMARY KEY (reportid), + CONSTRAINT problem_reports_ibfk1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT problem_reports_ibfk2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 4461: Add problem reports table)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8ec1791c66..ac64aea3ff 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4415,6 +4415,27 @@ CREATE TABLE return_claims ( CONSTRAINT `rc_resolved_by_ibfk` FOREIGN KEY (`resolved_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `problem_reports` +-- + +DROP TABLE IF EXISTS `problem_reports`; +CREATE TABLE `problem_reports` ( + `reportid` int(11) NOT NULL auto_increment, -- unqiue identifier assigned by Koha + `title` varchar(40) NOT NULL default '', -- report subject line + `content` varchar(255) NOT NULL default '', -- report message content + `borrowernumber` int(11) default NULL, -- the user who created the problem report + `branchcode` varchar(10) NOT NULL default '', -- borrower's branch + `username` varchar(75) default NULL, -- OPAC username + `problempage` varchar(255) default NULL, -- page the user triggered the problem report form from + `recipient` enum('admin','library') NOT NULL default 'library', -- the 'to-address' of the problem report + `reportdate` datetime default NULL, -- date and time of report submission + `status` varchar(1) NOT NULL default 'N', -- status of the report. N=new, V=viewed, C=closed + PRIMARY KEY (`reportid`), + CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index b565b7f0bf..f7da0dadc5 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -422,6 +422,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'), ('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'), ('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|null','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'), +('OPACReportProblem', 0, NULL, 'Allow patrons to submit problem reports for OPAC pages to the library or Koha Administrator', 'YesNo'), ('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'), ('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'), ('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 9c9b2b7f00..52d000d715 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -371,6 +371,12 @@ OPAC: footer: "only footer" Features: - + - pref: OPACReportProblem + choices: + yes: Allow + no: "Don't allow" + - patrons to submit problem reports for OPAC pages to the library or Koha Administrator. + - - pref: opacuserlogin choices: yes: Allow -- 2.11.0