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 commit c3e40d68fa.

* Revert "Revert "Added functionality to show when a devices was last provisioned""

This reverts commit 8c27a46565.

* 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:
minotaur01
2016-08-25 13:10:39 -04:00
committed by FusionPBX
parent 15a6d67a41
commit 0ab6b6ee00
4 changed files with 47 additions and 0 deletions

View File

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