[Koha-patches] [PATCH] Modified log reporting to allow multiple modules to be selected.
David Goldfein
d.goldfein at lacrosse.lib.wi.us
Fri Apr 24 20:21:24 CEST 2009
Reworked ViewLog.pl and the template. Eliminated html errors, cleaned up
the template, change mime type to text/csv and other minor changes.
---
C4/Log.pm | 40 ++-
.../prog/en/modules/tools/viewlog.tmpl | 423 ++++++++++----------
tools/viewlog.pl | 84 +++--
3 files changed, 297 insertions(+), 250 deletions(-)
diff --git a/C4/Log.pm b/C4/Log.pm
index 8fb4488..9f4430c 100644
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -182,7 +182,7 @@ sub displaylog {
=item GetLogs
-$logs = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
+$logs = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info);
Return:
C<$logs> is a ref to a hash which containts all columns from action_logs
@@ -193,7 +193,7 @@ sub GetLogs {
my $datefrom = shift;
my $dateto = shift;
my $user = shift;
- my $module = shift;
+ my $modules = shift;
my $action = shift;
my $object = shift;
my $info = shift;
@@ -207,16 +207,38 @@ sub GetLogs {
FROM action_logs
WHERE 1
";
- $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom;
+
+ my @parameters;
+ $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; #fix me - mysql specific
$query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto;
- $query .= " AND user LIKE \"%".$user."%\" " if $user;
- $query .= " AND module LIKE \"%".$module."%\" " if $module;
- $query .= " AND action LIKE \"%".$action."%\" " if $action;
- $query .= " AND object LIKE \"%".$object."%\" " if $object;
- $query .= " AND info LIKE \"%".$info."%\" " if $info;
+ if($user) {
+ $query .= " AND user LIKE ? ";
+ push(@parameters,"%".$user."%");
+ }
+ if(scalar @$modules > 1 or @$modules[0] ne "") {
+ $query .= " AND (1 = 2"; #always false but used to build the query
+ foreach my $module (@$modules) {
+ next if $module eq "";
+ $query .= " or module = ?";
+ push(@parameters,$module);
+ }
+ $query .= ")";
+ }
+ if($action) {
+ $query .= " AND action LIKE ? ";
+ push(@parameters,"%".$action."%");
+ }
+ if($object) {
+ $query .= " AND object LIKE ? ";
+ push(@parameters,"%".$object."%");
+ }
+ if($info) {
+ $query .= " AND info LIKE ? ";
+ push(@parameters,"%".$info."%");
+ }
my $sth = $dbh->prepare($query);
- $sth->execute;
+ $sth->execute(@parameters);
my @logs;
while( my $row = $sth->fetchrow_hashref ) {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
index 84f0f49..d461b08 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
@@ -1,5 +1,12 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha › Tools › <!-- TMPL_IF NAME="do_it" -->Logs › Results<!-- TMPL_ELSE -->Logs<!-- /TMPL_IF --></title>
+<title>
+ Koha › Tools ›
+ <!-- TMPL_IF NAME="do_it" -->
+ Logs › Results
+ <!-- TMPL_ELSE -->
+ Logs
+ <!-- /TMPL_IF -->
+</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
</head>
@@ -7,210 +14,218 @@
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <!-- TMPL_IF NAME="do_it" --><a href="/cgi-bin/koha/tools/viewlog.pl">Logs</a> › Results<!-- TMPL_ELSE -->Logs<!-- /TMPL_IF --></div>
+<div id="breadcrumbs">
+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
+ <!-- TMPL_IF NAME="do_it" -->
+ <a href="/cgi-bin/koha/tools/viewlog.pl">Logs</a> › Results
+ <!-- TMPL_ELSE -->
+ Logs
+ <!-- /TMPL_IF -->
+</div>
<div id="doc3" class="yui-t2">
-
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
-
-<h1>Browse system logs</h1>
-
-<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
-
- <!-- TMPL_IF NAME="do_it" --><input type="hidden" name="do_it" value="<!--TMPL_VAR NAME="do_it" -->" /><!-- /TMPL_IF -->
-<!-- These are selects below.
- <input type="hidden" name="module" value="<!--TMPL_VAR NAME="module" -->" />
- <input type="hidden" name="action" value="<!--TMPL_VAR NAME="action" -->" />
- <input type="hidden" name="object" value="<!--TMPL_VAR NAME="object" -->" />
---> <input type="hidden" name="src" value="<!--TMPL_VAR NAME="src" -->" />
-<fieldset class="rows">
-<ol>
- <li>
- <label for="user">Librarian:</label> <input type="text" name="user" id="user" value="<!-- TMPL_VAR NAME="user"-->" />
- </li>
- <li>
- <label for="module">Module:</label>
- <select name="module" id="module">
- <option value="" selected="selected">All</option>
- <option value ="CATALOGUING">Catalog</option>
- <option value ="MEMBERS">Members</option>
- <option value ="ACQUISITION">Acquisitions</option>
- <option value ="SERIAL">Serial</option>
- <option value="CIRCULATION">Circulation</option>
- <option value="LETTER">Letter</option>
- <option value="FINES">Fines</option>
- <option value="SYSTEMPREFERENCE">System Prefs</option>
- </select>
- </li>
- <li>
- <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">Issue</option>
- <option value="return">Return</option>
- </select>
- </li>
- <li>
- <label for="object">Object</label>
- <input type="text" id="object" name="object" value="<!-- TMPL_VAR NAME="object"-->" />
- </li>
- <li>
- <label for="info">Info:</label>
- <input type="text" name="info" value="<!-- TMPL_VAR NAME="info"-->" />
- </li>
- <li>
- <label for="from"> Display from</label> <input type="text" size="10" id="from" name="from" value="<!-- TMPL_VAR NAME="datefrom"-->" />
- <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" alt="Show Calendar" id="openCalendarFrom" style="cursor: pointer;" />
- <label for="to">to</label> <input size="10" id="to" name="to" type="text" value="<!-- TMPL_VAR NAME="dateto"-->" />
- <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="openCalendarTo" alt="Show Calendar" style="cursor: pointer;" border="0" />
- <script type="text/javascript">
-//<![CDATA[
- // function submit_check (from_id,to_id) {
- // var dateFrom = Date_from_syspref(document.getElementById(from_id).value);
- // var dateTo = Date_from_syspref(document.getElementById( to_id).value);
- // var today = new Date();
- // if (dateFrom < dateTo) {
- // alert("The starting date cannot be after the ending date.");
- // document.getElementById(to_id).select();
- // return false;
- // }
- // if (dateFrom > today) {
- // alert("The starting date cannot be in the future.");
- // document.getElementById(from_id).select();
- // return false;
- // }
- // }
-
- // return true if the date is blocked.
- function disable_from(date) {var limit = get_Calendar_limit(date,'to' ); return (limit && limit < date);}
- function disable_to (date) {var limit = get_Calendar_limit(date,'from'); return (limit && limit > date);}
-
- Calendar.setup({
- inputField : "from",
- ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
- button : "openCalendarFrom",
- disableFunc : disable_from,
- dateStatusFunc : disable_from
- });
- Calendar.setup({
- inputField : "to",
- ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
- button : "openCalendarTo",
- disableFunc : disable_to,
- dateStatusFunc : disable_to
- });
-//]]>
- </script>
- </li>
- </ol>
- </fieldset>
- <fieldset class="rows">
- <legend>Output</legend>
- <ol>
- <li><label for="screen" >To screen in the browser:</label> <input id="screen" type="radio" checked="checked" name="output" value="screen" />
- </li>
- <li><label for="file">To a file:</label>
- <input id="file" type="radio" name="output" value="file" />
- <label class="inline" for="basename">Named:</label>
- <input type="text" name="basename" id="basename" value="Export" />
- <label for="MIME" class="inline">Into an application:</label>
- <!-- TMPL_VAR NAME="CGIextChoice" -->
- <!-- TMPL_VAR NAME="CGIsepChoice" -->
- <input type="hidden" name="report_name" value="<!--TMPL_VAR NAME="report_name" -->" />
- </li>
- </ol>
-</fieldset>
-<fieldset class="action"><input type="submit" value="Submit" />
- <input type="hidden" name="do_it" value="1" /></fieldset>
-
- <!-- TMPL_IF NAME="do_it" -->
- <!-- TMPL_IF NAME="total" -->
- <h4><!-- TMPL_VAR NAME="total" --> lines found.</h4>
- <!-- TMPL_ELSE -->
- <div class="dialog alert">No log found
- <!-- TMPL_IF EXPR="module eq 'CATALOGUING'" -->for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->">Bibliographic Record <!-- TMPL_VAR NAME="object" --></a><!-- /TMPL_IF --><!-- TMPL_IF EXPR="module eq 'MEMBERS'" -->for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->"><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</a><!-- /TMPL_IF -->
- .</div>
- <!-- /TMPL_IF -->
- <!-- /TMPL_IF -->
-
- <!-- TMPL_IF NAME="do_it" -->
- <!-- TMPL_IF NAME="total" -->
- <table>
- <tr>
- <th>Date</th>
- <th>Librarian</th>
- <th>Module</th>
- <th>Action</th>
- <th>Object</th>
- <th>Info</th>
- </tr>
-
- <!-- TMPL_LOOP NAME="looprow" -->
- <tr>
- <td><!-- TMPL_VAR NAME="timestamp" --></td>
- <td>
- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="user" -->" title="display detail for this librarian.">
- <!-- TMPL_VAR NAME="user" -->
- </a>
- </td>
- <td><!-- TMPL_VAR NAME="module" --></td>
- <td><!-- TMPL_VAR NAME="action" --></td>
- <td>
- <!-- TMPL_IF NAME="MEMBERS"-->
- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details.">
- member <!-- TMPL_VAR NAME="object" -->
- </a>
- <!-- TMPL_ELSE -->
- <!-- TMPL_IF NAME="CIRCULATION" -->
- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details.">
- <!-- TMPL_IF NAME="object"-->member <!-- TMPL_VAR NAME="object" --><!-- /TMPL_IF -->
- </a>
- <!-- TMPL_ELSE -->
- <!-- TMPL_IF NAME="CATALOGUING" -->
- <!-- TMPL_IF EXPR="info eq 'item'" -->
- <a href="/cgi-bin/koha/catalogue/moredetail.pl?item=<!-- TMPL_VAR NAME="object" -->&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->#item<!-- TMPL_VAR NAME="object" -->">Item <!-- TMPL_VAR NAME="object" --></a>
- <!-- TMPL_ELSE -->
- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="object" --></a>
- <!-- /TMPL_IF -->
- <!-- TMPL_ELSE-->
- <!-- TMPL_IF NAME="SERIAL"-->
- <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="object" -->">
- <!-- TMPL_VAR NAME="object" -->
- </a>
- <!-- TMPL_ELSE -->
- <!-- TMPL_VAR NAME="object" -->
- <!-- /TMPL_IF -->
- <!-- /TMPL_IF -->
- <!-- /TMPL_IF -->
- <!-- /TMPL_IF -->
- </td>
- <td>
- <!-- TMPL_IF NAME="CIRCULATION" -->
- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="info" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="info" escape="html" --></a>
- <!-- TMPL_ELSE -->
- <!-- TMPL_VAR NAME="info" escape="html"-->
- <!-- /TMPL_IF -->
- </td>
- </tr>
- <!-- /TMPL_LOOP -->
- </table>
-<!-- /TMPL_IF -->
-<!-- /TMPL_IF -->
- </form>
-</div>
-</div>
-<div class="yui-b noprint">
-<!-- TMPL_IF NAME="menu" -->
- <!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
-<!-- TMPL_ELSE -->
-
- <!-- TMPL_IF EXPR="module eq 'CATALOGUING'" --><!-- TMPL_INCLUDE NAME="biblio-view-menu.inc" --><!-- TMPL_ELSE --><!-- TMPL_INCLUDE NAME="tools-menu.inc" --><!-- /TMPL_IF -->
-<!-- /TMPL_IF -->
-</div>
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+ <h1>Browse system logs</h1>
+ <form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
+ <!-- TMPL_IF NAME="do_it" -->
+ <input type="hidden" name="do_it" value="<!--TMPL_VAR NAME="do_it" -->" />
+ <!-- /TMPL_IF -->
+ <input type="hidden" name="src" value="<!--TMPL_VAR NAME="src" -->" />
+ <fieldset class="rows">
+ <ol>
+ <li>
+ <label for="user">Librarian:</label>
+ <input type="text" name="user" id="user" value="<!-- TMPL_VAR NAME="user"-->" />
+ </li>
+ <li>
+ <label for="module">Module:</label>
+ <select name="modules" id="modules" multiple="multiple">
+ <option value="" selected="selected">All</option>
+ <option value ="CATALOGUING">Catalog</option>
+ <option value ="MEMBERS">Members</option>
+ <option value ="ACQUISITION">Acquisitions</option>
+ <option value ="SERIAL">Serial</option>
+ <option value="CIRCULATION">Circulation</option>
+ <option value="LETTER">Letter</option>
+ <option value="FINES">Fines</option>
+ <option value="SYSTEMPREFERENCE">System Prefs</option>
+ </select>
+ </li>
+ <li>
+ <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">Issue</option>
+ <option value="return">Return</option>
+ </select>
+ </li>
+ <li>
+ <label for="object">Object</label>
+ <input type="text" id="object" name="object" value="<!-- TMPL_VAR NAME="object"-->" />
+ </li>
+ <li>
+ <label for="info">Info:</label>
+ <input type="text" name="info" value="<!-- TMPL_VAR NAME="info"-->" />
+ </li>
+ <li>
+ <label for="from"> Display from</label> <input type="text" size="10" id="from" name="from" value="<!-- TMPL_VAR NAME="datefrom"-->" />
+ <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" alt="Show Calendar" id="openCalendarFrom" style="cursor: pointer;" />
+ <label for="to">to</label> <input size="10" id="to" name="to" type="text" value="<!-- TMPL_VAR NAME="dateto"-->" />
+ <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="openCalendarTo" alt="Show Calendar" style="cursor: pointer;" border="0" />
+ <script type="text/javascript">
+ //<![CDATA[
+ // function submit_check (from_id,to_id) {
+ // var dateFrom = Date_from_syspref(document.getElementById(from_id).value);
+ // var dateTo = Date_from_syspref(document.getElementById( to_id).value);
+ // var today = new Date();
+ // if (dateFrom < dateTo) {
+ // alert("The starting date cannot be after the ending date.");
+ // document.getElementById(to_id).select();
+ // return false;
+ // }
+ // if (dateFrom > today) {
+ // alert("The starting date cannot be in the future.");
+ // document.getElementById(from_id).select();
+ // return false;
+ // }
+ // }
+
+ // return true if the date is blocked.
+ function disable_from(date) {var limit = get_Calendar_limit(date,'to' ); return (limit && limit < date);}
+ function disable_to (date) {var limit = get_Calendar_limit(date,'from'); return (limit && limit > date);}
+
+ Calendar.setup({
+ inputField : "from",
+ ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+ button : "openCalendarFrom",
+ disableFunc : disable_from,
+ dateStatusFunc : disable_from
+ });
+ Calendar.setup({
+ inputField : "to",
+ ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+ button : "openCalendarTo",
+ disableFunc : disable_to,
+ dateStatusFunc : disable_to
+ });
+ //]]>
+ </script>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="rows">
+ <legend>Output</legend>
+ <ol>
+ <li>
+ <label for="screen" >To screen in the browser:</label> <input id="screen" type="radio" checked="checked" name="output" value="screen" />
+ </li>
+ <li>
+ <label for="file">To a file:</label>
+ <input id="file" type="radio" name="output" value="file" />
+ <label class="inline" for="basename">Named:</label>
+ <input type="text" name="basename" id="basename" value="Export" />
+ <!--
+ <label for="MIME" class="inline">Into an application:</label>
+ <!-- TMPL_VAR NAME="CGIextChoice" -->
+ <!-- TMPL_VAR NAME="CGIsepChoice" -->
+ -->
+ <input type="hidden" name="report_name" value="<!--TMPL_VAR NAME="report_name" -->" />
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Submit" />
+ <input type="hidden" name="do_it" value="1" />
+ </fieldset>
+ <!-- TMPL_IF NAME="do_it" -->
+ <!-- TMPL_IF NAME="total" -->
+ <h4><!-- TMPL_VAR NAME="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>
+ <!-- TMPL_LOOP NAME="looprow" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="timestamp" --></td>
+ <td>
+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="user" -->" title="display detail for this librarian."> <!-- TMPL_VAR NAME="user" --> </a>
+ </td>
+ <td><!-- TMPL_VAR NAME="module" --></td>
+ <td><!-- TMPL_VAR NAME="action" --></td>
+ <td>
+ <!-- TMPL_IF EXPR="module eq 'MEMBERS'"-->
+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details."> member <!-- TMPL_VAR NAME="object" --> </a>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF EXPR="module eq 'CIRCULATION'" -->
+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details.">
+ <!-- TMPL_IF NAME="object" -->
+ member <!-- TMPL_VAR NAME="object" -->
+ <!-- /TMPL_IF -->
+ </a>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF EXPR="module eq 'CATALOGUING'" -->
+ <!-- TMPL_IF EXPR="info eq 'item'" -->
+ <a href="/cgi-bin/koha/catalogue/moredetail.pl?item=<!-- TMPL_VAR NAME="object" -->&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->#item<!-- TMPL_VAR NAME="object" -->">Item <!-- TMPL_VAR NAME="object" --></a>
+ <!-- TMPL_ELSE -->
+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="object" --></a>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_ELSE-->
+ <!-- TMPL_IF EXPR="module eq 'SERIAL'" -->
+ <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="object" -->"> <!-- TMPL_VAR NAME="object" --> </a>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR NAME="object" -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ </td>
+ <td>
+ <!-- TMPL_IF NAME="CIRCULATION" -->
+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="info" -->" title="Display detail for this biblio">biblio <!-- TMPL_VAR NAME="info" escape="html" --></a>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_VAR NAME="info" escape="html"-->
+ <!-- /TMPL_IF -->
+ </td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ <div class="dialog alert">
+ No log found
+ <!-- TMPL_IF NAME="CATALOGUING" -->
+ for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->">Bibliographic Record <!-- TMPL_VAR NAME="object" --></a>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="MEMBERS" -->
+ for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->"><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</a>
+ <!-- /TMPL_IF -->
+ .
+ </div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ </form>
+ </div>
+ </div>
+ <div class="yui-b noprint">
+ <!-- TMPL_IF NAME="menu" -->
+ <!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF NAME="CATALOGUING" -->
+ <!-- TMPL_INCLUDE NAME="biblio-view-menu.inc" -->
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_INCLUDE NAME="tools-menu.inc" -->
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+ </div>
+ </div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/tools/viewlog.pl b/tools/viewlog.pl
index 3c65b6a..e3bdc73 100755
--- a/tools/viewlog.pl
+++ b/tools/viewlog.pl
@@ -43,7 +43,7 @@ my $input = new CGI;
$debug or $debug = $cgi_debug;
my $do_it = $input->param('do_it');
-my $module = $input->param("module");
+my @modules = $input->param("modules");
my $user = $input->param("user");
my $action = $input->param("action");
my $object = $input->param("object");
@@ -52,7 +52,7 @@ my $datefrom = $input->param("from");
my $dateto = $input->param("to");
my $basename = $input->param("basename");
my $mime = $input->param("MIME");
-my $del = $input->param("sep");
+#my $del = $input->param("sep");
my $output = $input->param("output") || "screen";
my $src = $input->param("src"); # this param allows us to be told where we were called from -fbcit
@@ -99,10 +99,32 @@ $template->param(
dateformat => C4::Dates->new()->format(),
debug => $debug,
);
-
+#
+#### This code was never really used - maybe some day some will fix it ###
+#my @mime = ( C4::Context->preference("MIME") );
+#my $CGIextChoice = CGI::scrolling_list(
+# -name => 'MIME',
+# -id => 'MIME',
+# -values => \@mime,
+# -size => 1,
+# -multiple => 0
+#);
+#my @dels = ( C4::Context->preference("delimiter") );
+#my $CGIsepChoice = CGI::scrolling_list(
+# -name => 'sep',
+# -id => 'sep',
+# -values => \@dels,
+# -size => 1,
+# -multiple => 0
+#);
+#$template->param(
+# CGIextChoice => $CGIextChoice,
+# CGIsepChoice => $CGIsepChoice,
+#);
+#
if ($do_it) {
- my $results = GetLogs($datefrom,$dateto,$user,$module,$action,$object,$info);
+ my $results = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info);
my $total = scalar @$results;
foreach my $result (@$results){
if ($result->{'info'} eq 'item'){
@@ -118,59 +140,47 @@ if ($do_it) {
$template->param (
logview => 1,
total => $total,
- $module => 1,
looprow => $results,
do_it => 1,
datefrom => $datefrom,
dateto => $dateto,
user => $user,
- module => $module,
object => $object,
action => $action,
info => $info,
src => $src,
);
+ #module => 'fix this', #this seems unused in actual code
+ foreach my $module (@modules) {
+ $template->param($module => 1);
+ }
+
output_html_with_http_headers $input, $cookie, $template->output;
} else {
# Printing to a csv file
print $input->header(
- -type => 'application/vnd.sun.xml.calc',
+ -type => 'text/csv',
-attachment => "$basename.csv",
-filename => "$basename.csv"
);
my $sep = C4::Context->preference("delimiter");
foreach my $line (@$results) {
- ($module eq "catalogue") or next;
- foreach (qw(timestamp firstname surname action info title author)) {
- print $line->{$_} . $sep;
- }
- }
+ #next unless $modules[0] eq "catalogue";
+ foreach (qw(timestamp firstname surname action info title author)) {
+ print $line->{$_} . $sep;
+ }
+ }
}
exit;
} else {
- my @values;
- my %labels;
- my %select;
- my @mime = ( C4::Context->preference("MIME") );
- my $CGIextChoice = CGI::scrolling_list(
- -name => 'MIME',
- -id => 'MIME',
- -values => \@mime,
- -size => 1,
- -multiple => 0
- );
- my @dels = ( C4::Context->preference("delimiter") );
- my $CGIsepChoice = CGI::scrolling_list(
- -name => 'sep',
- -id => 'sep',
- -values => \@dels,
- -size => 1,
- -multiple => 0
- );
- $template->param(
- total => 0,
- CGIextChoice => $CGIextChoice,
- CGIsepChoice => $CGIsepChoice,
- );
- output_html_with_http_headers $input, $cookie, $template->output;
+ #my @values;
+ #my %labels;
+ #my %select;
+ #initialize some paramaters that might not be used in the template - it seems to evaluate EXPR even if a false TMPL_IF
+ $template->param(
+ total => 0,
+ module => "",
+ info => ""
+ );
+ output_html_with_http_headers $input, $cookie, $template->output;
}
--
1.5.4.3
More information about the Koha-patches
mailing list