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 |
|
|
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 |
|
|
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 |
|
|