Bugzilla – Attachment 12043 Details for
Bug 7241
circulation action logs record biblionumber instead of item number
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch #3
0001-Bug-7241-circulation-action-logs-record-biblionumber.patch (text/plain), 3.59 KB, created by
Adrien SAURAT
on 2012-09-07 13:26:05 UTC
(
hide
)
Description:
proposed patch #3
Filename:
MIME Type:
Creator:
Adrien SAURAT
Created:
2012-09-07 13:26:05 UTC
Size:
3.59 KB
patch
obsolete
>From 425582733eb6dffda73e42be2e8c5f49ade47628 Mon Sep 17 00:00:00 2001 >From: Adrien Saurat <adrien.saurat@biblibre.com> >Date: Fri, 7 Sep 2012 15:15:48 +0200 >Subject: [PATCH] Bug 7241: circulation action logs record biblionumber > instead of item number > >Issue log and and circulation logs are incorrectly recording biblionumber instead of item number, creating incorrect logs. >This patch corrects this, and modifies the action_logs table in two ways: >- the timestamp is not updated anymore with UPDATES (but still automatically filled when INSERTing) >- to partially correct the broken logs, the log history is filled with the first found item for each biblio >--- > C4/Circulation.pm | 4 ++-- > installer/data/mysql/kohastructure.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > 3 files changed, 11 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 8647943..0450e19 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1129,7 +1129,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! >@@ -1693,7 +1693,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 69304e1..56a42f7 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2507,7 +2507,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 c6b6063..a306749 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5684,6 +5684,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.09.00.XXX"; >+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 object=(SELECT itemnumber FROM items WHERE biblionumber= action_logs.object 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 > > =head2 TableExists($table) >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7241
:
7088
|
7471
|
9870
|
11415
|
12043
|
12434
|
14745
|
14945
|
16202
|
16627
|
16636
|
16637
|
16638
|
16661