diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 02feda4bbb..4cebf313bc 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1311,7 +1311,7 @@ sub AddIssue { } } - logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'biblionumber'}) + logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'itemnumber'}) if C4::Context->preference("IssueLog"); } return ($datedue); # not necessarily the same as when it came in! @@ -1875,7 +1875,7 @@ sub AddReturn { }); } - logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'biblionumber'}) + logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'itemnumber'}) if C4::Context->preference("ReturnLog"); # FIXME: make this comment intelligible. diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4a6de3b3a6..92ebe7d0f9 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2537,7 +2537,7 @@ CREATE TABLE `accountoffsets` ( DROP TABLE IF EXISTS `action_logs`; CREATE TABLE `action_logs` ( -- logs of actions taken in Koha (requires that the logs be turned on) `action_id` int(11) NOT NULL auto_increment, -- unique identifier for each action - `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time the action took place + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- the date and time the action took place `user` int(11) NOT NULL default 0, -- the staff member who performed the action (borrowers.borrowernumber) `module` text, -- the module this action was taken against `action` text, -- the action (includes things like DELETED, ADDED, MODIFY, etc) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2c1f1f4b20..2681e9f239 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6214,6 +6214,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.10.05.001"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("ALTER TABLE action_logs CHANGE timestamp timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;"); + $dbh->do("UPDATE action_logs SET info=(SELECT itemnumber FROM items WHERE biblionumber= action_logs.info LIMIT 1) WHERE module='CIRCULATION' AND action in ('ISSUE','RETURN');"); + print "Upgrade to $DBversion done (Bug 7241: Changing timestamp autoupdate on action_logs; setting items to circulation logs where missing)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS