Travail complet sur le code graydon
This commit is contained in:
parent
e287fd9bab
commit
c11a0f7964
32
includes/graydon/graydon.php
Normal file
32
includes/graydon/graydon.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
User profile: SESS38R7
|
||||
Customer no.: 32790
|
||||
Password : E88MSU4
|
||||
https://www.webservices.graydon.co.uk
|
||||
*/
|
||||
|
||||
ini_set('soap.wsdl_cache_enabled', 0);
|
||||
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_config.php';
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_log.php';
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_error.php';
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_functions.php';
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_format.php';
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_wsfunctions.php';
|
||||
require_once realpath(dirname(__FILE__)).'/pays.php';
|
||||
|
||||
//$options = array('trace' => 1);
|
||||
//$options = array('trace' => 1, 'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
$options = array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
// Create a soap client
|
||||
$graydon = new SoapClient(GRAYDON_WSDL, $options);
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = USER_PROFILE;
|
||||
$authentication->PartnerPassword = PASSWORD;
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
?>
|
17
includes/graydon/graydon_config.php
Normal file
17
includes/graydon/graydon_config.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
//Authentification
|
||||
//define('GRAYDON_WSDL' ,'https://www.webservices.graydon.co.uk/CompanyData_webservice/services/SOAPPort/wsdl/GraydonCompanyData.wsdl');
|
||||
define('GRAYDON_WSDL', realpath(dirname(__FILE__)).'/GraydonCompanyData.wsdl');
|
||||
define('USER_PROFILE','SESS38R7');
|
||||
define('PASSWORD','E88MSU4');
|
||||
|
||||
//Delai de mise à jour des informations
|
||||
define('UPDATE_MATCHIDENTIFIERS' , 0);
|
||||
define('UPDATE_PRODUCTS' , 0);
|
||||
define('UPDATE_COUNTRYAVAILABILITY' , 0);
|
||||
define('UPDATE_MATCHMETHODS' , 0);
|
||||
define('UPDATE_IDENTITE' , 0);
|
||||
define('UPDATE_REPORT' , 0);
|
||||
|
||||
|
121
includes/graydon/graydon_functions.php
Normal file
121
includes/graydon/graydon_functions.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Fonctions utiles pour l'utilisation du webservice graydon
|
||||
*
|
||||
*/
|
||||
|
||||
function parseReport($type){
|
||||
$doc = new DOMDocument;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadxml($xml);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parcours le contenu du rapport en XML
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
function parseReportXML($xml)
|
||||
{
|
||||
require_once realpath(dirname(__FILE__)).'/graydon_xml.php';
|
||||
global $firephp;
|
||||
$tabReport = array();
|
||||
global $xpath;
|
||||
$query = '/GraydonUKCompanySchema/CompanyReportPage/CompanyReport';
|
||||
$report = $xpath->query($query);
|
||||
|
||||
//Liste des elements à parser
|
||||
$elements = array( 'Company', 'Name', 'Address', 'Communication', 'Country', 'Credit_Rating',
|
||||
'Date', 'DirectorsDetail', 'Employees', 'Financial_Summary', 'Legal_Form',
|
||||
'Share_CapitalSummary', 'Taxonomy', 'FreeText', 'AccountItem'
|
||||
);
|
||||
foreach($elements as $elementName){
|
||||
//Pour chaque element, nouvelle requete xpath
|
||||
$queryElement = $query.'/'.$elementName;
|
||||
switch($elementName){
|
||||
case "Company" :
|
||||
$tabReport['Company'] = pxmlCompany($queryElement);
|
||||
break;
|
||||
case "Name" :
|
||||
$name = pxmlName($queryElement);
|
||||
if ($name) $tabReport['Name'] = $name;
|
||||
break;
|
||||
case "Address" :
|
||||
$tabReport['Address'] = pxmlAddress($queryElement);
|
||||
break;
|
||||
case "Communication":
|
||||
$tabReport['Communication'] = pxmlCommunication($queryElement);
|
||||
break;
|
||||
case "Country" :
|
||||
$country = pxmlCountry($queryElement);
|
||||
if($country) $tabReport['Country'] = $country;
|
||||
break;
|
||||
case "Credit_Rating" :
|
||||
$creditRating = pxmlCreditRating($queryElement);
|
||||
if($creditRating) $tabReport['CreditRating'] = $creditRating;
|
||||
break;
|
||||
case "Date" :
|
||||
$tabReport['Date'] = pxmlDate($queryElement);
|
||||
break;
|
||||
case "DirectorsDetail" :
|
||||
$directorsdetail = pxmlDirectorsDetail($queryElement);
|
||||
if($directorsdetail){ $tabReport['DirectorsDetail'] = $directorsdetail; }
|
||||
break;
|
||||
case "Employees" :
|
||||
$employees = pxmlEmployees($queryElement);
|
||||
if($employees) $tabReport['Employees'] = $employees;
|
||||
break;
|
||||
case "Financial_Summary" :
|
||||
$financialsummary = pxmlFinancialSummary($queryElement);
|
||||
if($financialsummary) $tabReport['FinancialSummary'] = $financialsummary;
|
||||
break;
|
||||
case "Legal_Form" :
|
||||
$legalform = pxmlLegalForm($queryElement);
|
||||
if($legalform) $tabReport['LegalForm'] = $legalform;
|
||||
break;
|
||||
case "Share_CapitalSummary";
|
||||
$sharecapitalsummary = pxmlShareCapitalSummary($queryElement);
|
||||
if($sharecapitalsummary) $tabReport['ShareCapitalSummary'] = $sharecapitalsummary;
|
||||
break;
|
||||
case "Taxonomy" :
|
||||
$taxonomy = pxmlTaxonomy($queryElement);
|
||||
if($taxonomy) $tabReport['Taxonomy'] = $taxonomy;
|
||||
break;
|
||||
case "FreeText" :
|
||||
$freetext = pxmlFreeText($queryElement);
|
||||
if($freetext) $tabReport['Text'] = $freetext;
|
||||
break;
|
||||
case "AccountItem";
|
||||
$AccountItem = pxmlAccountItem($queryElement);
|
||||
if($AccountItem) $tabReport['AccountItem'] = $AccountItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $tabReport;
|
||||
}
|
||||
|
||||
function parseReportHTML()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function parseReportDOC()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function reportFormat()
|
||||
{
|
||||
return array('xml', 'html');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
1
includes/graydon/graydon_html.php
Normal file
1
includes/graydon/graydon_html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
@ -6,7 +6,8 @@
|
||||
* @return string
|
||||
* .
|
||||
*/
|
||||
function getCompanyMatchIdentifiers($pays){
|
||||
function getCompanyMatchIdentifiers($pays)
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
$firephp->info('Méthode getCompanyMatchIdentifiers');
|
||||
@ -20,7 +21,8 @@ function getCompanyMatchIdentifiers($pays){
|
||||
$matchidentifiers = $q->fetchOne();
|
||||
|
||||
/** Recup des types d'identifiants pour le pays **/
|
||||
if($matchidentifiers == FALSE){
|
||||
if($matchidentifiers == FALSE)
|
||||
{
|
||||
//Récupération des intitulés identifiant
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
@ -42,12 +44,9 @@ function getCompanyMatchIdentifiers($pays){
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
$count = count($result->CompanyMatchIdentifiers);
|
||||
if ($count>1){
|
||||
$tabIdentifiers = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
||||
}elseif($count==1){
|
||||
$tabIdentifiers[] = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
||||
}
|
||||
|
||||
$tabIdentifiers = $result->CompanyMatchIdentifiers->CompanyMatchIdentifier->CompanyIdentifier;
|
||||
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchidentifiers = new Matchidentifiers();
|
||||
$matchidentifiers->country = $pays;
|
||||
@ -79,8 +78,8 @@ function getCompanyMatchIdentifiers($pays){
|
||||
return $tabIdentifiers;
|
||||
}
|
||||
|
||||
|
||||
function getCompanyProducts($identifier){
|
||||
function getCompanyProducts($identifier)
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
@ -144,7 +143,8 @@ function getCompanyProducts($identifier){
|
||||
}
|
||||
|
||||
|
||||
function getCompanyMatches($pays){
|
||||
function getCompanyMatches($pays)
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
// Create the request parameters
|
||||
@ -279,7 +279,8 @@ function getCompanyMatches($pays){
|
||||
}
|
||||
|
||||
|
||||
function getCountryAvailability($pays){
|
||||
function getCountryAvailability($pays)
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
@ -312,12 +313,7 @@ function getCountryAvailability($pays){
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
$count = count($result->CountryAvailablity->CountryAndProduct->Products->Product);
|
||||
if ($count>1){
|
||||
$availability = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||
}elseif($count==1){
|
||||
$availability[] = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||
}
|
||||
$availability = $result->CountryAvailablity->CountryAndProduct->Products->Product;
|
||||
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$countryavailability = new Countryavailability();
|
||||
@ -343,7 +339,8 @@ function getCountryAvailability($pays){
|
||||
}
|
||||
|
||||
|
||||
function getCompanyMatchMethods($pays){
|
||||
function getCompanyMatchMethods($pays)
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication;
|
||||
|
||||
setDbConn('graydon');
|
||||
@ -376,12 +373,9 @@ function getCompanyMatchMethods($pays){
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
$count = count($result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod);
|
||||
if ($count>1){
|
||||
$methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||
}elseif($count==1){
|
||||
$methods[] = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||
}
|
||||
|
||||
$methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod;
|
||||
|
||||
//Stockage du résultat de la méthode en cache
|
||||
$matchmethods = new Matchmethods();
|
||||
$matchmethods->country = $pays;
|
||||
@ -413,7 +407,8 @@ function getCompanyMatchMethods($pays){
|
||||
}
|
||||
|
||||
|
||||
function getIdentite($CompanyProductIdentifier, $file){
|
||||
function getIdentite($identifier, $CompanyProductIdentifier, $file, $format = 'xml')
|
||||
{
|
||||
global $page, $mode, $firephp, $graydon, $authentication, $pays;
|
||||
|
||||
$request = new StdClass();
|
||||
@ -441,6 +436,7 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
$firephp->log($pays,'pays');
|
||||
|
||||
//Optention du prix du service
|
||||
$prix = Doctrine_Query::create()
|
||||
->select('p.immediate')
|
||||
@ -448,20 +444,12 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
->leftJoin('p.Country c')
|
||||
->where('c.graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
$firephp->log($prix,'prix');
|
||||
|
||||
$q = Doctrine_Query::create()
|
||||
->select('p.immediate')
|
||||
->from('Price p')
|
||||
->leftJoin('p.Country c')
|
||||
->where('c.graydon_country = ?', $pays);
|
||||
$firephp->log($q->getSql(),'SQL');
|
||||
|
||||
//Obtention du libelle pays Graydon
|
||||
$country = Doctrine_Query::create()
|
||||
->from('Country')
|
||||
->where('graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
$firephp->log($country,'pays');
|
||||
|
||||
//Enregistrement des commandes dans la bdd
|
||||
$commandes = new Commandes();
|
||||
@ -480,7 +468,7 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
$commandes->Country = $country;
|
||||
$commandes->save();
|
||||
|
||||
$mailcommandes = $commandes->toArray();
|
||||
$mailcommandes = $commandes->toString();
|
||||
$firephp->log($mailcommandes,'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
@ -495,7 +483,7 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "[International] - (Date :".date("d")."/".date("m")."/".date("Y").") - Commandes";
|
||||
$body = "Commande effectué par ".$_SESSION['tabInfo']['login']."\n";
|
||||
$body .= print_r($mailcommandes);
|
||||
$body .= $mailcommandes;
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
@ -515,18 +503,17 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
}
|
||||
|
||||
//On vérifie l'état de le demande
|
||||
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
|
||||
|
||||
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed')
|
||||
{
|
||||
$request = new StdClass();
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->LanguageCode = 'E'; //Spécifier la langue du rapport
|
||||
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$request->MimeType = 'xml';
|
||||
|
||||
$request->MimeType = $format;
|
||||
try
|
||||
{
|
||||
$reportResult = $graydon->getCompanyReport($request);
|
||||
|
||||
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $reportResult->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $reportResult->Service_Log->SessionID;
|
||||
@ -541,23 +528,25 @@ function getIdentite($CompanyProductIdentifier, $file){
|
||||
$log->sessionID = $sessionID;
|
||||
$log->mode = $mode;
|
||||
$log->save();
|
||||
|
||||
|
||||
//Suivant le format, on recupere le bon objet
|
||||
$firephp->log($reportResult,'reportResult');
|
||||
$xml = $reportResult->ReportXML->any;
|
||||
|
||||
//Enregistrement du fichier xml
|
||||
file_put_contents($file, $xml);
|
||||
if($format == 'xml') $content = $reportResult->ReportXML->any;
|
||||
if($format == 'html') $content = $reportResult->ReportText;
|
||||
|
||||
//Enregistrement du contenu dans un fichier
|
||||
file_put_contents($file, $content);
|
||||
|
||||
//Mise en cache dans la bdd
|
||||
$report = new Report();
|
||||
$report->identifier = $identifier;
|
||||
$report->name = $_SESSION['graydon']['name'];
|
||||
$report->content = $xml;
|
||||
$report->format = 'xml';
|
||||
$report->content = $content;
|
||||
$report->format = $format;
|
||||
$report->order_id = $commandes_id;
|
||||
$report->save();
|
||||
|
||||
return $xml;
|
||||
return $content;
|
||||
|
||||
}catch( SoapFault $fault ){
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
@ -1,97 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Fonctions utiles pour l'utilisation du webservice graydon
|
||||
*
|
||||
*/
|
||||
|
||||
function parseReport($type){
|
||||
$doc = new DOMDocument;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadxml($xml);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parcours le contenu du rapport en XML
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
function parseReportXML($xml){
|
||||
global $firephp;
|
||||
$tabReport = array();
|
||||
global $xpath;
|
||||
$query = '/GraydonUKCompanySchema/CompanyReportPage/CompanyReport';
|
||||
$report = $xpath->query($query);
|
||||
|
||||
//Liste des elements à parser
|
||||
$elements = array( 'Company', 'Name', 'Address', 'Communication', 'Country', 'Credit_Rating',
|
||||
'Date', 'DirectorsDetail', 'Employees', 'Financial_Summary', 'Legal_Form',
|
||||
'Share_CapitalSummary', 'Taxonomy', 'FreeText', 'AccountItem'
|
||||
);
|
||||
foreach($elements as $elementName){
|
||||
//Pour chaque element, nouvelle requete xpath
|
||||
$queryElement = $query.'/'.$elementName;
|
||||
switch($elementName){
|
||||
case "Company" :
|
||||
$tabReport['Company'] = pxmlCompany($queryElement);
|
||||
break;
|
||||
case "Name" :
|
||||
$name = pxmlName($queryElement);
|
||||
if ($name) $tabReport['Name'] = $name;
|
||||
break;
|
||||
case "Address" :
|
||||
$tabReport['Address'] = pxmlAddress($queryElement);
|
||||
break;
|
||||
case "Communication":
|
||||
$tabReport['Communication'] = pxmlCommunication($queryElement);
|
||||
break;
|
||||
case "Country" :
|
||||
$country = pxmlCountry($queryElement);
|
||||
if($country) $tabReport['Country'] = $country;
|
||||
break;
|
||||
case "Credit_Rating" :
|
||||
$creditRating = pxmlCreditRating($queryElement);
|
||||
if($creditRating) $tabReport['CreditRating'] = $creditRating;
|
||||
break;
|
||||
case "Date" :
|
||||
$tabReport['Date'] = pxmlDate($queryElement);
|
||||
break;
|
||||
case "DirectorsDetail" :
|
||||
$directorsdetail = pxmlDirectorsDetail($queryElement);
|
||||
if($directorsdetail){ $tabReport['DirectorsDetail'] = $directorsdetail; }
|
||||
break;
|
||||
case "Employees" :
|
||||
$employees = pxmlEmployees($queryElement);
|
||||
if($employees) $tabReport['Employees'] = $employees;
|
||||
break;
|
||||
case "Financial_Summary" :
|
||||
$financialsummary = pxmlFinancialSummary($queryElement);
|
||||
if($financialsummary) $tabReport['FinancialSummary'] = $financialsummary;
|
||||
break;
|
||||
case "Legal_Form" :
|
||||
$legalform = pxmlLegalForm($queryElement);
|
||||
if($legalform) $tabReport['LegalForm'] = $legalform;
|
||||
break;
|
||||
case "Share_CapitalSummary";
|
||||
$sharecapitalsummary = pxmlShareCapitalSummary($queryElement);
|
||||
if($sharecapitalsummary) $tabReport['ShareCapitalSummary'] = $sharecapitalsummary;
|
||||
break;
|
||||
case "Taxonomy" :
|
||||
$taxonomy = pxmlTaxonomy($queryElement);
|
||||
if($taxonomy) $tabReport['Taxonomy'] = $taxonomy;
|
||||
break;
|
||||
case "FreeText" :
|
||||
$freetext = pxmlFreeText($queryElement);
|
||||
if($freetext) $tabReport['Text'] = $freetext;
|
||||
break;
|
||||
case "AccountItem";
|
||||
$AccountItem = pxmlAccountItem($queryElement);
|
||||
if($AccountItem) $tabReport['AccountItem'] = $AccountItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $tabReport;
|
||||
}
|
||||
|
||||
function pxmlCompany($query){
|
||||
global $xpath;
|
||||
@ -586,15 +493,4 @@ function pxmlAmount($query){
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function parseReportHTML(){}
|
||||
|
||||
function parseReportDOC(){}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
User profile: SESS38R7
|
||||
Customer no.: 32790
|
||||
Password : E88MSU4
|
||||
|
||||
https://www.webservices.graydon.co.uk
|
||||
*/
|
||||
|
||||
ini_set('soap.wsdl_cache_enabled', 0);
|
||||
//define('GRAYDON_WSDL' ,'https://www.webservices.graydon.co.uk/CompanyData_webservice/services/SOAPPort/wsdl/GraydonCompanyData.wsdl');
|
||||
define('GRAYDON_WSDL', realpath(dirname(__FILE__)).'/GraydonCompanyData.wsdl');
|
||||
define('USER_PROFILE','SESS38R7');
|
||||
define('PASSWORD','E88MSU4');
|
||||
|
||||
require_once realpath(dirname(__FILE__)).'/wsfunctions.php';
|
||||
|
||||
$options = array('trace' => 1);
|
||||
//$options = array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
// SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS
|
||||
// Create a soap client
|
||||
$graydon = new SoapClient(GRAYDON_WSDL, $options);
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = USER_PROFILE;
|
||||
$authentication->PartnerPassword = PASSWORD;
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
?>
|
@ -12,8 +12,7 @@ $tabInfo = $_SESSION['tabInfo'];
|
||||
$mode = $_SESSION['graydon']['mode'];
|
||||
|
||||
require_once 'dbbootstrap.php';
|
||||
require_once 'graydon/graydonws.php';
|
||||
require_once 'graydon/graydon_log.php';
|
||||
require_once 'graydon/graydon.php';
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::Create()
|
||||
|
@ -8,9 +8,7 @@ $pays = $_SESSION['graydon']['pays'];
|
||||
$mode = $_SESSION['graydon']['mode'];
|
||||
|
||||
require_once 'i18n/cleanchar.php';
|
||||
require_once 'graydon/graydonws.php';
|
||||
require_once 'graydon/pays.php';
|
||||
require_once 'graydon/graydon_log.php';
|
||||
require_once 'graydon/graydon.php';
|
||||
require_once 'dbbootstrap.php';
|
||||
|
||||
$tabIdentifiers = getCompanyMatchIdentifiers($pays);
|
||||
@ -21,7 +19,8 @@ $Companyproducts = getCompanyProducts($identifier);
|
||||
$company = $Companyproducts['Company'];
|
||||
$products = $Companyproducts['Products'];
|
||||
|
||||
if(isset($company)){
|
||||
if(isset($company))
|
||||
{
|
||||
$firephp->log($products,'products');
|
||||
|
||||
?>
|
||||
@ -34,35 +33,34 @@ if(isset($company)){
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Fiche identité simplifié<br/></td>
|
||||
<td>
|
||||
<?php
|
||||
$count = count($products);
|
||||
if($count==1){
|
||||
$products[] = $products;
|
||||
}
|
||||
$noReport = TRUE;
|
||||
?>
|
||||
<?php $noReport = TRUE; ?>
|
||||
<u><b>Accès à la fiche identité approfondie :</b></u>
|
||||
<?php
|
||||
$tabReport = array();
|
||||
$tabProductIdentifier = array();
|
||||
$countProducts = 0;
|
||||
foreach($products as $product){
|
||||
foreach($products as $product)
|
||||
{
|
||||
//Rapport en mode normal
|
||||
if ($product->ServiceSpeed == 'Normal' && $product->Type == 'Investigation' && $product->Level == 4 ){
|
||||
if ($product->ServiceSpeed == 'Normal' && $product->Type == 'Investigation' && $product->Level == 4 )
|
||||
{
|
||||
$tabReport[$countProducts] = 'Normal';
|
||||
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
|
||||
$tabProducts[$countProducts]['DaysFrom'] = $product->DaysFrom;
|
||||
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
|
||||
$countProducts++;
|
||||
}
|
||||
|
||||
//Rapport en mode Superflash
|
||||
if ($product->ServiceSpeed == 'Superflash' && $product->Type == 'Investigation' && $product->Level == 4 ){
|
||||
if ($product->ServiceSpeed == 'Superflash' && $product->Type == 'Investigation' && $product->Level == 4 )
|
||||
{
|
||||
$tabReport[] = 'Superflash';
|
||||
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
|
||||
$tabProducts[$countProducts]['DaysFrom'] = $product->DaysFrom;
|
||||
$tabProducts[$countProducts]['DaysTo'] = $product->DaysTo;
|
||||
$countProducts++;
|
||||
}
|
||||
|
||||
//Rapport disponible avec mise à jour
|
||||
if ($product->ServiceSpeed == 'ImmediateWithUpdate' && $product->Type == 'Database' && $product->Level == 3 ){
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
@ -94,30 +92,25 @@ if(isset($company)){
|
||||
$countProducts++;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
//Rapport disponible en ligne
|
||||
if ($product->ServiceSpeed == 'Immediate' && $product->Type == 'Database' && $product->Level == 3 ){
|
||||
if ($product->ServiceSpeed == 'Immediate' && $product->Type == 'Database' && $product->Level == 3 )
|
||||
{
|
||||
$mimetype = FALSE;
|
||||
if (is_array($product->MimeTypes->MimeType)){
|
||||
if (in_array('xml', $product->MimeTypes->MimeType)){$mimetype = TRUE;}
|
||||
else {
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
$mail->FromName = "Serveur SD-13408";
|
||||
$mail->Host = "mail.scores-decisions.com";
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->Subject = "Rapport International";
|
||||
$body = "Rapport international disponible dans un autre format que le XML\n";
|
||||
$body .= "Identifiant : ".$identifier."";
|
||||
$mail->MsgHTML($body);
|
||||
$mail->AddAddress(EMAIL_SUPPORTDEV, "Support");
|
||||
$mail->Send();
|
||||
|
||||
if (!is_array($product->MimeTypes->MimeType)){ $productMimeTypes = array($product->MimeTypes->MimeType); }
|
||||
else{ $productMimeTypes = $product->MimeTypes->MimeType; }
|
||||
|
||||
foreach( reportFormat() as $format )
|
||||
{
|
||||
if (in_array($format, $product->MimeTypes->MimeType))
|
||||
{
|
||||
$mimetype = TRUE;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if ($product->MimeTypes->MimeType == 'xml' ){$mimetype = TRUE;}
|
||||
else {
|
||||
else
|
||||
{
|
||||
require_once 'phpmailer/class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
$mail->From = "contact@scores-decisions.com";
|
||||
@ -132,17 +125,20 @@ if(isset($company)){
|
||||
$mail->Send();
|
||||
}
|
||||
}
|
||||
if ($mimetype == TRUE ){
|
||||
if ($mimetype == TRUE )
|
||||
{
|
||||
$tabReport[] = 'Immediate';
|
||||
$tabProducts[$countProducts]['identifier'] = $product->CompanyProductIdentifier;
|
||||
$tabProducts[$countProducts]['format'] = $format;
|
||||
$countProducts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Fin boucle d'affichage des produits
|
||||
|
||||
$firephp->log($tabProducts,'tabProducts');
|
||||
|
||||
if(count($tabReport)==0){
|
||||
if(count($tabReport)==0)
|
||||
{
|
||||
?>
|
||||
(Aucun rapport disponible pour cette société)
|
||||
<?php
|
||||
@ -160,7 +156,8 @@ if(isset($company)){
|
||||
$firephp->log($tabPaysPrix, 'tableau');
|
||||
|
||||
$href = array();
|
||||
if(in_array('Normal',$tabReport)){
|
||||
if(in_array('Normal',$tabReport))
|
||||
{
|
||||
$key = array_search('Normal', $tabReport);
|
||||
$pidentifier = $tabProducts[$key]['identifier'];
|
||||
$daysFrom = $tabProducts[$key]['DaysFrom'];
|
||||
@ -187,7 +184,8 @@ if(isset($company)){
|
||||
}
|
||||
|
||||
//Affichage des différents rapports dans l'ordre
|
||||
if(in_array('Superflash',$tabReport)){
|
||||
if(in_array('Superflash',$tabReport))
|
||||
{
|
||||
$key = array_search('Superflash', $tabReport);
|
||||
$pidentifier = $tabProducts[$key]['identifier'];
|
||||
$daysFrom = $tabProducts[$key]['DaysFrom'];
|
||||
@ -205,7 +203,6 @@ if(isset($company)){
|
||||
print '<br/><br/><a href="#" title="Vous n\'avez pas les droits nécessaires pour commander un rapport international">Commander le rapport en mode rapide</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' €)</i>';
|
||||
}else{
|
||||
print '<br/><br/><a href="'.$href['superflash'].'">Commander le rapport en mode rapide</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' €)</i>';
|
||||
//print '<br/><br/><a href="#" title="Fonctionnalités désactivées">Commander le rapport en mode rapide</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['superflash'].' €)</i>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -213,19 +210,22 @@ if(isset($company)){
|
||||
print '<br/><br/><a href="#" title="Type de commande indisponible">Rapport immédiat indisponible</a><br/><i>(Délais : '.$daysFrom.' à '.$daysTo.' Jours, Tarif : '.$tabPaysPrix[0]['normal'].' €)</i>';
|
||||
}
|
||||
|
||||
if(in_array('Immediate',$tabReport)){
|
||||
if(in_array('Immediate',$tabReport))
|
||||
{
|
||||
$key = array_search('Immediate', $tabReport);
|
||||
$pidentifier = $tabProducts[$key]['identifier'];
|
||||
isset($tabProducts[$key]['format'])? $format = $tabProducts[$key]['format'] : $format = '';
|
||||
//Vérification des droits
|
||||
if(preg_match('/international/i', $_SESSION['tabInfo']['droits'])){
|
||||
$href['immediate'] = './?page=international_identitec&identifier='.$identifier.'&pidentifier='.$pidentifier;
|
||||
if( !empty($format) ) { $href['immediate'].= '&format=xml'; }
|
||||
}else{
|
||||
$href['immediate'] = '#';
|
||||
}
|
||||
}
|
||||
if(isset($href['immediate']))
|
||||
{
|
||||
if($href['normal']=='#'){
|
||||
if($href['immediate']=='#'){
|
||||
print '<br/><br/><a href="#" title="Vous n\'avez pas les droits nécessaires pour commander un rapport international">Consutler le rapport disponible</a><br/><i>(Délais : Immédiat, Tarif : '.$tabPaysPrix[0]['immediate'].' €)</i>';
|
||||
}else{
|
||||
print '<br/><br/><a href="'.$href['immediate'].'">Consutler le rapport disponible</a><br/><i>(Délais : Immédiat, Tarif : '.$tabPaysPrix[0]['immediate'].' €)</i>';
|
||||
@ -244,12 +244,7 @@ if(isset($company)){
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
$count = count($company->CompanyIdentifiers->CompanyIdentifier);
|
||||
if ($count>1){
|
||||
$identifiers = $company->CompanyIdentifiers->CompanyIdentifier;
|
||||
}elseif($count==1){
|
||||
$identifiers[] = $company->CompanyIdentifiers->CompanyIdentifier;
|
||||
}
|
||||
$identifiers = $company->CompanyIdentifiers->CompanyIdentifier;
|
||||
foreach($identifiers as $identifier){
|
||||
if($identifier->Type != 'Internal'){
|
||||
?>
|
||||
@ -273,7 +268,7 @@ if(isset($company)){
|
||||
?>
|
||||
</td>
|
||||
<td width="350" class="StyleInfoData">
|
||||
<?php print "1".$identifier->Identifier; ?></td>
|
||||
<?php print $identifier->Identifier; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
@ -305,13 +300,13 @@ if(isset($company)){
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Adresse Complète</td>
|
||||
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->RegisteredAddress->EntireAddress); ?></td>
|
||||
<td width="350" class="StyleInfoData"><?=cleanutf8($company->RegisteredAddress->EntireAddress); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Adresse</td>
|
||||
<td width="350" class="StyleInfoData"><?php print cleanutf8($company->RegisteredAddress->Building.', '.$company->RegisteredAddress->Street); ?></td>
|
||||
<td width="350" class="StyleInfoData"><?=cleanutf8($company->RegisteredAddress->Building.', '.$company->RegisteredAddress->Street); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@ -354,14 +349,10 @@ if(isset($company)){
|
||||
|
||||
<table>
|
||||
<?php
|
||||
$count = count($company->Activites->Activity);
|
||||
if ($count>1){
|
||||
$activites = $company->Activites->Activity;
|
||||
}elseif($count==1){
|
||||
$activites[] = $company->Activites->Activity;
|
||||
}
|
||||
if ($count>0){
|
||||
foreach($activites as $activity){
|
||||
if (count($company->Activites)>0)
|
||||
{
|
||||
foreach($company->Activites as $activity)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
|
@ -5,12 +5,16 @@ $tabInfo = $_SESSION['tabInfo'];
|
||||
|
||||
$identifier = $_REQUEST['identifier'];
|
||||
$CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
||||
isset($_REQUEST['format']) ? $format = $_REQUEST['format'] : $format = 'xml';
|
||||
|
||||
$firephp->log($identifier, 'identifier');
|
||||
$firephp->log($CompanyProductIdentifier, 'CompanyProductIdentifier');
|
||||
|
||||
$pays = $_SESSION['graydon']['pays'];
|
||||
$mode = $_SESSION['graydon']['mode'];
|
||||
|
||||
require_once 'i18n/cleanchar.php';
|
||||
require_once 'graydon/graydonws.php';
|
||||
require_once 'graydon/graydon_log.php';
|
||||
require_once 'graydon/graydon.php';
|
||||
require_once 'dbbootstrap.php';
|
||||
|
||||
function dVal($value){
|
||||
@ -23,123 +27,275 @@ function dVal($value){
|
||||
?>
|
||||
<div id="center">
|
||||
<?php
|
||||
$path = PATH_DATA.'/graydon';
|
||||
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.xml');
|
||||
|
||||
$firephp->info('Fomat HTML');
|
||||
|
||||
$path = PATH_DATA.'/graydon';
|
||||
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.'.$format);
|
||||
|
||||
//Vérifier si le rapport n'est pas disponible en base depuis une autre commandes
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Report')
|
||||
->where('identifier = ?', $_REQUEST['identifier']);
|
||||
->from('Report')
|
||||
->where('identifier = ?', $_REQUEST['identifier'])
|
||||
->andWhere('format = ?', $format);
|
||||
|
||||
$firephp->log($q->getSql(), 'Requete SQL');
|
||||
$firephp->log($q->getParams(), 'Params SQL');
|
||||
|
||||
$report = new Report();
|
||||
$report = $q->fetchOne();
|
||||
|
||||
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
|
||||
if($report==FALSE){
|
||||
$firephp->info('Pas en cache');
|
||||
//Vérifier si le rapport en ligne à déjà été demandé
|
||||
if($format == 'html')
|
||||
{
|
||||
|
||||
|
||||
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
|
||||
if($report==FALSE)
|
||||
{
|
||||
$firephp->info('Pas en cache');
|
||||
//Vérifier si le rapport en ligne à déjà été demandé
|
||||
/*
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Commandes')
|
||||
->where('companyproductidentifier = ?', $CompanyProductIdentifier);
|
||||
|
||||
$commandes = new Commandes();
|
||||
$commandes = $q->fetchOne();
|
||||
|
||||
$report = new Report();
|
||||
$report = $commandes->Report;
|
||||
|
||||
if($commandes == FALSE && !isset($report->id)){
|
||||
$html = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName, $format);
|
||||
//La commande à déjà été demandé
|
||||
}else{
|
||||
$html = $report->content;
|
||||
}
|
||||
*/
|
||||
$html = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName, $format);
|
||||
//Le rapport est disponible
|
||||
}
|
||||
else
|
||||
{
|
||||
$country = Doctrine_Query::create()
|
||||
->from('Country')
|
||||
->where('graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
//Enregistrement d'une fausse commande dans la bdd
|
||||
$commandes = new Commandes();
|
||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||
$commandes->prix = 0;
|
||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
||||
$commandes->sessionid = $sessionID;
|
||||
$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $tabInfo['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
$commandes->Country = $country;
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Assignation du contenu
|
||||
$html = $report->content;
|
||||
}
|
||||
|
||||
if(isset($html) && $html!='' && $html!==FALSE)
|
||||
{
|
||||
$html = str_replace('<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">', '', $html);
|
||||
$html = str_replace('<body>', '', $html);
|
||||
$html = str_replace('</body></html>', '', $html);
|
||||
$html = preg_replace('@<style[^>]*?>.*?</style>@si', '', $html);
|
||||
$html = preg_replace('@<h1[^>]*?>Graydon .*?</h1>@si', '', $html);
|
||||
?>
|
||||
<style type="text/css">
|
||||
h1{font-family : Verdana, Arial, Helvetica, sans-serif;font-size: 14px;font-weight : bold;color : white;padding: 3px;margin: 10px 0px 6px 0px;border-width : 1px;border-style : solid;border-color : #31659C;background-color : #31659C; text-align: left;}
|
||||
h1.header{font-size: 18px;font-weight : 900;border-width : 0px;text-align: center;color : #31659C;background-color : white;}
|
||||
h1.trailer{border-width : 0px;text-align: center;color : #31659C;background-color : white;}
|
||||
img{border-style : none;align: left;vertical-align: middle;}
|
||||
img.link{height: 11px;width: 13px}
|
||||
p{font-size: 13px;font-family: Verdana, Arial, Helvetica, sans-serif;margin : 0px;padding-left : 3px;padding-right : 3px;padding-top : 3px;padding-bottom : 3px;text-align: left;}
|
||||
p.smallSpace{font-size: 1px;}
|
||||
table{}
|
||||
table.border{border-style : solid;border-width : 1px;border-color: #31659C;}
|
||||
table.header{margin: 10px 0px 6px 0px;border-width : 1px;border-style : solid;border-color : #31659C;text-align: left; width:100%;}
|
||||
table.small{width: 300px;}
|
||||
tr{page-break-inside: avoid;}
|
||||
th{font-family : Verdana, Arial, Helvetica, sans-serif;font-weight: bold;font-size: 13px;padding-left: 3px;width: 177px;color: #31659C;background-color : #e7eff8;text-align: left;vertical-align: top;}
|
||||
th.h1{font-size: 14px;padding: 3px;font-weight : bold;background-color : #31659C;color : white;}
|
||||
th.minusBackgroundColor{background-color : white;}
|
||||
th.label{font-weight: normal;background-color : white;width: auto;}
|
||||
th.indent{padding-left: 6px;}
|
||||
th.indentDouble{padding-left: 12px;}
|
||||
td{font-size: 13px;font-family: Verdana, Arial, Helvetica, sans-serif;color: black;padding-left: 3px;vertical-align: top;text-align: left;}
|
||||
a{font-family: Verdana, Arial, Helvetica, sans-serif;text-decoration : underline;color : blue;vertical-align: middle;}
|
||||
a:HOVER{font-family: Verdana, Arial, Helvetica, sans-serif;color : gold;vertical-align: middle;}
|
||||
input{font-size : 13px;font-family : Verdana,Arial;font-weight : lighter;border-width : 1px 1px 1px 1px;border-top-style : solid;border-left-style: solid;border-right-style : solid;border-bottom-style : solid;}
|
||||
select{font-size : 7pt;font-family : "Small Fonts",Arial;border-top-width : 1px;border-left-width : 1px;border-right-width : 1px;border-bottom-width : 1px;border-top-style : solid;border-left-style : solid;border-right-style : solid;border-bottom-style : solid;border-color : black black black black;font-weight : lighter;background-color : #f1f1f1;}
|
||||
.submit{font-size : 14px;font-family : Verdana,Arial;font-weight : normal;color : #f1f1f1;background-color : black;}
|
||||
.bold{font-weight: bold;}
|
||||
.red{color: red;}
|
||||
.white{background-color: white;}
|
||||
.lightGrey{background-color: lightGrey;}.italic{font-style: italic;}.dashed{border-bottom-style : dashed;border-bottom-width : 1px;border-bottom-color: silver;padding-left: 3px;padding-right: 3px;margin-top: 3px;margin-bottom: 3px;}
|
||||
.marginTop{margin-top: 6px;}
|
||||
.paddingTop{padding-top: 3px;}
|
||||
.paddingBottom{padding-bottom: 6px;}
|
||||
.textAlignRight{text-align: right;padding-right: 3px;}
|
||||
.signature_color1{color: #31659C;}
|
||||
.border_right{border-right-style : solid;border-right-width : 1px;border-right-color: #31659C;}
|
||||
.border_left{border-right-style : solid;border-right-width : 1px;border-right-color: #31659C;}
|
||||
.border_bottom{border-bottom-style : solid;border-bottom-width : 1px;border-bottom-color: #31659C;}
|
||||
.center{text-align: center;width: auto;}
|
||||
.paymentBox {font-size: large;width: 100;height: 100;border: 1px solid #191970;text-align: center;padding-top: 35;margin-left: 70;}ul{list-style: none;padding: 0;margin: 0}li{padding-left: 10px;margin-right: 0px;background-image: url("/Creditline_core/images/tab-blue-left.gif");background-position: left top;background-repeat: no-repeat;background-color : #31659C;color: white;float: left;}li span{padding-right: 10px;padding-bottom: 3px;background-image: url("/Creditline_core/images/tab-blue-right.gif");background-position: right top;background-repeat: no-repeat;background-color : #31659C;float: left;}li a{color: white;}li a:hover{color: gold;}li a:hover span{color: gold;}</style><style media="print" type="text/css">/* HTML Elements */body{scrollbar-face-color : #31659C;scrollbar-track-color : #F1F1F1;scrollbar-base-color : #F1F1F1;scrollbar-arrow-color : #e7eff8;scrollbar-shadow-color : #31659C;scrollbar-highlight-color : #31659C;scrollbar-3dlight-color : #e7eff8;scrollbar-darkshadow-color : #e7eff8;background: #FFFFFF;font-size: 13px;font-family: Verdana, Arial, Helvetica, sans-serif;color: black;text-align: center;}h1{font-family : Verdana, Arial, Helvetica, sans-serif;font-size: 14px;font-weight : bold;color : white;padding: 3px;margin: 10px 0px 6px 0px;border-width : 1px;border-style : solid;border-color : #31659C;background-color : #31659C;text-align: left;}
|
||||
</style>
|
||||
<?php
|
||||
print $html;
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="500" class="StyleInfoLib">Aucune information disponible.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
elseif($format == 'xml')
|
||||
{
|
||||
$path = PATH_DATA.'/graydon';
|
||||
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.xml');
|
||||
|
||||
//Vérifier si le rapport n'est pas disponible en base depuis une autre commandes
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Commandes')
|
||||
->where('companyproductidentifier = ?', $CompanyProductIdentifier);
|
||||
$commandes = new Commandes();
|
||||
$commandes = $q->fetchOne();
|
||||
->from('Report')
|
||||
->where('identifier = ?', $_REQUEST['identifier'])
|
||||
->andWhere('format = ?', $format);
|
||||
$report = new Report();
|
||||
$report = $commandes->Report;
|
||||
if($commandes == FALSE && !isset($report->id)){
|
||||
$xml = getIdentite($CompanyProductIdentifier, $path.'/'.$fileName);
|
||||
//La commande à déjà été demandé
|
||||
}else{
|
||||
$report = $q->fetchOne();
|
||||
|
||||
//@TODO : si le rapport existe déjà ou que la date n'est pas très éloigné
|
||||
if($report==FALSE)
|
||||
{
|
||||
$firephp->info('Pas en cache');
|
||||
//Vérifier si le rapport en ligne à déjà été demandé
|
||||
$q = Doctrine_Query::create()
|
||||
->from('Commandes')
|
||||
->where('companyproductidentifier = ?', $CompanyProductIdentifier);
|
||||
$commandes = new Commandes();
|
||||
$commandes = $q->fetchOne();
|
||||
$report = new Report();
|
||||
$report = $commandes->Report;
|
||||
if($commandes == FALSE && !isset($report->id)){
|
||||
$xml = getIdentite($identifier, $CompanyProductIdentifier, $path.'/'.$fileName);
|
||||
//La commande à déjà été demandé
|
||||
}else{
|
||||
$xml = $report->content;
|
||||
}
|
||||
//Le rapport est disponible
|
||||
}
|
||||
else
|
||||
{
|
||||
$country = Doctrine_Query::create()
|
||||
->from('Country')
|
||||
->where('graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
//Enregistrement d'une fausse commande dans la bdd
|
||||
$commandes = new Commandes();
|
||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||
$commandes->prix = 0;
|
||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
||||
$commandes->sessionid = $sessionID;
|
||||
$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $tabInfo['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
$commandes->Country = $country;
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Assignation du contenu
|
||||
$xml = $report->content;
|
||||
}
|
||||
//Le rapport est disponible
|
||||
}else{
|
||||
|
||||
$country = Doctrine_Query::create()
|
||||
->from('Country')
|
||||
->where('graydon_country = ?', $pays)
|
||||
->fetchOne();
|
||||
|
||||
//Enregistrement d'une fausse commande dans la bdd
|
||||
$commandes = new Commandes();
|
||||
$commandes->reference = $placeOrderResult->OrderStatus->OrderReference;
|
||||
$commandes->servicespeed = $placeOrderResult->OrderStatus->Order->ServiceSpeed;
|
||||
$commandes->prix = 0;
|
||||
$commandes->orderstate = $placeOrderResult->OrderStatus->OrderState;
|
||||
$commandes->dateordered = $placeOrderResult->OrderStatus->DateOrdered;
|
||||
$commandes->datecompleted = $placeOrderResult->OrderStatus->DateCompleted;
|
||||
$commandes->datedue = $placeOrderResult->OrderStatus->DateDue;
|
||||
$commandes->companyproductidentifier = $CompanyProductIdentifier;
|
||||
$commandes->sessionid = $sessionID;
|
||||
$commandes->transactionidentifier = $transactionIdentifier;
|
||||
$commandes->user = $tabInfo['login'];
|
||||
$commandes->mode = $_SESSION['graydon']['mode'];
|
||||
$commandes->Country = $country;
|
||||
$commandes->save();
|
||||
$firephp->log($commandes->toArray(),'dataCommandes');
|
||||
$commandes_id = $commandes->id;
|
||||
|
||||
//Assignation du contenu
|
||||
$xml = $report->content;
|
||||
}
|
||||
|
||||
//========= Affichage des informations =========
|
||||
if(isset($xml) && $xml!='' && $xml!==FALSE){
|
||||
|
||||
$tabReport = array();
|
||||
|
||||
require_once 'graydon/functions.php';
|
||||
require_once 'graydon/format.php';
|
||||
|
||||
//Création du DOM
|
||||
$doc = new DOMDocument;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadxml($xml);
|
||||
$xpath = new DOMXPath($doc);
|
||||
$tabReport = parseReportXML($xml);
|
||||
$firephp->log($tabReport, 'tabReport');
|
||||
function utf8decode_deep($value)
|
||||
{
|
||||
$value = is_array($value) ?
|
||||
array_map('utf8decode_deep', $value) :
|
||||
cleanutf8($value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.bilans { margin-left:35px; }
|
||||
div.bilans { margin-top:15px; font:bold 16px Verdana, Arial, Sans-serif; }
|
||||
span.bilans { font-style:italic; }
|
||||
table.bilans { width:545px; }
|
||||
table.bilans .right {text-align:right;}
|
||||
</style>
|
||||
|
||||
<h1 class="titre">IDENTITÉ INTERNATIONALE DE L'ENTREPRISE</h1>
|
||||
<?php dIdentifiant($tabReport); ?>
|
||||
<h2>Raison sociale et coordonnées : </h2>
|
||||
<?php dIdentite($tabReport);?>
|
||||
<h2>Activité(s) et chiffre d'affaire de l'entreprise : </h2>
|
||||
<?php dActivite($tabReport); ?>
|
||||
<h2> Résumé financier : </h2>
|
||||
<?php dResume($tabReport); ?>
|
||||
<h2> Credit : </h2>
|
||||
<?php dCredit($tabReport); ?>
|
||||
<h2> Actionariat / Participation : </h2>
|
||||
<?php dLiens($tabReport); ?>
|
||||
<h2> Bilans : </h2>
|
||||
<?php dBilans($tabReport); ?>
|
||||
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="500" class="StyleInfoLib">Aucune information disponible.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
//========= Affichage des informations =========
|
||||
if(isset($xml) && $xml!='' && $xml!==FALSE)
|
||||
{
|
||||
|
||||
$tabReport = array();
|
||||
|
||||
//Création du DOM
|
||||
$doc = new DOMDocument;
|
||||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadxml($xml);
|
||||
$xpath = new DOMXPath($doc);
|
||||
$tabReport = parseReportXML($xml);
|
||||
$firephp->log($tabReport, 'tabReport');
|
||||
function utf8decode_deep($value)
|
||||
{
|
||||
$value = is_array($value) ?
|
||||
array_map('utf8decode_deep', $value) :
|
||||
cleanutf8($value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.bilans { margin-left:35px; }
|
||||
div.bilans { margin-top:15px; font:bold 16px Verdana, Arial, Sans-serif; }
|
||||
span.bilans { font-style:italic; }
|
||||
table.bilans { width:545px; }
|
||||
table.bilans .right {text-align:right;}
|
||||
</style>
|
||||
|
||||
<h1 class="titre">IDENTITÉ INTERNATIONALE DE L'ENTREPRISE</h1>
|
||||
<?php dIdentifiant($tabReport); ?>
|
||||
<h2>Raison sociale et coordonnées : </h2>
|
||||
<?php dIdentite($tabReport);?>
|
||||
<h2>Activité(s) et chiffre d'affaire de l'entreprise : </h2>
|
||||
<?php dActivite($tabReport); ?>
|
||||
<h2> Résumé financier : </h2>
|
||||
<?php dResume($tabReport); ?>
|
||||
<h2> Credit : </h2>
|
||||
<?php dCredit($tabReport); ?>
|
||||
<h2> Actionariat / Participation : </h2>
|
||||
<?php dLiens($tabReport); ?>
|
||||
<h2> Bilans : </h2>
|
||||
<?php dBilans($tabReport); ?>
|
||||
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="500" class="StyleInfoLib">Aucune information disponible.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@ if (!$_SESSION['connected']) die();
|
||||
$tabInfo = $_SESSION['tabInfo'];
|
||||
$vue = isset($_REQUEST['vue']) ? $_REQUEST['vue'] : 'recherche';
|
||||
|
||||
require_once 'graydon/graydon_log.php';
|
||||
require_once 'graydon/graydon.php';
|
||||
require_once 'dbbootstrap.php';
|
||||
|
||||
/* Affichage du formulaire de recherche */
|
||||
@ -56,12 +56,14 @@ require_once 'international_rechercheform.php';
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}elseif($vue=='list'){
|
||||
}
|
||||
elseif($vue=='list')
|
||||
{
|
||||
//*********** Mode démonstration
|
||||
if($_REQUEST['mode']=='demo'){
|
||||
$pays = $_REQUEST['frmDemo']['Country'];
|
||||
|
||||
//Trouver le code pays pour le mode démos
|
||||
|
||||
setDbConn('graydon');
|
||||
$q = Doctrine_Query::Create()
|
||||
->select('code')
|
||||
@ -70,7 +72,6 @@ require_once 'international_rechercheform.php';
|
||||
$result = $q->fetchOne();
|
||||
$paysCode = $result->code;
|
||||
|
||||
|
||||
$_SESSION['graydon']['mode'] = 'demo';
|
||||
$_SESSION['graydon']['paysCode'] = $paysCode;
|
||||
$_SESSION['graydon']['pays'] = $pays;
|
||||
@ -80,7 +81,6 @@ require_once 'international_rechercheform.php';
|
||||
<span class="StyleInfoLib">Résultat de la recherche de démonstration :</span>
|
||||
<?php
|
||||
require_once 'i18n/cleanchar.php';
|
||||
require_once 'graydon/graydonws.php';
|
||||
// Create the request parameters
|
||||
$request = new StdClass();
|
||||
// Initialise the request object
|
||||
@ -90,7 +90,7 @@ require_once 'international_rechercheform.php';
|
||||
{
|
||||
// Make a request on the web service
|
||||
$result = $graydon->getDemoCompanies($request);
|
||||
|
||||
$firephp->log($result, 'DemoCompanies');
|
||||
//Enregistrement de l'action dans les logs
|
||||
$transactionIdentifier = $result->Service_Log->TransactionIdentifier;
|
||||
$sessionID = $result->Service_Log->SessionID;
|
||||
@ -108,25 +108,18 @@ require_once 'international_rechercheform.php';
|
||||
$log->save();
|
||||
|
||||
//Get the list of companies
|
||||
$demoCompaniesCountry = $result->DemoCompanies->CountryAndCompany;
|
||||
|
||||
$demoCompaniesCountry = $result->DemoCompanies->CountryAndCompany[0]->Country;
|
||||
$demoCompanies = array();
|
||||
$demoCompanies = $demoCompaniesCountry->Companies->Company;
|
||||
$firephp->log($demoCompanies,'demoCompanies');
|
||||
?>
|
||||
<br/>
|
||||
<span class="StyleInfoLib">Pays :</span> <span><?php print $demoCompaniesCountry->Country; ?></span>
|
||||
<span class="StyleInfoLib">Pays :</span> <span><?php print $demoCompaniesCountry; ?></span>
|
||||
<ol>
|
||||
<?php
|
||||
$demoCompanies = array();
|
||||
//Enregitrement de la liste en session
|
||||
$count = count($demoCompaniesCountry->Companies->Company);
|
||||
if ($count>1){
|
||||
$demoCompanies = $demoCompaniesCountry->Companies->Company;
|
||||
}elseif($count==1){
|
||||
$demoCompanies[] = $demoCompaniesCountry->Companies->Company;
|
||||
}
|
||||
$firephp->log($demoCompanies,'demoCompanies');
|
||||
|
||||
$counterCompany = 1;
|
||||
foreach($demoCompanies as $company){
|
||||
foreach($demoCompanies as $company)
|
||||
{
|
||||
?>
|
||||
<li class="StyleInfoData" type="1" value="<?php print $counterCompany++; ?>">
|
||||
<b><a title="Voir la fiche d'identité de cet établissement" href="index.php?page=international_identite&mode=demo&identifier=<?php print $company->CompanyMatchIdentifier;?>">
|
||||
@ -142,14 +135,15 @@ require_once 'international_rechercheform.php';
|
||||
</ol>
|
||||
</div>
|
||||
<?php
|
||||
}catch( SoapFault $fault ){
|
||||
}
|
||||
catch( SoapFault $fault )
|
||||
{
|
||||
if(isset($fault->faultstring) && $fault->faultcode = 'HTTP'){
|
||||
print '<br/>Le service partenaire n\'est pas disponible.';
|
||||
}else{
|
||||
$code = $fault->detail->GraydonCompanyData_Fault->FaultReturnCode;
|
||||
$text = $fault->detail->GraydonCompanyData_Fault->FaultMessage;
|
||||
$firephp->log($text,'texterror');
|
||||
require_once 'graydon/graydon_error.php';
|
||||
if(graydon_error($code, $text)==FALSE){
|
||||
print graydon_processSoapFault($graydon,$fault,$tabInfo);
|
||||
}
|
||||
@ -176,7 +170,6 @@ require_once 'international_rechercheform.php';
|
||||
<span class="StyleInfoLib">Résultat de la recherche :</span>
|
||||
<?php
|
||||
require_once 'i18n/cleanchar.php';
|
||||
require_once 'graydon/graydonws.php';
|
||||
|
||||
$result = getCompanyMatches($pays);
|
||||
|
||||
@ -187,16 +180,12 @@ require_once 'international_rechercheform.php';
|
||||
<span class="StyleInfoLib">Pays :</span> <span><?php print $result->Service_Log->Country; ?></span>
|
||||
<ol>
|
||||
<?php
|
||||
$count = count($result->CompanyMatches->Company);
|
||||
if ($count>1){
|
||||
$companies = $result->CompanyMatches->Company;
|
||||
}elseif($count==1){
|
||||
$companies[] = $result->CompanyMatches->Company;
|
||||
}
|
||||
$companies = $result->CompanyMatches->Company;
|
||||
$firephp->log($companies,'companies');
|
||||
|
||||
$counterCompany = 1;
|
||||
foreach($companies as $company){
|
||||
foreach($companies as $company)
|
||||
{
|
||||
?>
|
||||
<li class="StyleInfoData" type="1" value="<?php print $counterCompany++; ?>">
|
||||
<b><a title="Voir la fiche d'identité de cet établissement" href="index.php?page=international_identite&identifier=<?php print $company->CompanyMatchIdentifier;?>&name=<?=urlencode(cleanutf8($company->Name))?>">
|
||||
|
Loading…
Reference in New Issue
Block a user