Final update for overwriting ifAlias

This commit is contained in:
laf
2015-08-30 14:34:37 -07:00
parent 5f5788e90c
commit e4fd45037c
3 changed files with 15 additions and 3 deletions
+7 -2
View File
@@ -435,8 +435,13 @@ function get_dev_entity_state($device) {
return $state;
}
function get_dev_attrib($device, $attrib_type) {
if ($row = dbFetchRow("SELECT attrib_value FROM devices_attribs WHERE `device_id` = ? AND `attrib_type` = ?", array($device['device_id'], $attrib_type))) {
function get_dev_attrib($device, $attrib_type, $attrib_value='') {
$params = array($device['device_id'], $attrib_type);
if (!empty($attrib_value)) {
$sql = " AND `attrib_value`=?";
array_push($params, $attrib_value);
}
if ($row = dbFetchRow("SELECT attrib_value FROM devices_attribs WHERE `device_id` = ? AND `attrib_type` = ? $sql", $params)) {
return $row['attrib_value'];
}
else {