--- otvori_nove+db 2000/04/12 08:19:17 1.1 +++ otvori_nove+db 2000/04/12 09:10:20 1.2 @@ -8,13 +8,14 @@ # 2000-03-13 DbP podrska za novu support/last_open tablicu # 2000-03-16 DbP cuva stare aliase iz /etc/aliases # 2000-03-20 DbP skida razmake prije/poslje imena/prezimena - + use DBI; use strict; my $debug=0; $debug++ if (defined($ARGV[0]) && $ARGV[0] eq "-d"); +my $open_only_id=$ARGV[0] if (defined($ARGV[0])); warn "DEBUG -- me kreira ništa!" if ($debug); @@ -100,7 +101,12 @@ my $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr(); $sth->execute() || die $sth->errstr(); my ($last_open)=$sth->fetchrow_array; -$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)) { + $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr(); +} else { + $sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id=$open_only_id") || die $dbh->errstr(); + +} $sth->execute() || die $sth->errstr(); while (my ($osoba_id,$ime,$prezime,$sifra,$objekt,$kat,$soba,$shell) = $sth->fetchrow_array() ) { @@ -126,11 +132,11 @@ my $login; do { - $login=substr($ime,0,1).substr($prezime_za_login,0,7-length($add)).$add; - xdebug "$ime, $prezime login: $login\n"; - $add++; + $login=substr($ime,0,1).substr($prezime_za_login,0,7-length($add)).$add; + $login =~ tr [A-Z] [a-z]; + xdebug "$ime, $prezime login: $login\n"; + $add++; } while defined($etc_passwd{$login}); - $login =~ tr [A-Z] [a-z]; my $email_alias;