summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a6bc706)
This patch adds logging for several holds actions. Specifically for:
- CREATE
- CANCEL
- DELETE
- RESUME
- SUSPEND
- MODIFY
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: The DELETE action is logged when DelMember is called, with bug 16819 patches applied.
Sponsored-by: NEKLS
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
I also wonder about this going in defaulted on, but since the other logs are as well it seems ok to me.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
my %hash;
$hash{BorrowersLog} = C4::Context->preference("BorrowersLog");
$hash{CataloguingLog} = C4::Context->preference("CataloguingLog");
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");
$hash{IssueLog} = C4::Context->preference("IssueLog");
$hash{ReturnLog} = C4::Context->preference("ReturnLog");
$hash{SubscriptionLog} = C4::Context->preference("SubscriptionLog");
use C4::Members::Messaging;
use C4::Members qw();
use C4::Letters;
use C4::Members::Messaging;
use C4::Members qw();
use C4::Letters;
use Koha::DateUtils;
use Koha::Calendar;
use Koha::DateUtils;
use Koha::Calendar;
use List::MoreUtils qw( firstidx any );
use Carp;
use List::MoreUtils qw( firstidx any );
use Carp;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
itemtype => $itemtype,
}
)->store();
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
my $reserve_id = $hold->id();
# add a reserve fee if needed
my $reserve = GetReserve( $reserve_id );
if ($reserve) {
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(),
my $query = "
UPDATE reserves
SET cancellationdate = now(),
}
elsif ($rank =~ /^\d+/ and $rank > 0) {
my $hold = Koha::Holds->find($reserve_id);
}
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');
use Modern::Perl;
use Carp;
use Modern::Perl;
use Carp;
+use Data::Dumper qw(Dumper);
use C4::Context qw(preference);
use C4::Context qw(preference);
use Koha::DateUtils qw(dt_from_string);
use Koha::Patrons;
use Koha::DateUtils qw(dt_from_string);
use Koha::Patrons;
+ logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper($self->unblessed) )
+ if C4::Context->preference('HoldsLog');
+
+ logaction( 'HOLDS', 'RESUME', $self->reserve_id, Dumper($self->unblessed) )
+ if C4::Context->preference('HoldsLog');
+
+=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.
=head3 waiting_expires_on
Returns a DateTime for the date a waiting holds expires on.
[% CASE 'MEMBERS' %]Patrons
[% CASE 'ACQUISITIONS' %]Acquisitions
[% CASE 'SERIAL' %]Serials
[% CASE 'MEMBERS' %]Patrons
[% CASE 'ACQUISITIONS' %]Acquisitions
[% CASE 'SERIAL' %]Serials
[% CASE 'CIRCULATION' %]Circulation
[% CASE 'LETTER' %]Letter
[% CASE 'FINES' %]Fines
[% CASE 'CIRCULATION' %]Circulation
[% CASE 'LETTER' %]Letter
[% CASE 'FINES' %]Fines
[% CASE 'ISSUE' %]Checkout
[% CASE 'RETURN' %]Return
[% CASE 'CREATE' %]Create
[% 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
[% CASE 'RENEW' %]Renew
[% CASE 'CHANGE PASS' %]Change password
[% CASE 'ADDCIRCMESSAGE' %]Add circulation message
[% ELSE %]
<option value="">All</option>
[% END %]
[% 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 %]
[% IF modules.grep(modx).size %]
<option value="[% modx %]" selected="selected">[% PROCESS translate_log_module module=modx %]</option>
[% ELSE %]
<option value="">All</option>
[% END %]
<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 %]
[% IF actions.grep(actx).size %]
<option value="[% actx %]" selected="selected">[% PROCESS translate_log_action action=actx %]</option>
[% ELSE %]
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
# 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 CGI qw ( -utf8 );
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;
use CGI qw ( -utf8 );
use C4::Auth; # checkauth, getborrowernumber.
use C4::Koha;