select('CompanyId, OrderDateTime') ->from('commande') ->where('CompanyId = "'. $_GET['company'].'"') ->andWhere('Login ="'.$_SESSION['tabInfo']['login'].'"') ->andWhere('DataSetType="'.$_GET['type'].'"') ->andWhere('TO_DAYS(NOW())') ->fetchOne(); $InternalOrderId = $OrderExists->InternalOrderId; $dateTime = new DateTime(); $dateTimeBDD = new DateTime($rapportExists->DateTimeSave); $daysOfRapport = $dateTime->diff($dateTimeBDD); if (isset($OrderExists->CompanyId)) { $DateHeure = explode(' ', $OrderExists->OrderDateTime); $date = explode('-', $DateHeure[0]); } if (!isset($OrderExists->CompanyId)) { /** * Le SetLog * @var unknown_type */ $soap_client = getClient($_GET['pays'], 'OrderDataSet', SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS); $OrderDataSet = new CreditDataPortType(); $params = $OrderDataSet->OrderDataSet(); $params->OrderDataSet->CompanyId = $_GET['company']; $params->OrderDataSet->DataSetType = new stdClass(); $params->OrderDataSet->DataSetType->_ = $_GET['type']; $params->OrderDataSet->LanguageCode = $_GET['lang']; $params->OrderDataSet->DataSetVersion = "1.0"; $informations = SwitchWSDLFunction('OrderDataSet', $params->OrderDataSet, $soap_client); $request = new commande(); $request->Login = $_SESSION['tabInfo']['login']; $request->Ip = $_SESSION['tabInfo']['ip']; $request->ProviderOrderId = $informations->Order->ProviderOrderId; $request->InternalOrderId = $informations->Order->InternalOrderId; $request->ConsumerId = $informations->Order->ConsumerId; $request->CompanyName = $_GET['name']; $request->CompanyCountry = $_GET['country']; $request->ProviderId = $informations->Order->ProviderId; $request->CountryCode = $informations->Order->CountryCode; $request->CompanyId = $_GET['company']; //$request->OrderDateTime = time(); $request->DataSetType = $informations->Order->DataSetType->_; $request->save(); $InternalOrderId = $informations->Order->InternalOrderId; } $rapportExists = Doctrine_Query::create() ->select('CompanyId, UrlObjectRapportFile, DateTimeSave') ->from('rapport') ->where('CompanyId = "'. $_GET['company'].'"') ->andWhere('DataSetType = "'. $_GET['type'].'"') ->fetchOne(); if (!isset($rapportExists->CompanyId) or (!file_exists(PATH_DATA.$rapportExists->UrlObjectRapportFile))) { $nameFileRapport = 'rapport-'.$_GET['company'].'-'.date('Ymd').'-'.$_GET['pays'].'-'.$_GET['type']; $soap_client2 = getClient($_GET['pays'], 'RetrieveDataSet', SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS); $RetrieveDataSet = new CreditDataPortType(); $params = $RetrieveDataSet->RetrieveDataSet(); $params->RetrieveDataSet->InternalOrderId = $InternalOrderId; $rapport = SwitchWSDLFunction('RetrieveDataSet', $params->RetrieveDataSet, $soap_client2); $directory = _ifDirectoryExist('/giant/'.$_GET['company'].'/'); $saveRapport = new rapport(); $saveRapport->CompanyId = $_GET['company']; $saveRapport->DataSetType = $_GET['type']; $saveRapport->UrlObjectRapportFile = $directory.$nameFileRapport; (file_put_contents(PATH_DATA.$directory.$nameFileRapport, serialize($rapport->DataSet))) ? $saveRapport->Delivred = true : $saveRapport->Delivred = EXIT_FAILURE; $saveRapport->DateTimeSave = date('Y-m-d'); $saveRapport->save(); $rapport = $rapport->DataSet; } else { ($rapport = unserialize(file_get_contents(PATH_DATA.$rapportExists->UrlObjectRapportFile))) ? true : EXIT_FAILURE; } ?>