View | Details | Raw Unified | Return to bug 6014
Collapse All | Expand All

(-)a/C4/Log.pm (-14 / +10 lines)
Lines 214-244 sub GetLogs { Link Here
214
    $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom;   #fix me - mysql specific
214
    $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom;   #fix me - mysql specific
215
    $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto;
215
    $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto;
216
    if($user) {
216
    if($user) {
217
    	$query .= " AND user LIKE ? ";
217
    	$query .= " AND user = ? ";
218
    	push(@parameters,"%".$user."%");
218
    	push(@parameters,$user);
219
    }
219
    }
220
    if(scalar @$modules > 1 or @$modules[0] ne "") {
220
    if(scalar @$modules > 1 or @$modules[0] ne "") {
221
	    $query .= " AND (1 = 2";  #always false but used to build the query
221
    	$query .= " AND module IN (".join(",",map {"?"} @$modules).") ";
222
	    foreach my $module (@$modules) {
222
	push(@parameters,@$modules);
223
	    	next if $module eq "";
224
	   	$query .= " or module = ?";
225
		push(@parameters,$module);
226
	    }
227
	    $query .= ")";
228
    }
223
    }
229
    if($action) {
224
    if($action && scalar(@$action)) {
230
    	$query .= " AND action LIKE ? ";
225
    	$query .= " AND action IN (".join(",",map {"?"} @$action).") ";
231
	push(@parameters,"%".$action."%");
226
	push(@parameters,@$action);
232
    }
227
    }
233
    if($object) {
228
    if($object) {
234
    	$query .= " AND object LIKE ? ";
229
    	$query .= " AND object = ? ";
235
	push(@parameters,"%".$object."%");
230
	push(@parameters,$object);
236
    }
231
    }
237
    if($info) {
232
    if($info) {
238
    	$query .= " AND info LIKE ? ";
233
    	$query .= " AND info LIKE ? ";
239
	push(@parameters,"%".$info."%");
234
	push(@parameters,"%".$info."%");
240
    }
235
    }
241
   
236
   
237
    warn $query, join("/",@parameters);
242
    my $sth = $dbh->prepare($query);
238
    my $sth = $dbh->prepare($query);
243
    $sth->execute(@parameters);
239
    $sth->execute(@parameters);
244
    
240
    
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc (-1 / +1 lines)
Lines 62-68 Link Here
62
	<!-- TMPL_IF NAME="finesview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Fines</a></li>
62
	<!-- TMPL_IF NAME="finesview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Fines</a></li>
63
	<!-- /TMPL_IF -->
63
	<!-- /TMPL_IF -->
64
	<!-- TMPL_IF NAME="intranetreadinghistory" --><!-- TMPL_IF NAME="readingrecordview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Circulation History</a></li><!-- /TMPL_IF -->
64
	<!-- TMPL_IF NAME="intranetreadinghistory" --><!-- TMPL_IF NAME="readingrecordview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Circulation History</a></li><!-- /TMPL_IF -->
65
	<!-- TMPL_IF NAME="CAN_user_parameters"--><!-- TMPL_IF NAME="logview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;action=MODIFY&amp;object=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;src=circ">Modification Log</a></li><!-- /TMPL_IF -->
65
	<!-- TMPL_IF NAME="CAN_user_parameters"--><!-- TMPL_IF NAME="logview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;modules=circulation&amp;object=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;src=circ">Modification Log</a></li><!-- /TMPL_IF -->
66
    <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
66
    <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
67
    <!-- TMPL_IF NAME="messagingview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Messaging</a></li>
67
    <!-- TMPL_IF NAME="messagingview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Messaging</a></li>
68
    <!-- /TMPL_IF -->	
68
    <!-- /TMPL_IF -->	
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl (+73 lines)
Lines 27-32 Link Here
27
	<div id="bd">
27
	<div id="bd">
28
		<div id="yui-main">
28
		<div id="yui-main">
29
			<div class="yui-b">
29
			<div class="yui-b">
30
                <!-- TMPL_IF Name="CAN_user_reports"-->
30
				<h1>Browse system logs</h1>
31
				<h1>Browse system logs</h1>
31
				<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
32
				<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
32
					<!-- TMPL_IF NAME="do_it" -->
33
					<!-- TMPL_IF NAME="do_it" -->
Lines 206-212 Link Here
206
							</div>
207
							</div>
207
						<!-- /TMPL_IF -->
208
						<!-- /TMPL_IF -->
208
					<!-- /TMPL_IF -->
209
					<!-- /TMPL_IF -->
210
209
				</form>
211
				</form>
212
                <!-- /TMPL_IF -->
213
                <!-- TMPL_IF NAME="do_it" -->
214
                    <!-- TMPL_IF NAME="total" -->
215
                        <h4><!-- TMPL_VAR NAME="total" --> lines found.</h4>
216
                        <table>
217
                            <tr>
218
                                <th>Date</th>
219
                                <th>Librarian</th>
220
                                <th>Module</th>
221
                                <th>Action</th>
222
                                <th>Object</th>
223
                                <th>Info</th>
224
                            </tr>
225
                            <!-- TMPL_LOOP NAME="looprow" -->
226
                                <tr>
227
                                    <td><!-- TMPL_VAR NAME="timestamp" --></td>
228
                                    <td>
229
                                       <!-- TMPL_IF EXPR="module eq 'CIRCULATION'" -->
230
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="user" -->" title="display detail for this user."> <!-- TMPL_VAR NAME="user" --> </a>
231
                                        <!--TMPL_ELSE-->
232
                                        <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="user" -->" title="display detail for this librarian."> <!-- TMPL_VAR NAME="user" --> </a>
233
                                        <!--/TMPL_IF-->
234
                                    </td>
235
                                    <td><!-- TMPL_VAR NAME="module" --></td>
236
                                    <td><!-- TMPL_VAR NAME="action" --></td>
237
                                    <td>
238
                                        <!-- TMPL_IF EXPR="module eq 'MEMBERS'"-->
239
                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details."> member <!-- TMPL_VAR NAME="object" --> </a>
240
                                        <!-- TMPL_ELSE -->
241
                                            <!-- TMPL_IF EXPR="module eq 'CIRCULATION'" -->
242
                                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="object" -->" title="Display member details."> member <!-- TMPL_VAR NAME="object" --> </a>
243
                                            <!-- TMPL_ELSE -->
244
                                                <!-- TMPL_IF EXPR="module eq 'CATALOGUING'" -->
245
                                                    <!-- TMPL_IF EXPR="info eq 'item'" -->
246
                                                        <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>
247
                                                    <!-- TMPL_ELSE -->
248
                                                        <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>
249
                                                    <!-- /TMPL_IF -->
250
                                                <!-- TMPL_ELSE-->
251
                                                    <!-- TMPL_IF EXPR="module eq 'SERIAL'" -->
252
                                                        <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="object" -->"> <!-- TMPL_VAR NAME="object" --> </a>
253
                                                    <!-- TMPL_ELSE -->
254
                                                        <!-- TMPL_VAR NAME="object" -->
255
                                                    <!-- /TMPL_IF -->
256
                                                <!-- /TMPL_IF -->
257
                                            <!-- /TMPL_IF -->
258
                                        <!-- /TMPL_IF -->
259
                                    </td>
260
                                    <td>
261
                                        <!-- TMPL_IF NAME="CIRCULATION" -->
262
                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?item=<!-- TMPL_VAR NAME="info" -->&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&bi=<!-- TMPL_VAR NAME="biblioitemnumber" -->#item<!-- TMPL_VAR NAME="object" -->" title="Display detail for this biblio">Item <!-- TMPL_VAR NAME="info" escape="html" --></a>
263
                                        <!-- TMPL_ELSE -->
264
                                            <!-- TMPL_VAR NAME="info" escape="html"-->
265
                                        <!-- /TMPL_IF -->
266
                                    </td>
267
                                </tr>
268
                            <!-- /TMPL_LOOP -->
269
                        </table>
270
                    <!-- TMPL_ELSE -->
271
                        <div class="dialog alert">
272
                            No log found
273
                            <!-- TMPL_IF NAME="CATALOGUING" -->
274
                                for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="object" -->">Bibliographic Record <!-- TMPL_VAR NAME="object" --></a>
275
                            <!-- /TMPL_IF -->
276
                            <!-- TMPL_IF NAME="MEMBERS" -->
277
                                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>
278
                            <!-- /TMPL_IF -->
279
                            .
280
                        </div>
281
                    <!-- /TMPL_IF -->
282
                <!-- /TMPL_IF -->
210
			</div>
283
			</div>
211
		</div>
284
		</div>
212
		<div class="yui-b noprint">
285
		<div class="yui-b noprint">
(-)a/tools/viewlog.pl (-10 / +13 lines)
Lines 46-52 $debug or $debug = $cgi_debug; Link Here
46
my $do_it    = $input->param('do_it');
46
my $do_it    = $input->param('do_it');
47
my @modules   = $input->param("modules");
47
my @modules   = $input->param("modules");
48
my $user     = $input->param("user");
48
my $user     = $input->param("user");
49
my $action   = $input->param("action");
49
my @action   = $input->param("action");
50
my $object   = $input->param("object");
50
my $object   = $input->param("object");
51
my $info     = $input->param("info");
51
my $info     = $input->param("info");
52
my $datefrom = $input->param("from");
52
my $datefrom = $input->param("from");
Lines 103-114 $template->param( Link Here
103
103
104
if ($do_it) {
104
if ($do_it) {
105
105
106
    my $results = GetLogs($datefrom,$dateto,$user,\@modules,$action,$object,$info);
106
    my @data;
107
    my $total = scalar @$results;
107
    my $results = GetLogs($datefrom,$dateto,$user,\@modules,\@action,$object,$info);
108
    foreach my $result (@$results){
108
    @data=@$results;
109
	if ($result->{'info'} eq 'item'){
109
    my $total = scalar @data;
110
    foreach my $result (@data){
111
	if ($result->{'info'} eq 'item'||$result->{module} eq "CIRCULATION"){
110
	    # get item information so we can create a working link
112
	    # get item information so we can create a working link
111
	    my $item=GetItem($result->{'object'});
113
        my $itemnumber=$result->{'object'};
114
        $itemnumber=$result->{'info'} if ($result->{module} eq "CIRCULATION");
115
	    my $item=GetItem($itemnumber);
112
	    $result->{'biblionumber'}=$item->{'biblionumber'};
116
	    $result->{'biblionumber'}=$item->{'biblionumber'};
113
	    $result->{'biblioitemnumber'}=$item->{'biblionumber'};		
117
	    $result->{'biblioitemnumber'}=$item->{'biblionumber'};		
114
	}
118
	}
Lines 119-131 if ($do_it) { Link Here
119
        $template->param (
123
        $template->param (
120
			logview => 1,
124
			logview => 1,
121
            total    => $total,
125
            total    => $total,
122
            looprow  => $results,
126
            looprow  => \@data,
123
            do_it    => 1,
127
            do_it    => 1,
124
            datefrom => $datefrom,
128
            datefrom => $datefrom,
125
            dateto   => $dateto,
129
            dateto   => $dateto,
126
            user     => $user,
130
            user     => $user,
127
            object   => $object,
131
            object   => $object,
128
            action   => $action,
132
            action   => \@action,
129
            info     => $info,
133
            info     => $info,
130
            src      => $src,
134
            src      => $src,
131
        );
135
        );
Lines 143-149 if ($do_it) { Link Here
143
            -filename   => "$basename.csv"
147
            -filename   => "$basename.csv"
144
        );
148
        );
145
        my $sep = C4::Context->preference("delimiter");
149
        my $sep = C4::Context->preference("delimiter");
146
        foreach my $line (@$results) {
150
        foreach my $line (@data) {
147
            #next unless $modules[0] eq "catalogue";
151
            #next unless $modules[0] eq "catalogue";
148
		foreach (qw(timestamp firstname surname action info title author)) {
152
		foreach (qw(timestamp firstname surname action info title author)) {
149
			print $line->{$_} . $sep;
153
			print $line->{$_} . $sep;
150
- 

Return to bug 6014