Skip to content

Instantly share code, notes, and snippets.

@tpendragon
Last active December 14, 2015 19:39
Show Gist options
  • Save tpendragon/5138056 to your computer and use it in GitHub Desktop.
Save tpendragon/5138056 to your computer and use it in GitHub Desktop.
class DellInfo extends \SoapClient {
//const ADDR = 'http://xserv.dell.com/services/assetservice.asmx?WSDL';
const ADDR = 'http://143.166.84.118/services/assetservice.asmx?WSDL';
const GUID = 'F5EE89B0-5332-11E1-B47D-8E584824019B';
function __construct($options = array()) {
if (!isset($options['exceptions'])) {
$options['exceptions'] = false;
}
$options['features'] = SOAP_SINGLE_ELEMENT_ARRAYS;
parent::__construct(self::ADDR, $options);
}
function getInfo($tag) {
$args = array(
'guid' => self::GUID,
'applicationName' => 'GLPI',
'serviceTags' => $tag
);
$reponse = parent::__soapCall('GetAssetInformation', array($args));
//print_r($reponse);
if (is_soap_fault($reponse)) {
return NULL;
}
return (isset($reponse->GetAssetInformationResult) ? $reponse->GetAssetInformationResult : NULL);
}
}
private function getWarranty()
{
$DellInfo = new DellInfo();
$info = $DellInfo->getInfo($this->KSInfo["computerOEMSerial"]);
if($info && isset($info->Asset))
{
$MaxDays = 0;
foreach($info->Asset[0]->Entitlements->EntitlementData as $Entitlement)
{
if($Entitlement->DaysLeft > $MaxDays)
$MaxDays = $Entitlement->DaysLeft;
}
$this->KSInfo["warranty"] = $MaxDays;
$this->KSInfo["shipdate"] = date("n/d/Y",strtotime($info->Asset[0]->AssetHeaderData->SystemShipDate));
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment