From 6303e6c389b7bb647d58b889dff38f62da43d9b5 Mon Sep 17 00:00:00 2001
From: charles <charles@inlibro.com>
Date: Thu, 12 Mar 2015 14:54:33 -0400
Subject: [PATCH] Bug 11317: Correct critic, forbidden patterns issues when
 tested with koha-test-tools

---
 .../prog/en/modules/reports/report_files.tt        | 17 +++++++-------
 reports/report_files.pl                            | 27 +++++++++++-----------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt
index a289b62..d17c2dd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt
@@ -2,12 +2,11 @@
 <title>Report/log files</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables.inc' %]
 [% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
 <script type="text/JavaScript" language="JavaScript">
-	//<![CDATA[
-		$(document).ready(function() {
+    //<![CDATA[
+        $(document).ready(function() {
             $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
                 "sDom": 't',
                 "aoColumnDefs": [
@@ -15,8 +14,8 @@
                 ],
                 "bPaginate": false
             }));
-	});
-	//]]>
+    });
+    //]]>
 </script>
 </head>
 <body>
@@ -27,10 +26,10 @@
 
 <div id="doc3" class="yui-t2">
    <div id="bd">
-	<div id="yui-main">
-	<div class="yui-b">
+    <div id="yui-main">
+    <div class="yui-b">
 
-	<h1>Report/log files</h1>
+    <h1>Report/log files</h1>
 
 [% IF ( error_no_publicdir ) %]
     <div class="dialog alert"><strong>Error : </strong>Report/log files could not be found because the "publicdir" option was not set in "koha-conf.xml". Contact your system administrator to add this option.</div>
diff --git a/reports/report_files.pl b/reports/report_files.pl
index 2bc784f..6a37396 100755
--- a/reports/report_files.pl
+++ b/reports/report_files.pl
@@ -10,7 +10,7 @@
 #
 # Koha is free software; you can redistribute it and/or modify it under the
 # terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
+# Foundation; either version 3 of the License, or (at your option) any later
 # version.
 #
 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -36,12 +36,12 @@ my $file_id = $input->param("id");
 my $directory = C4::Context->config('publicdir');
 
 my ($template, $borrowernumber, $cookie)
-	= get_template_and_user({template_name => "reports/report_files.tt",
-				query => $input,
-				type => "intranet",
-				authnotrequired => 0,
-				flagsrequired => {reports => '*'},
-				});
+    = get_template_and_user({template_name => "reports/report_files.tt",
+                query => $input,
+                type => "intranet",
+                authnotrequired => 0,
+                flagsrequired => {reports => '*'},
+                });
 
 unless($directory) {
     $template->param(error_no_publicdir => 1);
@@ -49,10 +49,10 @@ unless($directory) {
 else {
     #Get the files list
     my @files_list;
-	opendir(DIR, $directory);
+    opendir(DIR, $directory);
 
     foreach my $filename (readdir(DIR)) {
-	my $id = md5_hex($filename);
+    my $id = md5_hex($filename);
         my $full_path = "$directory/$filename";
         next if ($filename =~ /^\./ or -d $full_path);
 
@@ -75,14 +75,15 @@ else {
                              -Content_length => -s "$directory/$filename",
                              -attachment => "$filename");
 
-        open FILE, "<:utf8", "$directory/$filename";
-        binmode FILE;
+        my $fh;
+        open $fh, "<:encoding(UTF-8)", "$directory/$filename";
+        binmode $fh;
 
         my $buf;
-        while(read(FILE, $buf, 65536)) {
+        while(read($fh, $buf, 65536)) {
             print $buf;
         }
-        close FILE;
+        close $fh;
 
         exit(1);
     }
-- 
1.9.1