/[informatika.old]/print/izvjestaj.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /print/izvjestaj.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by dpavlin, Tue Jun 27 11:15:32 2000 UTC revision 1.9 by dpavlin, Thu Jul 13 08:01:31 2000 UTC
# Line 2  Line 2 
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;
# Line 11  $debug++ if ($ARGV[0] eq "-d"); Line 14  $debug++ if ($ARGV[0] eq "-d");
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: $!";
# Line 76  print MAIL " Line 81  print MAIL "
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  ";  ";
# Line 147  while (my @arr = $sth->fetchrow_array() Line 152  while (my @arr = $sth->fetchrow_array()
152          }          }
153  }  }
154    
 $sth->finish;  
155    
156  print HTML '  print HTML '
157  </table>  </table>
# Line 157  print HTML ' Line 161  print HTML '
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: $!";
# Line 183  računala.'; Line 185  računala.';
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    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.26