2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
|
my $ic_mail='biljana.gombar@pliva.hr'; |
6 |
|
my $mreze_mail='davorin.koprivnjak@pliva.hr'; |
7 |
|
|
8 |
my $debug=0; |
my $debug=0; |
9 |
|
|
10 |
use DBI; |
use DBI; |
14 |
|
|
15 |
print STDERR "Debug mod: output je u /tmp/debug*\n" if ($debug); |
print STDERR "Debug mod: output je u /tmp/debug*\n" if ($debug); |
16 |
|
|
17 |
my $currdate = strftime "%d.%m.%Y %H:%M:%S", localtime; |
my $currdate = strftime "%Y-%m-%d %H:%M:%S", localtime; |
18 |
|
|
19 |
my $html_file=$currdate; |
my $html_file=$currdate; |
20 |
$html_file=~s/ /_/g; |
$html_file=~s/ /_/g; |
21 |
$html_file="izvjestaji/$html_file.html"; |
$html_file="izvjestaji/$html_file.html"; |
22 |
|
my $html_date=$currdate; |
23 |
|
$html_date=~s/ /%20/g; |
24 |
|
|
25 |
if (! $debug) { |
if (! $debug) { |
26 |
open(HTML,"> $html_file") || die "html: $!"; |
open(HTML,"> $html_file") || die "html: $!"; |
27 |
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: $!"; |
28 |
} else { |
} else { |
29 |
open(HTML,"> /tmp/debug.html") || die "html: $!"; |
open(HTML,"> /tmp/debug.html") || die "html: $!"; |
30 |
open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!"; |
open(MAIL,"> /tmp/debug.mail") || die "sendmail: $!"; |
81 |
Datum i vrijeme generiranja izvještaja: $currdate |
Datum i vrijeme generiranja izvještaja: $currdate |
82 |
|
|
83 |
Izvještaj za štampanje se nalazi na |
Izvještaj za štampanje se nalazi na |
84 |
http://support.pliva.hr/$html_file |
http://support.pliva.hr/ic.php?datum=$html_date |
85 |
sa potpunim podacima o umrežavanju, lokaciji računala i osobe |
sa potpunim podacima o umrežavanju, lokaciji računala i osobe |
86 |
|
|
87 |
"; |
"; |
127 |
$lokacija=$arr[4]; |
$lokacija=$arr[4]; |
128 |
print HTML "<tr bgcolor=#000000><td colspan=6><font size=+1 color=#ffffff>$lokacija</font></td></tr>"; |
print HTML "<tr bgcolor=#000000><td colspan=6><font size=+1 color=#ffffff>$lokacija</font></td></tr>"; |
129 |
} |
} |
130 |
print HTML "<tr$bgcol><td>$rbr</td><td>$arr[0]</td><td>$arr[1] $arr[2]</td><td>tel: $arr[3]</td><td><small>$arr[4]</small></td><td>$arr[5]<br>$arr[6]</td></tr>\n"; |
print HTML "<tr$bgcol><td>$rbr</td><td><a href=\"http://support.pliva.hr/obavijest.php?id=$arr[0]\">$arr[0]</a></td><td>$arr[1] $arr[2]</td><td>tel: $arr[3]</td><td><small>$arr[4]</small></td><td>$arr[5]<br>$arr[6]</td></tr>\n"; |
131 |
if ($arr[12] == 0) { |
if ($arr[12] == 0) { |
132 |
$mreza='umreženo'; |
$mreza='umreženo'; |
133 |
} else { |
} else { |
152 |
} |
} |
153 |
} |
} |
154 |
|
|
|
$sth->finish; |
|
155 |
|
|
156 |
print HTML ' |
print HTML ' |
157 |
</table> |
</table> |
161 |
close(HTML); |
close(HTML); |
162 |
close(MAIL); |
close(MAIL); |
163 |
|
|
|
$dbh->disconnect; |
|
|
|
|
164 |
foreach my $email_ko (keys %mail4ko) { |
foreach my $email_ko (keys %mail4ko) { |
165 |
if (! $debug) { |
if (! $debug) { |
166 |
open(MAIL,"|/usr/lib/sendmail $email_ko") || die "sendmail: $!"; |
open(MAIL,"|/usr/lib/sendmail $email_ko") || die "sendmail: $!"; |
185 |
close(MAIL); |
close(MAIL); |
186 |
} |
} |
187 |
|
|
188 |
print "Printanje zahtjeva za print za IC:\n./print.pl ",join(",",@za_ic),"\n"; |
#print "Printanje zahtjeva za print za IC:\n./print.pl ",join(",",@za_ic),"\n"; |
189 |
|
foreach my $id (@za_ic) { |
190 |
|
if (! $debug) { |
191 |
|
$dbh->do("insert into izvjestaji (datum,osoba_id) |
192 |
|
values ('$currdate',$id)") || die $dbh->errstr(); |
193 |
|
} |
194 |
|
} |
195 |
|
|
196 |
|
$sth->finish; undef $sth; |
197 |
|
$dbh->disconnect; |
198 |
|
|