From 0bcfc9e9f117c9cd58cdbc11596e6760aaafc8df Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 29 Aug 2013 15:34:05 +0200 Subject: [PATCH] use configuration from /etc/koha/sites/fer/koha-conf.xml --- ferweb-import-report.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ferweb-import-report.pl b/ferweb-import-report.pl index d8e2fac..89e58cf 100755 --- a/ferweb-import-report.pl +++ b/ferweb-import-report.pl @@ -6,6 +6,7 @@ use Data::Dump qw/dump/; use Algorithm::CheckDigits; use Text::Unaccent; use DateTime; +use XML::Simple; my $ferweb_csv = 'report_62836_1026_Aktivni_studenti.csv'; my $dt = DateTime->now()->add( years => 1 ); @@ -16,8 +17,11 @@ warn "# new_dateexpiry: $new_dateexpiry\n"; die "$ferweb_csv : $!" unless -r $ferweb_csv; +my $koha_conf = XMLin('/etc/koha/sites/fer/koha-conf.xml'); + my $c = DBI->connect("dbi:CSV:","","", { RaiseError => 1, f_ext => '.csv', f_encoding => 'utf-8', csv_sep_char => ';' }) || die $dbi::errstr; -my $k = DBI->connect("dbi:mysql:database=koha_fer","","", { RaiseError => 1, AutoCommit => 0, mysql_enable_utf8 => 1 }) || die $DBI::errstr; +my $k = DBI->connect("dbi:mysql:database=" . $koha_conf->{config}->{database}, $koha_conf->{config}->{user}, $koha_conf->{config}->{pass}, + { RaiseError => 1, AutoCommit => 0, mysql_enable_utf8 => 1 }) || die $DBI::errstr; my $ferweb_table = $ferweb_csv; $ferweb_table =~ s/\.csv//i; -- 2.20.1