diff --git a/C4/Log.pm b/C4/Log.pm
index c09ec2d707..d8ea1686da 100644
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -140,6 +140,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 79fb11abe0..afdcb48c77 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(),
@@ -1166,6 +1177,8 @@ sub ModReserve {
}
elsif ($rank =~ /^\d+/ and $rank > 0) {
my $hold = Koha::Holds->find($reserve_id);
+ logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
+ if C4::Context->preference('HoldsLog');
$hold->set(
{
diff --git a/Koha/Hold.pm b/Koha/Hold.pm
index f4d541a6e6..3cc8440ce7 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,9 +84,27 @@ sub resume {
$self->store();
+ logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) )
+ if C4::Context->preference('HoldsLog');
+
return $self;
}
+=head3 delete
+
+$hold->delete();
+
+=cut
+
+sub delete {
+ my ( $self ) = @_;
+
+ logaction( 'HOLDS', 'DELETE', $self->reserve_id, Dumper($self->unblessed) )
+ if C4::Context->preference('HoldsLog');
+
+ return $self->SUPER::delete($self);
+}
+
=head3 waiting_expires_on
Returns a DateTime for the date a waiting holds expires on.
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 e6e2bdc761..053facd631 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
@@ -94,7 +98,7 @@
[% ELSE %]
[% 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 %]
[% ELSE %]
@@ -112,7 +116,7 @@
[% 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 %]
[% ELSE %]
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index 9e74784360..58dac17b48 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 .
-use strict;
-use warnings;
+use Modern::Perl;
+
use CGI qw ( -utf8 );
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;