Bugzilla – Attachment 52848 Details for
Bug 14642
Add logging of hold modifications
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14642: Add logging for Holds
Bug-14642-Add-logging-for-Holds.patch (text/plain), 6.58 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-06-24 17:22:04 UTC
(
hide
)
Description:
Bug 14642: Add logging for Holds
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-06-24 17:22:04 UTC
Size:
6.58 KB
patch
obsolete
>From 694c737c42edd716f06a62c154b23c1df8c3085d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 15 Jun 2016 14:48:57 -0300 >Subject: [PATCH] Bug 14642: Add logging for Holds > >This patch adds logging for several holds actions. Specifically for: > >- CREATE >- CANCEL >- SUSPEND >- RESUME > >To test: >- Enable the HoldsLog syspref >- Add a hold on a record/item >=> SUCCESS: The log view shows the CREATE action >- Click on the <Suspend> button >=> SUCCESS: The log view shows the SUSPEND action >- Click on the <Unsuspend> button >=> SUCCESS: The log view shows the RESUME action >- Click on the red cross, to delete the hold >=> SUCCESS: The log view shows the CANCEL action > >Note: This is WIP, as there are several other actions missing from the logs. > >Sponsored-by: NEKLS >--- > C4/Log.pm | 1 + > C4/Reserves.pm | 11 +++++++++++ > Koha/Hold.pm | 8 ++++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt | 8 ++++++-- > opac/opac-reserve.pl | 4 ++-- > 5 files changed, 28 insertions(+), 4 deletions(-) > >diff --git a/C4/Log.pm b/C4/Log.pm >index de5f1d0..cec7851 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -116,6 +116,7 @@ sub GetLogStatus { > my %hash; > $hash{BorrowersLog} = C4::Context->preference("BorrowersLog"); > $hash{CataloguingLog} = C4::Context->preference("CataloguingLog"); >+ $hash{HoldsLog} = C4::Context->preference("HoldsLog"); > $hash{IssueLog} = C4::Context->preference("IssueLog"); > $hash{ReturnLog} = C4::Context->preference("ReturnLog"); > $hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog"); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index b83f8e1..6e51ca8 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -34,6 +34,7 @@ use C4::Accounts; > use C4::Members::Messaging; > use C4::Members qw(); > use C4::Letters; >+use C4::Log; > > use Koha::DateUtils; > use Koha::Calendar; >@@ -46,6 +47,7 @@ use Koha::ItemTypes; > > use List::MoreUtils qw( firstidx any ); > use Carp; >+use Data::Dumper; > > use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); > >@@ -212,6 +214,10 @@ sub AddReserve { > itemtype => $itemtype, > } > )->store(); >+ >+ logaction( 'HOLDS', 'CREATE', $hold->id, Dumper($hold->unblessed) ) >+ if C4::Context->preference('HoldsLog'); >+ > my $reserve_id = $hold->id(); > > # add a reserve fee if needed >@@ -1070,6 +1076,11 @@ sub CancelReserve { > > my $reserve = GetReserve( $reserve_id ); > if ($reserve) { >+ >+ my $hold = Koha::Holds->find( $reserve_id ); >+ logaction( 'HOLDS', 'CANCEL', $hold->reserve_id, Dumper($hold->unblessed) ) >+ if C4::Context->preference('HoldsLog'); >+ > my $query = " > UPDATE reserves > SET cancellationdate = now(), >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index f4d541a..60a121a 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -20,8 +20,10 @@ package Koha::Hold; > use Modern::Perl; > > use Carp; >+use Data::Dumper qw(Dumper); > > use C4::Context qw(preference); >+use C4::Log; > > use Koha::DateUtils qw(dt_from_string); > use Koha::Patrons; >@@ -62,6 +64,9 @@ sub suspend_hold { > > $self->store(); > >+ logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper($self->unblessed) ) >+ if C4::Context->preference('HoldsLog'); >+ > return $self; > } > >@@ -79,6 +84,9 @@ sub resume { > > $self->store(); > >+ logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) ) >+ if C4::Context->preference('HoldsLog'); >+ > return $self; > } > >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 d5f616b..290477f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -23,6 +23,7 @@ > [% CASE 'MEMBERS' %]Patrons > [% CASE 'ACQUISITIONS' %]Acquisitions > [% CASE 'SERIAL' %]Serials >+[% CASE 'HOLDS' %]Holds > [% CASE 'CIRCULATION' %]Circulation > [% CASE 'LETTER' %]Letter > [% CASE 'FINES' %]Fines >@@ -41,6 +42,9 @@ > [% CASE 'ISSUE' %]Checkout > [% CASE 'RETURN' %]Return > [% CASE 'CREATE' %]Create >+[% CASE 'CANCEL' %]Cancel >+[% CASE 'RESUME' %]Resume >+[% CASE 'SUSPEND' %]Suspend > [% CASE 'RENEW' %]Renew > [% CASE 'CHANGE PASS' %]Change password > [% CASE 'ADDCIRCMESSAGE' %]Add circulation message >@@ -84,7 +88,7 @@ > [% ELSE %] > <option value="">All</option> > [% END %] >- [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %] >+ [% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %] > [% IF modules.grep(modx).size %] > <option value="[% modx %]" selected="selected">[% PROCESS translate_log_module module=modx %]</option> > [% ELSE %] >@@ -102,7 +106,7 @@ > <option value="">All</option> > [% END %] > >- [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'CHANGE PASS' 'Run' ] %] >+ [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'CHANGE PASS' 'Run' ] %] > [% IF actions.grep(actx).size %] > <option value="[% actx %]" selected="selected">[% PROCESS translate_log_action action=actx %]</option> > [% ELSE %] >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 3f77672..d241a67 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -18,8 +18,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; >+ > use CGI qw ( -utf8 ); > use C4::Auth; # checkauth, getborrowernumber. > use C4::Koha; >-- >2.9.0
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 14642
:
52824
|
52825
|
52848
|
52931
|
53070
|
53196
|
53466
|
53734
|
54177
|
54179
|
54180
|
54181
|
54182
|
54183