CMXX - Improved software_update
This commit is contained in:
@@ -29,25 +29,7 @@ if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} el
|
||||
//------------------------------------------
|
||||
//default whereclause
|
||||
//------------------------------------------
|
||||
$whereclause = '';
|
||||
|
||||
switch ($permission) {
|
||||
case '4':
|
||||
$whereclause = '';
|
||||
break;
|
||||
case '3':
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___%';
|
||||
$whereclause = 'WHERE e.accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
case '2':
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = 'WHERE e.accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
||||
$whereclause = 'WHERE e.accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
list($whereclause,$condition) = getWhereclause('equipment',$permission,$partner,'get');
|
||||
|
||||
//------------------------------------------
|
||||
//NEW ARRAY
|
||||
|
||||
@@ -42,39 +42,6 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
|
||||
|
||||
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) {
|
||||
$version = substr($post_content['software'], $pos+1);
|
||||
$version = substr($version, 0, -4); //remove filetype
|
||||
$post_content['version'] = $version;
|
||||
}
|
||||
|
||||
$post_content['latest'] = 1; //New software is always latest
|
||||
$post_content['created'] = $date;
|
||||
$post_content['createdby'] = $username;
|
||||
|
||||
Reference in New Issue
Block a user