--- print/izvjestaj.pl 2000/07/13 08:01:31 1.9 +++ print/izvjestaj.pl 2002/01/25 14:47:50 1.10 @@ -2,7 +2,7 @@ use strict; -my $ic_mail='biljana.gombar@pliva.hr'; +my $ic_mail='biljana.gombar@pliva.hr,antonio.gulam@pliva.hr'; my $mreze_mail='davorin.koprivnjak@pliva.hr'; my $debug=0; @@ -10,7 +10,7 @@ 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); @@ -55,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"); @@ -88,7 +88,7 @@ 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, @@ -100,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;