You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$request = $dbh->prepare('SELECT HARDWARE_ID FROM devices WHERE TVALUE=? AND NAME="IPDISCOVER"');
393
-
$request->execute($_->{IPSUBNET});
394
-
if($request->rows < $ENV{'OCS_OPT_IPDISCOVER'}){
395
-
$request->finish;
396
-
return$_->{IPSUBNET};
393
+
my$request_tag = $dbh->prepare('SELECT TAG FROM accountinfo WHERE HARDWARE_ID=?');
394
+
my$tag = undef;
395
+
396
+
unless($request_tag->execute($DeviceID)){
397
+
&_log(519,'ipdiscover','_ipdiscover_find_iface: ERROR cannot find tag on this machine') if$ENV{'OCS_OPT_LOGLEVEL'};
398
+
return(1);
399
+
}
400
+
401
+
my$row = $request_tag->fetchrow_hashref;
402
+
403
+
if (defined$row->{'TAG'}) {
404
+
&_log(519,'ipdiscover','_ipdiscover_find_iface: TAG DEFINED on machine id: '.$DeviceID.' subnet: '.$_->{IPSUBNET}.' MASK: '.$_->{IPMASK}) if$ENV{'OCS_OPT_LOGLEVEL'};
405
+
$tag = $row->{'TAG'};
406
+
$request = $dbh->prepare('SELECT devices.HARDWARE_ID FROM devices INNER JOIN accountinfo ON accountinfo.HARDWARE_ID = devices.HARDWARE_ID WHERE TVALUE=? AND accountinfo.TAG=? AND NAME="IPDISCOVER"');
407
+
$request->execute($_->{IPSUBNET},$tag);
408
+
}
409
+
else{
410
+
&_log(519,'ipdiscover','_ipdiscover_find_iface: NO TAG DEFINED on machine id: '.$DeviceID.' subnet: '.$_->{IPSUBNET}.' MASK: '.$_->{IPMASK}) if$ENV{'OCS_OPT_LOGLEVEL'};
411
+
$request = $dbh->prepare('SELECT HARDWARE_ID FROM devices WHERE TVALUE=? AND NAME="IPDISCOVER"');
412
+
$request->execute($_->{IPSUBNET});
413
+
}
414
+
415
+
&_log(519,'ipdiscover','_ipdiscover_find_iface: Nb machines elected on this network: '.$_->{IPSUBNET}.' ----> '.$request->rows.' machines') if$ENV{'OCS_OPT_LOGLEVEL'};
0 commit comments