Bugzilla – Attachment 7088 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
0001-Bug-7241-corrects-log-action-for-CIRC-and-CATALOGUIN.patch (text/plain), 7.14 KB, created by
Adrien SAURAT
on 2012-01-09 10:00:56 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Adrien SAURAT
Created:
2012-01-09 10:00:56 UTC
Size:
7.14 KB
patch
obsolete
>From 4ab51155bdeefeb13ccee8aa1aa64da88d88751c Mon Sep 17 00:00:00 2001 >From: Adrien Saurat <adrien.saurat@biblibre.com> >Date: Mon, 9 Jan 2012 10:56:39 +0100 >Subject: [PATCH] Bug 7241: corrects log action for CIRC and CATALOGUING > >For CIRCULATION: ISSUE and RETURN actions now store itemnumber >instead of biblionumber. >For CATALOGUING: we now know if the code stored in the object >field is an item or a biblio (thanks to a new field called >objectinfo). >--- > C4/Biblio.pm | 6 +++--- > C4/Circulation.pm | 4 ++-- > C4/Items.pm | 8 ++++---- > C4/Log.pm | 6 +++--- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++++++ > 6 files changed, 20 insertions(+), 12 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index ac78ae3..1ff4947 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -274,7 +274,7 @@ sub AddBiblio { > # now add the record > ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save; > >- logaction( "CATALOGUING", "ADD", $biblionumber, "biblio" ) if C4::Context->preference("CataloguingLog"); >+ logaction( "CATALOGUING", "ADD", $biblionumber, "", "BIBLIO" ) if C4::Context->preference("CataloguingLog"); > return ( $biblionumber, $biblioitemnumber ); > } > >@@ -304,7 +304,7 @@ sub ModBiblio { > > if ( C4::Context->preference("CataloguingLog") ) { > my $newrecord = GetMarcBiblio($biblionumber); >- logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted ); >+ logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted, "BIBLIO" ); > } > > # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to >@@ -452,7 +452,7 @@ sub DelBiblio { > # from being generated by _koha_delete_biblioitems > $error = _koha_delete_biblio( $dbh, $biblionumber ); > >- logaction( "CATALOGUING", "DELETE", $biblionumber, "" ) if C4::Context->preference("CataloguingLog"); >+ logaction( "CATALOGUING", "DELETE", $biblionumber, "", "BIBLIO" ) if C4::Context->preference("CataloguingLog"); > > return; > } >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 9a6f4f2..22b674a 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1071,7 +1071,7 @@ sub AddIssue { > } > } > >- logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $biblio->{'biblionumber'}) >+ logaction("CIRCULATION", "ISSUE", $borrower->{'borrowernumber'}, $item->{'itemnumber'}) > if C4::Context->preference("IssueLog"); > } > return ($datedue); # not necessarily the same as when it came in! >@@ -1640,7 +1640,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/C4/Items.pm b/C4/Items.pm >index 8802a4c..c2b8626 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -270,7 +270,7 @@ sub AddItem { > > ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver", undef, undef ); > >- logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "ADD", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog"); > > return ($item->{biblionumber}, $item->{biblioitemnumber}, $itemnumber); > } >@@ -362,7 +362,7 @@ sub AddItemBatchFromMarc { > push @itemnumbers, $itemnumber; # FIXME not checking error > $item->{'itemnumber'} = $itemnumber; > >- logaction("CATALOGUING", "ADD", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "ADD", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog"); > > my $new_item_marc = _marc_from_item_hash($item, $frameworkcode, $unlinked_item_subfields); > $item_field->replace_with($new_item_marc->field($itemtag)); >@@ -521,7 +521,7 @@ sub ModItem { > # item status is possible > ModZebra( $biblionumber, "specialUpdate", "biblioserver", undef, undef ); > >- logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item)) if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "MODIFY", $itemnumber, Dumper($item), "ITEM") if C4::Context->preference("CataloguingLog"); > } > > =head2 ModItemTransfer >@@ -590,7 +590,7 @@ sub DelItem { > # This last update statement makes that the timestamp column in deleteditems is updated too. If you remove these lines, please add a line to update the timestamp separately. See Bugzilla report 7146 and Biblio.pm (DelBiblio). > > #search item field code >- logaction("CATALOGUING", "DELETE", $itemnumber, "item") if C4::Context->preference("CataloguingLog"); >+ logaction("CATALOGUING", "DELETE", $itemnumber, "", "ITEM") if C4::Context->preference("CataloguingLog"); > } > > =head2 CheckItemPreSave >diff --git a/C4/Log.pm b/C4/Log.pm >index 6b8ff17..7041482 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -66,7 +66,7 @@ number is set to 0, which is the same as the superlibrarian's number. > > #' > sub logaction { >- my ($modulename, $actionname, $objectnumber, $infos)=@_; >+ my ($modulename, $actionname, $objectnumber, $infos, $objectinfo)=@_; > > # Get ID of logged in user. if called from a batch job, > # no user session exists and C4::Context->userenv() returns >@@ -75,8 +75,8 @@ sub logaction { > my $usernumber = (ref($userenv) eq 'HASH') ? $userenv->{'number'} : 0; > > my $dbh = C4::Context->dbh; >- my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info) values (now(),?,?,?,?,?)"); >- $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos); >+ my $sth=$dbh->prepare("Insert into action_logs (timestamp,user,module,action,object,info,objectinfo) values (now(),?,?,?,?,?,?)"); >+ $sth->execute($usernumber,$modulename,$actionname,$objectnumber,$infos,$objectinfo); > $sth->finish; > } > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 5287d9f..7713677 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2392,6 +2392,7 @@ CREATE TABLE `action_logs` ( > `module` text, > `action` text, > `object` int(11) default NULL, >+ `objectinfo` text, > `info` text, > PRIMARY KEY (`action_id`), > KEY (`timestamp`,`user`) >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index a4942d8..b64d048 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4585,6 +4585,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("ALTER TABLE `action_logs` ADD `objectinfo` TEXT NULL AFTER `object`"); >+ print "Upgrade to $DBversion done (Add objectinfo column to action_logs)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >-- >1.7.4.1 >
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