/[useradm]/otvori_nove+db
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 /otvori_nove+db

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

revision 1.1 by dpavlin, Wed Apr 12 08:19:17 2000 UTC revision 1.2 by dpavlin, Wed Apr 12 09:10:20 2000 UTC
# Line 8  Line 8 
8  # 2000-03-13 DbP podrska za novu support/last_open tablicu  # 2000-03-13 DbP podrska za novu support/last_open tablicu
9  # 2000-03-16 DbP cuva stare aliase iz /etc/aliases  # 2000-03-16 DbP cuva stare aliase iz /etc/aliases
10  # 2000-03-20 DbP skida razmake prije/poslje imena/prezimena  # 2000-03-20 DbP skida razmake prije/poslje imena/prezimena
11            
12  use DBI;  use DBI;
13  use strict;  use strict;
14    
15  my $debug=0;  my $debug=0;
16    
17  $debug++ if (defined($ARGV[0]) && $ARGV[0] eq "-d");  $debug++ if (defined($ARGV[0]) && $ARGV[0] eq "-d");
18    my $open_only_id=$ARGV[0] if (defined($ARGV[0]));
19    
20  warn "DEBUG -- me kreira ništa!" if ($debug);  warn "DEBUG -- me kreira ništa!" if ($debug);
21    
# Line 100  my $dbh = DBI->connect("DBI:Pg:dbname=in Line 101  my $dbh = DBI->connect("DBI:Pg:dbname=in
101  my $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr();  my $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr();
102  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
103  my ($last_open)=$sth->fetchrow_array;  my ($last_open)=$sth->fetchrow_array;
104  $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr();  if (! defined($open_only_id)) {
105            $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr();
106    } else {
107            $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id=$open_only_id") || die $dbh->errstr();
108    
109    }
110  $sth->execute() || die $sth->errstr();  $sth->execute() || die $sth->errstr();
111  while (my ($osoba_id,$ime,$prezime,$sifra,$objekt,$kat,$soba,$shell) = $sth->fetchrow_array() ) {  while (my ($osoba_id,$ime,$prezime,$sifra,$objekt,$kat,$soba,$shell) = $sth->fetchrow_array() ) {
112    
# Line 126  while (my ($osoba_id,$ime,$prezime,$sifr Line 132  while (my ($osoba_id,$ime,$prezime,$sifr
132          my $login;          my $login;
133    
134          do {          do {
135                   $login=substr($ime,0,1).substr($prezime_za_login,0,7-length($add)).$add;                  $login=substr($ime,0,1).substr($prezime_za_login,0,7-length($add)).$add;
136                   xdebug "$ime, $prezime   login: $login\n";                  $login =~ tr [A-Z] [a-z];
137                   $add++;                  xdebug "$ime, $prezime   login: $login\n";
138                    $add++;
139          } while defined($etc_passwd{$login});          } while defined($etc_passwd{$login});
         $login =~ tr [A-Z] [a-z];  
140    
141          my $email_alias;          my $email_alias;
142    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26