use configuration from /etc/koha/sites/fer/koha-conf.xml
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 29 Aug 2013 13:34:05 +0000 (15:34 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 29 Aug 2013 13:34:05 +0000 (15:34 +0200)
ferweb-import-report.pl

index d8e2fac..89e58cf 100755 (executable)
@@ -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;