--- print/izvjestaj.pl 2000/06/02 07:07:11 1.7
+++ print/izvjestaj.pl 2002/01/25 14:47:50 1.10
@@ -2,24 +2,29 @@
use strict;
+my $ic_mail='biljana.gombar@pliva.hr,antonio.gulam@pliva.hr';
+my $mreze_mail='davorin.koprivnjak@pliva.hr';
+
my $debug=0;
use DBI;
use POSIX qw(strftime);
-$debug++ if ($ARGV[0] eq "-d");
+$debug++ if (defined $ARGV[0] && $ARGV[0] eq "-d");
print STDERR "Debug mod: output je u /tmp/debug*\n" if ($debug);
-my $currdate = strftime "%d.%m.%Y %H:%M:%S", localtime;
+my $currdate = strftime "%Y-%m-%d %H:%M:%S", localtime;
my $html_file=$currdate;
$html_file=~s/ /_/g;
$html_file="izvjestaji/$html_file.html";
+my $html_date=$currdate;
+$html_date=~s/ /%20/g;
if (! $debug) {
open(HTML,"> $html_file") || die "html: $!";
-open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!";
+open(MAIL,"|/usr/lib/sendmail $ic_mail,$mreze_mail,izvjestaji\@support.pliva.hr") || die "sendmail: $!";
} else {
open(HTML,"> /tmp/debug.html") || die "html: $!";
open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!";
@@ -50,8 +55,8 @@
$db_user="user=$db_user;";
}
-
-my $dbh = DBI->connect("DBI:Pg:dbname=informatika;${host}${db_user}","","") || die $DBI::errstr;
+my $dbh = DBI->connect("DBI:Pg:dbname=informatika;${host}${db_user}","","") || die "can't connect";
+# die $DBI::errstr;
$dbh->do("set datestyle = 'german'") || die $dbh->errstr();
my $sth = $dbh->prepare("select id from last_print order by id desc limit 1,1");
@@ -76,14 +81,14 @@
Datum i vrijeme generiranja izvještaja: $currdate
Izvještaj za štampanje se nalazi na
-http://support.pliva.hr/$html_file
+http://support.pliva.hr/ic.php?datum=$html_date
sa potpunim podacima o umrežavanju, lokaciji računala i osobe
";
print HTML "
Datum i vrijeme generiranja izvještaja: $currdate
"; -$sth = $dbh->prepare(" +my $sql=" select osobe.id,ime,prezime,tel,lokacije.naziv, org_jed.naziv,org_pod_jed.pod_naziv, lok_racunala,objekt,kat,soba,z_rac,umrezavanje, @@ -95,7 +100,11 @@ and podesavanje=true and kontakt_osobe.id=kontakt_osoba_id order by lokacije.naziv,org_jed.naziv - ") || die $dbh->errstr(); + "; + +die "nema osoba za izvještaj" if (! @osoba_id_za_print); + +$sth = $dbh->prepare($sql) || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); my $rbr=1; @@ -122,7 +131,7 @@ $lokacija=$arr[4]; print HTML "