mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Added functionality to show when a devices was last provisioned (#1831)
* Added functionality to show when a devices was last provisioned Added functionality to show when a devices was last provisioned Need addition to database: v_devices table: device_provisioned_on -> datetime device_provisioned_by -> char(10) * Revert "Added functionality to show when a devices was last provisioned" This reverts commitc3e40d68fa. * Revert "Revert "Added functionality to show when a devices was last provisioned"" This reverts commit8c27a46565. * Changed field names as requested Changed field names as requested for last provisioned data * Added database fields for device provisoned functionality Added provisioned_date, provisioned_method, provisioned_ip * Added ability to search device provisioned info * Added ip tracking to device provisoned functionality Added ip tracking to device provisoned functionality and moved the code to before rendering to register the contact even on unseccessful render * Added IP address to status column
This commit is contained in:
@@ -363,6 +363,21 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "phone_description";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_provisioned_date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "device_provisioned_date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "datetime";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_provisioned_method";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "device_provisioned_method";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "device_provisioned_ip";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "device_provisioned_ip";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
|
||||
@@ -1414,6 +1414,16 @@ $text['label-device_description']['de-at'] = "Beschreibung";
|
||||
$text['label-device_description']['ar-eg'] = "";
|
||||
$text['label-device_description']['he'] = "תאור";
|
||||
|
||||
$text['label-device_status']['en-us'] = "Status";
|
||||
$text['label-device_status']['es-cl'] = "Estado";
|
||||
$text['label-device_status']['pt-pt'] = "Estado";
|
||||
$text['label-device_status']['fr-fr'] = "Statut";
|
||||
$text['label-device_status']['pt-br'] = "Estado";
|
||||
$text['label-device_status']['pl'] = "Status ";
|
||||
$text['label-device_status']['sv-se'] = "Status";
|
||||
$text['label-device_status']['uk'] = "Стан";
|
||||
$text['label-device_status']['de-at'] = "Status";
|
||||
|
||||
$text['label-device']['en-us'] = "Device";
|
||||
$text['label-device']['es-cl'] = "Dispositivo";
|
||||
$text['label-device']['pt-pt'] = "Dispositivo";
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
$sql .= " or d.device_enabled like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= " or d.device_provisioned_method like '%".$search."%' ";
|
||||
$sql .= " or d.device_provisioned_ip like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
@@ -139,6 +141,8 @@
|
||||
$sql .= " or d.device_enabled like '%".$search."%' ";
|
||||
$sql .= " or d.device_template like '%".$search."%' ";
|
||||
$sql .= " or d.device_description like '%".$search."%' ";
|
||||
$sql .= " or d.device_provisioned_method like '%".$search."%' ";
|
||||
$sql .= " or d.device_provisioned_ip like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by) == 0) {
|
||||
@@ -214,6 +218,7 @@
|
||||
echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order);
|
||||
echo th_order_by('device_template', $text['label-device_template'], $order_by, $order);
|
||||
echo th_order_by('device_enabled', $text['label-device_enabled'], $order_by, $order);
|
||||
echo th_order_by('device_status', $text['label-device_status'], $order_by, $order);
|
||||
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>\n";
|
||||
if (permission_exists('device_add')) {
|
||||
@@ -248,6 +253,7 @@
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_vendor']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_template']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_enabled']]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_provisioned_date']." - ".$row['device_provisioned_method']." - ".$row['device_provisioned_ip']." </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['device_description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('device_edit')) {
|
||||
|
||||
@@ -365,6 +365,22 @@ The file name is fixed to `Account1_Extern.xml`.
|
||||
}
|
||||
}
|
||||
|
||||
//register that we have seen the device
|
||||
$sql = "UPDATE v_devices ";
|
||||
$sql .= "SET device_provisioned_date=:date, device_provisioned_method=:method, device_provisioned_ip=:ip ";
|
||||
$sql .= "WHERE domain_uuid=:domain_uuid AND device_mac_address=:mac ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
//use the prepared statement
|
||||
$prep_statement->bindValue(':domain_uuid', $domain_uuid);
|
||||
$prep_statement->bindValue(':mac', strtolower($mac));
|
||||
$prep_statement->bindValue(':date', date("Y-m-d H:i:s"));
|
||||
$prep_statement->bindValue(':method', (isset($_SERVER["HTTPS"]) ? 'https' : 'http'));
|
||||
$prep_statement->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
|
||||
$prep_statement->execute();
|
||||
unset($prep_statement);
|
||||
}
|
||||
|
||||
//output template to string for header processing
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $domain_uuid;
|
||||
|
||||
Reference in New Issue
Block a user