CMXX - Software update servicekit
This commit is contained in:
@@ -2804,4 +2804,43 @@ function dateInRange($start_date, $end_date, $date_check)
|
||||
|
||||
// Check that user date is between start & end
|
||||
return (($check_ts >= $start_ts) && ($check_ts <= $end_ts));
|
||||
}
|
||||
|
||||
function getLatestVersion($productcode,$token){
|
||||
|
||||
//BUILD POST DATA
|
||||
$data = json_encode(array("productcode" => $productcode), JSON_UNESCAPED_UNICODE);
|
||||
//API call
|
||||
$responses = ioAPIv2('/v2/products_software', $data, $token);
|
||||
|
||||
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;}
|
||||
|
||||
//DEFAULT OUTPUT
|
||||
$output = array(
|
||||
"productcode" => "",
|
||||
"version"=> "",
|
||||
"mandatory"=> "",
|
||||
"latest"=> "",
|
||||
"software"=> "",
|
||||
"source" => "",
|
||||
"source_type" => "",
|
||||
);
|
||||
|
||||
if(!empty($responses)) {
|
||||
foreach ($responses as $message){
|
||||
if ($message['latest'] == 1){
|
||||
$output = array(
|
||||
"productcode" => $message['productcode'],
|
||||
"version"=> $message['version'],
|
||||
"mandatory"=> $message['mandatory'],
|
||||
"latest"=> $message['latest'],
|
||||
"software"=> $message['software'],
|
||||
"source" => "",
|
||||
"source_type" => ""
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
Reference in New Issue
Block a user