CMXX - Remove FILETYPE FROM SW_VERSION
This commit is contained in:
@@ -232,6 +232,14 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
|
|||||||
$hw_version = $post_content['testdetails']['logdetails']['HW'];
|
$hw_version = $post_content['testdetails']['logdetails']['HW'];
|
||||||
$sw_version = $post_content['testdetails']['logdetails']['HEX_FW'];
|
$sw_version = $post_content['testdetails']['logdetails']['HEX_FW'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check SW_VERSION for filetype
|
||||||
|
$version_file_type = strtolower(substr($sw_version, -4)); // filetype
|
||||||
|
|
||||||
|
if ($version_file_type[0] == '.'){
|
||||||
|
$sw_version = substr($sw_version, 0, -4);
|
||||||
|
}
|
||||||
|
|
||||||
//Update Equipment record
|
//Update Equipment record
|
||||||
$sql = "UPDATE equipment SET hw_version = ?, sw_version = ? $whereclause";
|
$sql = "UPDATE equipment SET hw_version = ?, sw_version = ? $whereclause";
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|||||||
@@ -54,10 +54,30 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
|
|||||||
|
|
||||||
if ($command == 'insert'){
|
if ($command == 'insert'){
|
||||||
|
|
||||||
//USE PART OF FILENAME AS VERSION
|
if(isset($post_content['software'])){
|
||||||
if (($pos = strpos($post_content['software'], "_")) !== FALSE) {
|
//CHECK FOR FILETYPE
|
||||||
$version = substr($post_content['software'], $pos+1);
|
$version = $post_content['software'];
|
||||||
$version = substr($version, 0, -4); //remove filetype
|
$version_file_type = strtolower(substr($version, -4)); // filetype
|
||||||
|
|
||||||
|
//CHECK IF FILETYPE IS ADDED
|
||||||
|
if ($version_file_type[0] == '.'){
|
||||||
|
|
||||||
|
//BASED ON FILE TYPE DO THE FOLLOWING
|
||||||
|
switch ($version_file_type) {
|
||||||
|
case '.hex':
|
||||||
|
//USE FULL NAME EXCLUDING
|
||||||
|
$version = substr($version, 0, -4);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (($pos = strpos($version, "_")) !== FALSE) {
|
||||||
|
$version = substr($version, $pos+1);
|
||||||
|
$version = substr($version, 0, -4); //remove filetype
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//SET CORRECT VERSION
|
||||||
$post_content['version'] = $version;
|
$post_content['version'] = $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,14 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
|
|||||||
$hw_version = $post_content['payload']['logdetails']['HW'];
|
$hw_version = $post_content['payload']['logdetails']['HW'];
|
||||||
$sw_version = $post_content['payload']['logdetails']['HEX_FW'];
|
$sw_version = $post_content['payload']['logdetails']['HEX_FW'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check SW_VERSION for filetype
|
||||||
|
$version_file_type = strtolower(substr($sw_version, -4)); // filetype
|
||||||
|
|
||||||
|
if ($version_file_type[0] == '.'){
|
||||||
|
$sw_version = substr($sw_version, 0, -4);
|
||||||
|
}
|
||||||
|
|
||||||
//Update Equipment record
|
//Update Equipment record
|
||||||
$sql = "UPDATE equipment SET hw_version = ?, sw_version = ? $whereclause";
|
$sql = "UPDATE equipment SET hw_version = ?, sw_version = ? $whereclause";
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|||||||
@@ -54,6 +54,33 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
|
|||||||
|
|
||||||
if ($command == 'insert'){
|
if ($command == 'insert'){
|
||||||
|
|
||||||
|
if(isset($post_content['software'])){
|
||||||
|
//CHECK FOR FILETYPE
|
||||||
|
$version = $post_content['software'];
|
||||||
|
$version_file_type = strtolower(substr($version, -4)); // filetype
|
||||||
|
|
||||||
|
//CHECK IF FILETYPE IS ADDED
|
||||||
|
if ($version_file_type[0] == '.'){
|
||||||
|
|
||||||
|
//BASED ON FILE TYPE DO THE FOLLOWING
|
||||||
|
switch ($version_file_type) {
|
||||||
|
case '.hex':
|
||||||
|
//USE FULL NAME EXCLUDING
|
||||||
|
$version = substr($version, 0, -4);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (($pos = strpos($version, "_")) !== FALSE) {
|
||||||
|
$version = substr($version, $pos+1);
|
||||||
|
$version = substr($version, 0, -4); //remove filetype
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//SET CORRECT VERSION
|
||||||
|
$post_content['version'] = $version;
|
||||||
|
}
|
||||||
|
|
||||||
if (($pos = strpos($post_content['software'], "_")) !== FALSE) {
|
if (($pos = strpos($post_content['software'], "_")) !== FALSE) {
|
||||||
$version = substr($post_content['software'], $pos+1);
|
$version = substr($post_content['software'], $pos+1);
|
||||||
$version = substr($version, 0, -4); //remove filetype
|
$version = substr($version, 0, -4); //remove filetype
|
||||||
|
|||||||
Reference in New Issue
Block a user