From 9775d21164ce00978131b9e266f3e1889de680d1 Mon Sep 17 00:00:00 2001 From: MJ Ray Date: Fri, 6 Apr 2012 12:14:35 +0100 Subject: [PATCH] Bug 6890 - log reservation actions C4/Reserves.pm: log reservation actions catalogue/issuehistory.tt: link to viewlog for circulation log tools/viewlog.tt: add HOLD and UNHOLD actions, move results table nearer top tools/viewlog.tt: rewrite to use loopro.module and to link better members/readingrec.tt: link to circulation log for hold/unhold info To test: 1. place a few holds and release them somehow (cancel or issue); 2. view the reading record of an affected borrower; 3. click the link to the modification log and see the holds; 4. click the link to an affected biblio; 5. click to view its circulation history; 6. click the link to the modification log and see the holds. --- C4/Reserves.pm | 18 ++++- .../prog/en/modules/catalogue/issuehistory.tt | 2 + .../prog/en/modules/members/readingrec.tt | 3 + .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 85 ++++++++++++++++++++++ 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index bba4933..3f8b015 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -4,6 +4,7 @@ package C4::Reserves; # 2006 SAN Ouest Provence # 2007-2010 BibLibre Paul POULAIN # 2011 Catalyst IT +# Copyright 2012 software.coop and MJ Ray # # This file is part of Koha. # @@ -29,6 +30,7 @@ use C4::Members; use C4::Items; use C4::Circulation; use C4::Accounts; +use C4::Log; # for _koha_notify_reserve use C4::Members::Messaging; @@ -203,6 +205,9 @@ sub AddReserve { $found, $waitingdate, $expdate ); + # Record the fact that this book was reserved. + logaction( 'CIRCULATION', 'HOLD', $biblionumber, $borrowernumber ); + # Send e-mail to librarian if syspref is active if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){ my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber); @@ -1001,7 +1006,6 @@ sub CancelReserve { return unless ( $reserve_id ); my $dbh = C4::Context->dbh; - my $query = " UPDATE reserves SET cancellationdate = now(), @@ -1030,6 +1034,9 @@ sub CancelReserve { # now fix the priority on the others.... _FixPriority( $reserve_id ); + + # Record the fact that this book was unreserved. + logaction( 'CIRCULATION', 'UNHOLD', $reserve_id ); } =head2 ModReserve @@ -1110,6 +1117,9 @@ sub ModReserve { $sth = $dbh->prepare($query); $sth->execute( $reserve_id ); + # Record the fact that this book was unreserved. + logaction( 'CIRCULATION', 'UNHOLD', $biblio, $borrower ); + } elsif ($rank =~ /^\d+/ and $rank > 0) { my $query = " @@ -1130,6 +1140,9 @@ sub ModReserve { } _FixPriority( $reserve_id, $rank ); + # Record the fact that this book was unreserved. + logaction( 'CIRCULATION', 'HOLD', $biblio, 'Modify hold for borrower '.$borrower ); + } } @@ -1195,6 +1208,9 @@ sub ModReserveFill { $sth = $dbh->prepare($query); $sth->execute( $biblionumber, $resdate, $borrowernumber ); + # Record the fact that this book was unreserved. + logaction( 'CIRCULATION', 'UNHOLD', $biblionumber, $borrowernumber ); + # now fix the priority on the others (if the priority wasn't # already sorted!).... unless ( $priority == 0 ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index 4cd11ff..f90715b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -91,6 +91,8 @@ $(document).ready(function() { [% END %] +

See also: circulation log for [% title |html %]

+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index f36e254..6ecb7ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -104,6 +104,9 @@ [% ELSE %]
This patron has no circulation history.
[% END %] + +

See also: circulation log for [% INCLUDE 'patron-title.inc' %]

+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index a1d6e89..5be3906 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -29,6 +29,89 @@
[% IF ( CAN_user_reports ) %]

Browse system logs

+ [% IF ( do_it ) %] + [% IF ( total ) %] +

[% total %] lines found.

+ + + + + + + + + + [% FOREACH loopro IN looprow %] + [% UNLESS ( loop.odd ) %][% ELSE %][% END %] + + + + + + + + + [% END %] +
DateLibrarianModuleActionObjectInfo
[% loopro.timestamp %] + [% IF ( module == 'CIRCULATION' ) %] + [% loopro.user %] + [% ELSE %] + [% loopro.user %] + [% END %] + [% loopro.module %][% loopro.action %] + [% IF ( loopro.module == 'MEMBERS' ) %] + Patron [% loopro.object %] + [% ELSE %] + [% IF ( loopro.module == 'CIRCULATION' ) %] + + [% IF ( loopro.object ) %] + biblio [% loopro.object %] + [% END %] + + [% ELSE %] + [% IF ( loopro.module == 'CATALOGUING' ) %] + [% IF ( info == 'item' ) %] + Item [% loopro.object %] + [% ELSE %] + biblio [% loopro.object %] + [% END %] + [% ELSE %] + [% IF ( loopro.module == 'SERIAL' ) %] + [% loopro.object %] + [% ELSE %] + [% IF ( loopro.module == 'AUTHORITIES' ) %] + auth [% loopro.object %] + [% ELSE %] + [% loopro.object %] + [% END %] + [% END %] + [% END %] + [% END %] + [% END %] + + [% IF ( loopro.module == 'CIRCULATION' && ( loopro.action == 'HOLD' || loopro.action == 'UNHOLD' ) ) %] + Patron [% loopro.info |remove('\S+ ') |html %] + [% ELSE %] + [% IF ( loopro.module == 'CIRCULATION' && loopro.info > 0 ) %] + Item [% loopro.info |html %] + [% ELSE %] + [% loopro.info |html %] + [% END %] + [% END %] +
+ [% ELSE %] +
+ No log found + [% IF ( CATALOGUING ) %] + for Bibliographic Record [% object %] + [% END %] + [% IF ( MEMBERS ) %] + for [% INCLUDE 'patron-title.inc' %] + [% END %] + . +
+ [% END %] + [% END %]
[% IF ( do_it ) %] @@ -64,6 +147,8 @@ + +
  • -- 1.8.4.rc3