CMXX - Remove FILETYPE FROM SW_VERSION
This commit is contained in:
@@ -54,10 +54,30 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
|
||||
|
||||
if ($command == 'insert'){
|
||||
|
||||
//USE PART OF FILENAME AS VERSION
|
||||
if (($pos = strpos($post_content['software'], "_")) !== FALSE) {
|
||||
$version = substr($post_content['software'], $pos+1);
|
||||
$version = substr($version, 0, -4); //remove filetype
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user