From a7454e999282a1b1ade72bd451a6901d2fa8acba Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Wed, 25 Sep 2013 09:07:44 +0200
Subject: [PATCH] Bug 6874 - File upload in MARC - QA Followup
Content-Type: text/plain; charset=utf-8

* Renames uploadPath to upload_path to follow the standard naming
  conventions in koha-conf which use underscores rather than camel case
* Remove reference to intranet-tmpl and replace with [% interface %]
  required to pass qa

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 C4/UploadedFiles.pm                                            |    8 ++++----
 cataloguing/value_builder/upload.pl                            |    6 +++---
 etc/koha-conf.xml                                              |    2 +-
 installer/data/mysql/updatedatabase.pl                         |    4 ++--
 .../prog/en/modules/cataloguing/value_builder/upload.tt        |    4 ++--
 t/db_dependent/UploadedFiles.t                                 |    2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/C4/UploadedFiles.pm b/C4/UploadedFiles.pm
index 1d72015..456bf4e 100644
--- a/C4/UploadedFiles.pm
+++ b/C4/UploadedFiles.pm
@@ -61,8 +61,8 @@ use C4::Context;
 sub _get_file_path {
     my ($id, $dirname, $filename) = @_;
 
-    my $uploadPath = C4::Context->config('uploadPath');
-    my $filepath = "$uploadPath/$dirname/${id}_$filename";
+    my $upload_path = C4::Context->config('upload_path');
+    my $filepath = "$upload_path/$dirname/${id}_$filename";
     $filepath =~ s|/+|/|g;
 
     return $filepath;
@@ -81,7 +81,7 @@ Hash keys are:
 
 =item * filename: name of the file
 
-=item * dir: directory where file is stored (relative to config variable 'uploadPath')
+=item * dir: directory where file is stored (relative to config variable 'upload_path')
 
 =back
 
@@ -123,7 +123,7 @@ Parameters:
 
 =item * $filename: name of the file
 
-=item * $dir: directory where to store the file (path relative to config variable 'uploadPath'
+=item * $dir: directory where to store the file (path relative to config variable 'upload_path'
 
 =item * $io_handle: valid IO::Handle object, can be retrieved with
 $cgi->upload('uploaded_file')->handle;
diff --git a/cataloguing/value_builder/upload.pl b/cataloguing/value_builder/upload.pl
index f415464..4e6683a 100755
--- a/cataloguing/value_builder/upload.pl
+++ b/cataloguing/value_builder/upload.pl
@@ -108,7 +108,7 @@ sub plugin {
             }
         }
     } else {
-        my $upload_path = C4::Context->config('uploadPath');
+        my $upload_path = C4::Context->config('upload_path');
         if ($upload_path) {
             my $filefield = CGI::filefield(
                 -name => 'uploaded_file',
@@ -141,7 +141,7 @@ sub plugin {
 # Build a hierarchy of directories
 sub finddirs {
     my $base = shift;
-    my $upload_path = C4::Context->config('uploadPath');
+    my $upload_path = C4::Context->config('upload_path');
     my $found = 0;
     my @dirs;
     my @files = glob("$base/*");
@@ -175,7 +175,7 @@ Two system preference are used:
 
 =over 4
 
-=item * uploadPath: the real absolute path where files will be stored
+=item * upload_path: the real absolute path where files will be stored
 
 =item * OPACBaseURL: for building URLs to be stored in MARC
 
diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml
index caf843c..1f2b460 100644
--- a/etc/koha-conf.xml
+++ b/etc/koha-conf.xml
@@ -88,7 +88,7 @@ __PAZPAR2_TOGGLE_XML_POST__
  <authorityservershadow>1</authorityservershadow>
  <pluginsdir>__PLUGINS_DIR__</pluginsdir>
  <enable_plugins>0</enable_plugins>
- <uploadPath></uploadPath>
+ <upload_path></upload_path>
  <intranetdir>__INTRANET_CGI_DIR__</intranetdir>
  <opacdir>__OPAC_CGI_DIR__/opac</opacdir>
  <opachtdocs>__OPAC_TMPL_DIR__</opachtdocs>
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 61cdc9a..a167066 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -10737,8 +10737,8 @@ if ( CheckVersion($DBversion) ) {
     ");
 
     print "Upgrade to $DBversion done (Bug 6874: New cataloging plugin upload.pl)\n";
-    print "This plugin comes with a new config variable (uploadPath) and a new table (uploaded_files)\n";
-    print "To use it, set 'uploadPath' config variable and 'OPACBaseURL' system preference and link this plugin to a subfield (856\$u for instance)\n";
+    print "This plugin comes with a new config variable (upload_path) and a new table (uploaded_files)\n";
+    print "To use it, set 'upload_path' config variable and 'OPACBaseURL' system preference and link this plugin to a subfield (856\$u for instance)\n";
     SetVersion($DBversion);
 }
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt
index 10f64f1..cd983ad 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt
@@ -4,7 +4,7 @@
 <head>
     <title>Upload plugin</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <script type="text/javascript" src="/intranet-tmpl/lib/jquery/jquery.js"></script>
+    <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
     <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
 
 </head>
@@ -56,7 +56,7 @@
 
         [% IF (error_upload_path_not_configured) %]
           <h2>Configuration error</h2>
-          <p>Configuration variable 'uploadPath' is not configured.</p>
+          <p>Configuration variable 'upload_path' is not configured.</p>
           <p>Please configure it in your koha-conf.xml</p>
         [% ELSE %]
           <h2>Please select the file to upload : </h2>
diff --git a/t/db_dependent/UploadedFiles.t b/t/db_dependent/UploadedFiles.t
index d829dee..ff14317 100644
--- a/t/db_dependent/UploadedFiles.t
+++ b/t/db_dependent/UploadedFiles.t
@@ -20,7 +20,7 @@ $tcm->upload_file(
 my $cgi = $tcm->create_cgi;
 
 my $tempdir = tempdir(CLEANUP => 1);
-t::lib::Mocks::mock_config('uploadPath', $tempdir);
+t::lib::Mocks::mock_config('upload_path', $tempdir);
 
 my $testfilename = $cgi->param('testfile');
 my $testfile_fh = $cgi->upload('testfile');
-- 
1.7.10.4