Merge remote-tracking branch 'kc/new/bug_6460' into kcmaster
This commit is contained in:
commit
6b9fff61fb
4 changed files with 64 additions and 82 deletions
|
@ -4,6 +4,7 @@ package C4::Log;
|
|||
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
# Copyright 2011 MJ Ray and software.coop
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
|
@ -217,7 +218,7 @@ sub GetLogs {
|
|||
$query .= " AND user = ? ";
|
||||
push(@parameters,$user);
|
||||
}
|
||||
if(scalar @$modules > 1 or @$modules[0] ne "") {
|
||||
if($modules && scalar(@$modules)) {
|
||||
$query .= " AND module IN (".join(",",map {"?"} @$modules).") ";
|
||||
push(@parameters,@$modules);
|
||||
}
|
||||
|
|
|
@ -59,11 +59,11 @@
|
|||
<label for="action">Action:</label>
|
||||
<select name="action" id="action">
|
||||
<option value ="">All</option>
|
||||
<option value ="add">Add</option>
|
||||
<option value ="del">Delete</option>
|
||||
<option value ="mod">Modify</option>
|
||||
<option value="issue">Checkout</option>
|
||||
<option value="return">Return</option>
|
||||
<option value ="ADD">Add</option>
|
||||
<option value ="DELETE">Delete</option>
|
||||
<option value ="MODIFY">Modify</option>
|
||||
<option value="ISSUE">Checkout</option>
|
||||
<option value="RETURN">Return</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -133,81 +133,6 @@
|
|||
<input type="submit" value="Submit" />
|
||||
<input type="hidden" name="do_it" value="1" />
|
||||
</fieldset>
|
||||
[% IF ( do_it ) %]
|
||||
[% IF ( total ) %]
|
||||
<h4>[% total %] lines found.</h4>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Librarian</th>
|
||||
<th>Module</th>
|
||||
<th>Action</th>
|
||||
<th>Object</th>
|
||||
<th>Info</th>
|
||||
</tr>
|
||||
[% FOREACH loopro IN looprow %]
|
||||
[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
|
||||
<td>[% loopro.timestamp %]</td>
|
||||
<td>
|
||||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.user %]" title="display detail for this librarian."> [% loopro.user %] </a>
|
||||
</td>
|
||||
<td>[% loopro.module %]</td>
|
||||
<td>[% loopro.action %]</td>
|
||||
<td>
|
||||
[% IF ( module == 'MEMBERS' ) %]
|
||||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.object %]" title="Display member details."> member [% loopro.object %] </a>
|
||||
[% ELSE %]
|
||||
[% IF ( module == 'CIRCULATION' ) %]
|
||||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.object %]" title="Display member details.">
|
||||
[% IF ( loopro.object ) %]
|
||||
member [% loopro.object %]
|
||||
[% END %]
|
||||
</a>
|
||||
[% ELSE %]
|
||||
[% IF ( module == 'CATALOGUING' ) %]
|
||||
[% IF ( info == 'item' ) %]
|
||||
<a href="/cgi-bin/koha/catalogue/moredetail.pl?item=[% loopro.object %]&biblionumber=[% loopro.biblionumber %]&bi=[% loopro.biblioitemnumber %]#item[% loopro.object %]">Item [% loopro.object %]</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.object %]" title="Display detail for this biblio">biblio [% loopro.object %]</a>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% IF ( module == 'SERIAL' ) %]
|
||||
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% loopro.object %]"> [% loopro.object %] </a>
|
||||
[% ELSE %]
|
||||
[% IF ( module == 'AUTHORITIES' ) %]
|
||||
<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% loopro.object %]" title="Display detail for this authority">auth [% loopro.object %]</a>
|
||||
[% ELSE %]
|
||||
[% loopro.object %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% IF ( loopro.CIRCULATION ) %]
|
||||
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.info %]" title="Display detail for this biblio">biblio [% loopro.info |html %]</a>
|
||||
[% ELSE %]
|
||||
[% loopro.info |html %]
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
[% ELSE %]
|
||||
<div class="dialog alert">
|
||||
No log found
|
||||
[% IF ( CATALOGUING ) %]
|
||||
for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% object %]">Bibliographic Record [% object %]</a>
|
||||
[% END %]
|
||||
[% IF ( MEMBERS ) %]
|
||||
for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% object %]">[% firstname %] [% surname %] ([% cardnumber %])</a>
|
||||
[% END %]
|
||||
.
|
||||
</div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
</form>
|
||||
[% END %]
|
||||
[% IF ( do_it ) %]
|
||||
|
|
52
t/db_dependent/Log.t
Normal file
52
t/db_dependent/Log.t
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright 2011 MJ Ray and software.coop
|
||||
# This Koha test module is a stub!
|
||||
# Add more tests here!!!
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use C4::Log;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Log');
|
||||
}
|
||||
my $success;
|
||||
|
||||
eval {
|
||||
# FIXME: are we sure there is an member number 1?
|
||||
# FIXME: can we remove this log entry somehow?
|
||||
logaction("MEMBERS","MODIFY",1,"test operation");
|
||||
$success = 1;
|
||||
} or do {
|
||||
diag($@);
|
||||
$success = 0;
|
||||
};
|
||||
ok($success, "logaction seemed to work");
|
||||
|
||||
eval {
|
||||
# FIXME: US formatted date hardcoded into test for now
|
||||
$success = scalar(@{GetLogs("","","",undef,undef,"","")});
|
||||
} or do {
|
||||
diag($@);
|
||||
$success = 0;
|
||||
};
|
||||
ok($success, "GetLogs returns results for an open search");
|
||||
|
||||
eval {
|
||||
# FIXME: US formatted date hardcoded into test for now
|
||||
$success = scalar(@{GetLogs("09/01/2011","10/01/2011","",undef,undef,"","")});
|
||||
} or do {
|
||||
diag($@);
|
||||
$success = 0;
|
||||
};
|
||||
ok($success, "GetLogs accepts dates in an All-matching search");
|
||||
|
||||
eval {
|
||||
$success = scalar(@{GetLogs("","","",["MEMBERS"],["MODIFY"],1,"")});
|
||||
} or do {
|
||||
diag($@);
|
||||
$success = 0;
|
||||
};
|
||||
ok($success, "GetLogs seemed to find ".$success." like our test record in a tighter search");
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2010 BibLibre
|
||||
# Copyright 2011 MJ Ray and software.coop
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
|
@ -105,7 +106,10 @@ $template->param(
|
|||
if ($do_it) {
|
||||
|
||||
my @data;
|
||||
my $results = GetLogs($datefrom,$dateto,$user,\@modules,\@action,$object,$info);
|
||||
my ($results,$modules,$action);
|
||||
if ($action[0] ne '') { $action = \@action; } # match All means no limit
|
||||
if ($modules[0] ne '') { $modules = \@modules; } # match All means no limit
|
||||
$results = GetLogs($datefrom,$dateto,$user,$modules,$action,$object,$info);
|
||||
@data=@$results;
|
||||
my $total = scalar @data;
|
||||
foreach my $result (@data){
|
||||
|
|
Loading…
Reference in a new issue