From ce940939d445aad121a6b48f72c6c93bd79c0157 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 6 Apr 2020 11:25:02 +0100 Subject: [PATCH] Bug 4461: DBRev 19.12.00.066 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- ...ug-4461_add-OPACReportProblem-syspref.perl | 7 --- .../bug-4461_add-problem-report-notice.perl | 7 --- .../bug-4461_add-problem-reports-table.perl | 24 ---------- ...4461_manage_problem_reports_userflags.perl | 9 ---- installer/data/mysql/updatedatabase.pl | 46 +++++++++++++++++++ 6 files changed, 47 insertions(+), 48 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug-4461_add-problem-report-notice.perl delete mode 100644 installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl delete mode 100644 installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl diff --git a/Koha.pm b/Koha.pm index 49df31750c..f33b2170f6 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "19.12.00.065"; +$VERSION = "19.12.00.066"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl b/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl deleted file mode 100644 index 4c858b56ea..0000000000 --- a/installer/data/mysql/atomicupdate/bug-4461_add-OPACReportProblem-syspref.perl +++ /dev/null @@ -1,7 +0,0 @@ -$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-report-notice.perl b/installer/data/mysql/atomicupdate/bug-4461_add-problem-report-notice.perl deleted file mode 100644 index bd642a581a..0000000000 --- a/installer/data/mysql/atomicupdate/bug-4461_add-problem-report-notice.perl +++ /dev/null @@ -1,7 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do(q{INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('members', 'PROBLEM_REPORT','OPAC Problem Report','OPAC Problem Report','Username: <>\n\nProblem page: <>\n\nTitle: <>\n\nMessage: <>','email') }); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 4461 - Adding PROBLEM_REPORT notice)\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 deleted file mode 100644 index fab48d778d..0000000000 --- a/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl +++ /dev/null @@ -1,24 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - if( !TableExists( 'problem_reports' ) ){ - $dbh->do(q{ CREATE TABLE problem_reports ( - reportid int(11) NOT NULL auto_increment, -- unique 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) NOT NULL default 0, -- the user who created the problem report - branchcode varchar(10) NOT NULL default '', -- borrower's branch - username varchar(75) default NULL, -- OPAC username - problempage TEXT 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 - created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of report submission - status varchar(6) NOT NULL default 'New', -- status of the report. New, Viewed, 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/atomicupdate/bug-4461_manage_problem_reports_userflags.perl b/installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl deleted file mode 100644 index 0d12b9888d..0000000000 --- a/installer/data/mysql/atomicupdate/bug-4461_manage_problem_reports_userflags.perl +++ /dev/null @@ -1,9 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do(q{INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (26, 'problem_reports', 'Manage problem reports', 0) }); - $dbh->do(q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (26, 'manage_problem_reports', 'Manage OPAC problem reports') }); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 4461 - Add user permissions for managing OPAC problem reports)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4cf630f3bb..b4e115865a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21464,6 +21464,52 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 23173, "Add ILLCheckAvailability syspref"); } +$DBversion = '19.12.00.066'; +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') } + ); + $dbh->do( +q{INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('members', 'PROBLEM_REPORT','OPAC Problem Report','OPAC Problem Report','Username: <>\n\nProblem page: <>\n\nTitle: <>\n\nMessage: <>','email') } + ); + if ( !TableExists('problem_reports') ) { + $dbh->do( + q{ CREATE TABLE problem_reports ( + reportid int(11) NOT NULL auto_increment, -- unique 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) NOT NULL default 0, -- the user who created the problem report + branchcode varchar(10) NOT NULL default '', -- borrower's branch + username varchar(75) default NULL, -- OPAC username + problempage TEXT 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 + created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of report submission + status varchar(6) NOT NULL default 'New', -- status of the report. New, Viewed, 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 } + ); + } + $dbh->do( +q{INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (26, 'problem_reports', 'Manage problem reports', 0) } + ); + $dbh->do( +q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (26, 'manage_problem_reports', 'Manage OPAC problem reports') } + ); + + NewVersion( + $DBversion, + 4461, + [ + "Add OPACReportProblem system preference", + "Adding PROBLEM_REPORT notice", + "Add problem reports table", + "Add user permissions for managing OPAC problem reports" + ] + ); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5