Letters.pm: Minor change. Unsure if this is "the right" move, but pretty sure the...
[koha_fer] / C4 / Context.pm
index 7efeb06..5ff2474 100644 (file)
@@ -61,7 +61,7 @@ use C4::Boolean;
 
 use vars qw($VERSION $AUTOLOAD $context @context_stack);
 
-$VERSION = '3.00.00.005';
+$VERSION = '3.00.00.032';
 
 =head1 NAME
 
@@ -187,11 +187,9 @@ Returns undef in case of error.
 
 =cut
 
-sub read_config_file {
-    my $fname = shift;    # Config file to read
-    my $retval = {};    # Return value: ref-to-hash holding the configuration
-    my $koha = XMLin($fname, keyattr => ['id'],forcearray => ['listen', 'server', 'serverinfo']);
-    return $koha;
+sub read_config_file {         # Pass argument naming config file to read
+    my $koha = XMLin(shift, keyattr => ['id'], forcearray => ['listen', 'server', 'serverinfo']);
+    return $koha;                      # Return value: ref-to-hash holding the configuration
 }
 
 # db_scheme2dbi
@@ -586,16 +584,20 @@ sub _new_dbh
     my $db_name   = $context->config("database");
     my $db_host   = $context->config("hostname");
     my $db_port   = $context->config("port");
+    $db_port = "" unless defined $db_port;
     my $db_user   = $context->config("user");
     my $db_passwd = $context->config("pass");
     my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
          $db_user, $db_passwd);
-    if ( $db_name eq 'mysql' ) { 
+    if ( $db_driver eq 'mysql' ) { 
         # Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config.
         # this is better than modifying my.cnf (and forcing all communications to be in utf8)
         $dbh->do("set NAMES 'utf8'") if ($dbh);
         $dbh->{'mysql_enable_utf8'}=1; #enable
     }
+    elsif ( $db_driver eq 'Pg' ) {
+           $dbh->do( "set client_encoding = 'UTF8';" );
+    }
     return $dbh;
 }