[Koha-patches] (no subject)
stan
stan at brinkerhoff.org
Thu Jan 1 18:39:33 CET 2009
>From 74de1bb0b2f0ad21fab01a35f5c0cb3582f6c1db Mon Sep 17 00:00:00 2001
From: stan <stan at brinkerhoff.org>
Date: Thu, 1 Jan 2009 12:36:57 -0500
Subject: [PATCH] Enable use warnings;, clean up complainy functions, fix a few tab/space formatting issues.
Refactoring KOHAVERSION to be less crufty, enabling use warnings, change formatting slightly in places.
---
C4/Context.pm | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/C4/Context.pm b/C4/Context.pm
index 78b9dd7..9c7e0b8 100644
--- a/C4/Context.pm
+++ b/C4/Context.pm
@@ -16,6 +16,7 @@ package C4::Context;
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
+use warnings;
use strict;
use vars qw($VERSION $AUTOLOAD $context @context_stack);
@@ -190,17 +191,14 @@ $context = undef; # Initially, no context is set
=cut
sub KOHAVERSION {
- my $cgidir = C4::Context->intranetdir ."/cgi-bin";
-
- # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin
- # on a standard install, /cgi-bin need to be added.
- # test one, then the other
- # FIXME - is this all really necessary?
- unless (opendir(DIR, "$cgidir/cataloguing/value_builder")) {
- $cgidir = C4::Context->intranetdir;
- closedir(DIR);
- }
+ my $cgidir = C4::Context->intranetdir;
+ # Apparently the GIT code does not run out of a CGI-BIN subdirectory
+ # but distribution code does? (Stan, 1jan08)
+ if(-d $cgidir . "/cgi-bin"){
+ my $cgidir .= "/cgi-bin";
+ }
+
do $cgidir."/kohaversion.pl" || die "NO $cgidir/kohaversion.pl";
return kohaversion();
}
@@ -649,13 +647,13 @@ sub _new_Zconn {
sub _new_dbh
{
-### $context
- ##correct name for db_schme
+ ## $context
+ ## correct name for db_schme
my $db_driver;
if ($context->config("db_scheme")){
- $db_driver=db_scheme2dbi($context->config("db_scheme"));
+ $db_driver=db_scheme2dbi($context->config("db_scheme"));
}else{
- $db_driver="mysql";
+ $db_driver="mysql";
}
my $db_name = $context->config("database");
@@ -931,12 +929,12 @@ sub set_userenv{
"cardnumber" => $usercnum,
"firstname" => $userfirstname,
"surname" => $usersurname,
-#possibly a law problem
+ #possibly a law problem
"branch" => $userbranch,
"branchname" => $branchname,
"flags" => $userflags,
- "emailaddress" => $emailaddress,
- "branchprinter" => $branchprinter
+ "emailaddress" => $emailaddress,
+ "branchprinter" => $branchprinter
};
$context->{userenv}->{$var} = $cell;
return $cell;
--
1.5.6.3
More information about the Koha-patches
mailing list