From 87c3a1fa6316552650aacc4699555beafc1be24b 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 Signed-off-by: Martin Renvoize Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- ...ug-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 + .../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 4308bcdc21..6f5280ba55 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4436,6 +4436,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 8f9fd9ebd2..a15c4c6c95 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -426,6 +426,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|none','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 634c2d0749..7a813f33c0 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 @@ -377,6 +377,12 @@ OPAC: top: "top" 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: -- 2.39.5