Bug 12451 - circulation rule cant be edited if itemtype contains a space character
[koha_fer] / Koha / Database.pm
index 4c6cae6..92e83ec 100644 (file)
@@ -45,23 +45,12 @@ __PACKAGE__->mk_accessors(qw( ));
 # database connection from the data given in the current context, and
 # returns it.
 sub _new_schema {
-    my $db_driver;
+
     my $context = C4::Context->new();
-    if ( $context->config("db_scheme") ) {
-        $db_driver = $context->db_scheme2dbi( $context->config("db_scheme") );
-    }
-    else {
-        $db_driver = "mysql";
-    }
 
-    my $db_name   = $context->config("database");
-    my $db_host   = $context->config("hostname");
-    my $db_port   = $context->config("port") || '';
-    my $db_user   = $context->config("user");
-    my $db_passwd = $context->config("pass");
-    my $schema    = Koha::Schema->connect(
-        "DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
-        $db_user, $db_passwd );
+    # we are letting C4::Context->dbh not set the RaiseError handle attribute
+    # for now for compatbility purposes
+    my $schema = Koha::Schema->connect( sub { C4::Context->dbh }, { unsafe => 1 } );
     return $schema;
 }