/[informatika.old]/print/print.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/print.pl

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

revision 1.6 by dpavlin, Mon Jun 12 07:03:57 2000 UTC revision 1.8 by dpavlin, Fri Jan 25 14:47:50 2002 UTC
# Line 37  chomp $db_user; Line 37  chomp $db_user;
37  $db_user=~s/\s.+$//g;   # OSF obriši sve iza logina  $db_user=~s/\s.+$//g;   # OSF obriši sve iza logina
38  $db_user=~s/^[^!]+!//g; # Linux obriši hostname  $db_user=~s/^[^!]+!//g; # Linux obriši hostname
39  close(WHO);  close(WHO);
40    if ($db_user eq "") {
41            open(ID,"id |") || die "id: $!";
42            my $foo=<ID>; chomp $foo;
43            if ($foo=~/uid=\d+\((\w+)\)/) {
44                    $db_user=$1;
45            } else {
46                    die "can't locate who is local user!";
47            }
48    }
49    
50  open(HOSTNAME,"hostname |") || die "hostname: $!";  open(HOSTNAME,"hostname |") || die "hostname: $!";
51  my $hostname=<HOSTNAME>;  my $hostname=<HOSTNAME>;
# Line 92  while (my ($osoba_id,$status_tip_id) = $ Line 101  while (my ($osoba_id,$status_tip_id) = $
101    
102  print "Računa za insprintati: ",$#osoba_id_za_print+1,"\n";  print "Računa za insprintati: ",$#osoba_id_za_print+1,"\n";
103  exit if ($#osoba_id_za_print+1 == 0);  exit if ($#osoba_id_za_print+1 == 0);
104    my $server=3;
105  $sth = $dbh->prepare("  $sth = $dbh->prepare("
106          select osobe.id,ime,prezime,tel,lokacije.naziv,          select osobe.id,ime,prezime,tel,lokacije.naziv,
107                  org_jed.naziv,org_pod_jed.pod_naziv,                  org_jed.naziv,org_pod_jed.pod_naziv,
# Line 102  $sth = $dbh->prepare(" Line 111  $sth = $dbh->prepare("
111          where osobe.id in (".join(",",@osoba_id_za_print).")          where osobe.id in (".join(",",@osoba_id_za_print).")
112                  and lokacija_id=lokacije.id and org_jed_id=org_jed.id                  and lokacija_id=lokacije.id and org_jed_id=org_jed.id
113                  and org_pod_jed_id=org_pod_jed.pod_id                  and org_pod_jed_id=org_pod_jed.pod_id
114                  and racuni.osoba_id=osobe.id and e_mail.osoba_id=osobe.id                  and racuni.osoba_id=osobe.id and racuni.server_id=$server
115                    and e_mail.osoba_id=osobe.id
116          ") || die $dbh->errstr();          ") || die $dbh->errstr();
117  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
118    
# Line 114  while (my @arr = $sth->fetchrow_array() Line 124  while (my @arr = $sth->fetchrow_array()
124                  $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],$ko_id,'now'::datetime,5)") || die $dbh->errstr();                  $dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($arr[0],$ko_id,'now'::datetime,5)") || die $dbh->errstr();
125          }          }
126    
127            my $sth2 = $dbh->prepare("select naziv,mt from sap_osobe,sap_oj where sap_oj.sifra_oj = sap_oj and sap_sifra = $arr[11]");
128            $sth2->execute() || die $sth2->errstr();
129            my ($sap_org_jed,$mt) = $sth2->fetchrow_array();
130    
131          seek(IN,$begin_pos,0);          seek(IN,$begin_pos,0);
132          while(<IN>) {          while(<IN>) {
133                  s/--id--/$arr[0]/g;                  s/--id--/$arr[0]/g;
# Line 126  while (my @arr = $sth->fetchrow_array() Line 140  while (my @arr = $sth->fetchrow_array()
140                  s/--prezime--/$arr[2]/g;                  s/--prezime--/$arr[2]/g;
141                  s/--tel--/$arr[3]/g;                  s/--tel--/$arr[3]/g;
142                  s/--lok--/$arr[4]/g;                  s/--lok--/$arr[4]/g;
143                  s/--orgjed--/$arr[5]/g;                  s/--orgjed--/$sap_org_jed/g;
144                  s/--orgpodjed--/$arr[6]/g;                  s/--mt--/$mt/g;
145                  s/--lokrac--/$arr[7]/g;                  s/--lokrac--/$arr[7]/g;
146                  s/--login--/$arr[8]/g;                  s/--login--/$arr[8]/g;
147    

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

  ViewVC Help
Powered by ViewVC 1.1.26