From f22a0245adf2239edcf28a537a81d24ac754783a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 26 Feb 2020 10:58:38 +0100 Subject: [PATCH] Bug 4461: Rename report date with created_on And make it a timestamp type column --- .../atomicupdate/bug-4461_add-problem-reports-table.perl | 4 ++-- installer/data/mysql/kohastructure.sql | 4 ++-- opac/opac-reportproblem.pl | 12 +++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) 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 index c8371645d1..11cee3aa67 100644 --- a/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl +++ b/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl @@ -3,7 +3,7 @@ if( CheckVersion( $DBversion ) ) { if( !TableExists( 'problem_reports' ) ){ $dbh->do(q{ CREATE TABLE problem_reports ( - reportid int(11) NOT NULL auto_increment, -- unqiue identifier assigned by Koha + 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) default NULL, -- the user who created the problem report @@ -11,7 +11,7 @@ if( CheckVersion( $DBversion ) ) { 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 + created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp 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, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ac64aea3ff..db8393ab8a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4421,7 +4421,7 @@ CREATE TABLE return_claims ( DROP TABLE IF EXISTS `problem_reports`; CREATE TABLE `problem_reports` ( - `reportid` int(11) NOT NULL auto_increment, -- unqiue identifier assigned by Koha + `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) default NULL, -- the user who created the problem report @@ -4429,7 +4429,7 @@ CREATE TABLE `problem_reports` ( `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 + `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp 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, diff --git a/opac/opac-reportproblem.pl b/opac/opac-reportproblem.pl index 7cc261d7ca..77cacfeddd 100644 --- a/opac/opac-reportproblem.pl +++ b/opac/opac-reportproblem.pl @@ -82,7 +82,17 @@ if ( $op eq 'addreport' ) { my $message = $input->param('message'); my $place = $input->param('place'); my $recipient = $input->param('recipient') || 'library'; - my $problem = Koha::ProblemReport->new({ title => $subject, content => $message, borrowernumber => $borrowernumber, branchcode => $branchcode, username => $username, problempage => $place, recipient => $recipient, reportdate => dt_from_string() })->store; + my $problem = Koha::ProblemReport->new( + { + title => $subject, + content => $message, + borrowernumber => $borrowernumber, + branchcode => $branchcode, + username => $username, + problempage => $place, + recipient => $recipient, + } + )->store; $template->param( recipient => $recipient, successfuladd => 1, -- 2.11.0