Bug 16829: Add 'interface' to the log viewer

This patch introduces the 'interface' filter to the log viewer.

To test:
- Apply the patch
- Open the log viewer
=> SUCCESS: As default, 'All' interfaces are chosen. OPAC, Intranet and SIP are presented
- Do a lot of log searches, verify that the interface column shows what is expected.
=> SUCCESS: The chosen 'interfaces' are kept when rendering results.

Sponsored-by: NEKLS

Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2016-07-01 18:27:03 -03:00 committed by Kyle M Hall
parent baeba970f7
commit 95fff37db8
2 changed files with 35 additions and 2 deletions

View file

@ -50,6 +50,16 @@
[% END %]
[% END %]
[% BLOCK translate_log_interface %]
[% SWITCH interface %]
[% CASE 'INTRANET' %]Intranet
[% CASE 'OPAC' %]OPAC
[% CASE 'SIP' %]SIP
[% CASE 'COMMANDLINE' %]Command-line
[% CASE %][% interface %]
[% END %]
[% END %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
[% IF ( do_it ) %]
@ -119,6 +129,24 @@
<label for="info">Info:</label>
<input type="text" id="info" name="info" value="[% info | html %]" />
</li>
<li>
<label for="interfaces">Interface:</label>
<select name="interfaces" id="interfaces" multiple="multiple">
[% UNLESS interfaces %]
<option value="" selected="selected">All</option>
[% ELSE %]
<option value="">All</option>
[% END %]
[% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %]
[% IF interfaces.grep(interf).size %]
<option value="[% interf %]" selected="selected">[% PROCESS translate_log_interface interface=interf %]</option>
[% ELSE %]
<option value="[% interf %]">[% PROCESS translate_log_interface interface=interf %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="from"> Display from: </label> <input type="text" size="10" id="from" name="from" value="[% datefrom | html %]" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
@ -167,6 +195,7 @@
<th>Action</th>
<th>Object</th>
<th>Info</th>
<th>Interface</th>
</tr>
</thead>
<tbody>
@ -210,6 +239,7 @@
[% loopro.info |html %]
[% END %]
</td>
<td>[% PROCESS translate_log_interface interface=loopro.interface %]</td>
</tr>
[% END %]
</tbody>

View file

@ -48,6 +48,7 @@ my $do_it = $input->param('do_it');
my @modules = $input->multi_param("modules");
my $user = $input->param("user") // '';
my @actions = $input->multi_param("actions");
my @interfaces = $input->multi_param("interfaces");
my $object = $input->param("object");
my $info = $input->param("info");
my $datefrom = $input->param("from");
@ -105,10 +106,11 @@ $template->param(
if ($do_it) {
my @data;
my ( $results, $modules, $actions );
my ( $results, $modules, $actions, $interfaces );
if ( defined $actions[0] && $actions[0] ne '' ) { $actions = \@actions; } # match All means no limit
if ( $modules[0] ne '' ) { $modules = \@modules; } # match All means no limit
$results = GetLogs( $datefrom, $dateto, $user, $modules, $actions, $object, $info );
if ( defined $interfaces[0] && $interfaces[0] ne '' ) { $interfaces = \@interfaces; } # match All means no limit
$results = GetLogs( $datefrom, $dateto, $user, $modules, $actions, $object, $info, $interfaces );
@data = @$results;
foreach my $result (@data) {
@ -170,6 +172,7 @@ if ($do_it) {
src => $src,
modules => \@modules,
actions => \@actions,
interfaces => \@interfaces
);
# Used modules