41 |
my @mail_to; # array to main initial message to |
my @mail_to; # array to main initial message to |
42 |
open(WHO,"who am i |") || die "who am i? $!"; |
open(WHO,"who am i |") || die "who am i? $!"; |
43 |
my $db_user=<WHO>; |
my $db_user=<WHO>; |
44 |
|
chomp $db_user; |
45 |
$db_user=~s/\s.+$//g; |
$db_user=~s/\s.+$//g; |
46 |
close(WHO); |
close(WHO); |
47 |
|
|
48 |
xdebug "koristim korinika $db_user\n"; |
xdebug "koristim korinika $db_user\n"; |
49 |
|
|
50 |
|
open(HOSTNAME,"hostname |") || die "hostname: $!"; |
51 |
|
my $hostname=<HOSTNAME>; |
52 |
|
chomp $hostname; |
53 |
|
close(HOSTNAME); |
54 |
|
|
55 |
|
xdebug "koristim hostname $hostname\n"; |
56 |
|
|
57 |
v "/etc/aliases\n"; |
v "/etc/aliases\n"; |
58 |
open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!"; |
open(ALIAS,"/etc/aliases") || die "Can't open /etc/aliases: $!"; |
112 |
my $max_osoba_id=0; |
my $max_osoba_id=0; |
113 |
|
|
114 |
my $dbh = DBI->connect("DBI:Pg:dbname=informatika;host=support.pliva.hr;user=$db_user","","") || die $DBI::errstr; |
my $dbh = DBI->connect("DBI:Pg:dbname=informatika;host=support.pliva.hr;user=$db_user","","") || die $DBI::errstr; |
115 |
my $sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr(); |
|
116 |
|
my $sth = $dbh->prepare("select ko_id from unix2ko where login='$db_user' and host='$hostname'") || die $dbh->errstr(); |
117 |
|
$sth->execute() || die $sth->errstr(); |
118 |
|
my ($ko_id)=$sth->fetchrow_array; |
119 |
|
|
120 |
|
xdebug "upotrebljavam ID kontakt osobe: $ko_id\n"; |
121 |
|
|
122 |
|
$sth = $dbh->prepare("select max(id) from last_open") || die $dbh->errstr(); |
123 |
$sth->execute() || die $sth->errstr(); |
$sth->execute() || die $sth->errstr(); |
124 |
my ($last_open)=$sth->fetchrow_array; |
my ($last_open)=$sth->fetchrow_array; |
125 |
|
|
126 |
if (! defined($open_only_id)) { |
if (! defined($open_only_id)) { |
127 |
$sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr(); |
$sth = $dbh->prepare("select id,ime,prezime,sifra,objekt,kat,soba,shell from view_otvori_nove where id > $last_open") || die $dbh->errstr(); |
128 |
} else { |
} else { |
252 |
system "mkdir -p $dir ; mkdir $dir/bin ; \ |
system "mkdir -p $dir ; mkdir $dir/bin ; \ |
253 |
chown -R $uid:$group_id{$group} $dir ; chmod 755 $dir" if (! $debug); |
chown -R $uid:$group_id{$group} $dir ; chmod 755 $dir" if (! $debug); |
254 |
|
|
255 |
$dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,3,'now'::datetime,3)") if (! $debug); |
$dbh->do("insert into status (osoba_id,kontakt_osoba_id,datum,status_tip_id) values ($osoba_id,$ko_id,'now'::datetime,3)") if (! $debug); |
256 |
|
|
257 |
$max_osoba_id = $osoba_id if ($max_osoba_id < $osoba_id) ; |
$max_osoba_id = $osoba_id if ($max_osoba_id < $osoba_id) ; |
258 |
} |
} |