21 |
open(HTML,"> $html_file") || die "html: $!"; |
open(HTML,"> $html_file") || die "html: $!"; |
22 |
open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!"; |
open(MAIL,"|/usr/lib/sendmail biljana.gombar\@pliva.hr,izvjestaji\@support.pliva.hr") || die "sendmail: $!"; |
23 |
} else { |
} else { |
24 |
open(HTML,"> /tmp/debug.html") || die "html: $!"; |
open(HTML,"> /tmp/debug.html") || warn "html: $!"; |
25 |
open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!"; |
open(MAIL,"> /tmp/debug.mail") || warn "sendmail: $!"; |
26 |
} |
} |
27 |
|
|
28 |
print HTML ' |
print HTML ' |
37 |
|
|
38 |
'; |
'; |
39 |
|
|
40 |
my $dbh = DBI->connect("DBI:Pg:dbname=informatika","","") || die $DBI::errstr; |
my $host = "host=support.pliva.hr;"; |
41 |
|
|
42 |
|
open(WHO,"who -m |") || die "who am i? $!"; |
43 |
|
my $db_user=<WHO>; |
44 |
|
$db_user=~s/[^!]+!//; |
45 |
|
close(WHO); |
46 |
|
if (! defined($db_user)) { |
47 |
|
$db_user="user=dpavlin;"; $host=""; # works on localhost |
48 |
|
} else { |
49 |
|
$db_user=~s/\s.+$//g; |
50 |
|
$db_user="user=$db_user;"; |
51 |
|
} |
52 |
|
|
53 |
|
|
54 |
|
my $dbh = DBI->connect("DBI:Pg:dbname=informatika;${host}${db_user}","","") || die $DBI::errstr; |
55 |
$dbh->do("set datestyle = 'german'") || die $dbh->errstr(); |
$dbh->do("set datestyle = 'german'") || die $dbh->errstr(); |
56 |
|
|
57 |
my $sth = $dbh->prepare("select id from last_print order by id desc limit 1,1"); |
my $sth = $dbh->prepare("select id from last_print order by id desc limit 1,1"); |
107 |
|
|
108 |
my $bgcol=''; |
my $bgcol=''; |
109 |
my $mreza=''; |
my $mreza=''; |
110 |
|
my @za_ic; |
111 |
|
|
112 |
while (my @arr = $sth->fetchrow_array() ) { |
while (my @arr = $sth->fetchrow_array() ) { |
113 |
|
push @za_ic,$arr[0]; |
114 |
|
|
115 |
printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]"); |
printf MAIL ("%3s %4s %-20s %4s %-30s %-20s\n",$rbr,$arr[0],"$arr[1] $arr[2]",$arr[3],$arr[4],"$arr[5] $arr[6]"); |
116 |
if ($lokacija ne $arr[4]) { |
if ($lokacija ne $arr[4]) { |
117 |
$lokacija=$arr[4]; |
$lokacija=$arr[4]; |
148 |
close(HTML); |
close(HTML); |
149 |
close(MAIL); |
close(MAIL); |
150 |
|
|
151 |
|
print "Printanje zahtjeva za print za IC:\n./print.pl ",join(",",@za_ic),"\n"; |