2011-10-13 12:22:44 +02:00
|
|
|
<?php
|
2012-05-20 18:31:28 +02:00
|
|
|
/*
|
2011-10-13 12:22:44 +02:00
|
|
|
* To change this template, choose Tools | Templates
|
2013-06-14 18:00:22 +02:00
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
2011-12-07 09:58:50 +01:00
|
|
|
require_once 'Vendors/ChartDirector/phpchartdir.php';
|
2011-10-13 12:22:44 +02:00
|
|
|
require_once ('Giant/WSgiant.php');
|
|
|
|
require_once ('Scores/Cache.php');
|
|
|
|
require_once ('Partials.php');
|
|
|
|
|
|
|
|
Class GiantControllerLib
|
|
|
|
{
|
|
|
|
private $pathImg;
|
|
|
|
|
2013-06-14 18:00:22 +02:00
|
|
|
public function __construct($companyId)
|
2011-10-13 12:22:44 +02:00
|
|
|
{
|
2013-06-14 18:00:22 +02:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
|
2011-10-13 12:22:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-23 15:42:00 +02:00
|
|
|
public function commande($CompanyId, $Type, $Pays, $Language, $TestIndication)
|
2011-10-13 12:22:44 +02:00
|
|
|
{
|
2011-11-14 11:01:41 +01:00
|
|
|
$function = new GiantFunction();
|
2012-05-20 18:31:28 +02:00
|
|
|
$Utilisateur = new Scores_Utilisateur();
|
2011-10-13 12:22:44 +02:00
|
|
|
$Commande = new Commandes();
|
|
|
|
$Rapport = new Rapports($Pays, $TestIndication);
|
|
|
|
$CommandeP = new stdClass();
|
|
|
|
|
2013-05-23 15:42:00 +02:00
|
|
|
$id = $Rapport->getRapportExist($CompanyId, $Type, $Language);
|
2011-10-13 12:22:44 +02:00
|
|
|
if(empty($id)) {
|
|
|
|
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
2013-05-23 15:42:00 +02:00
|
|
|
$result = $rapport->GetRapport($CompanyId, $Type, $Language);
|
2011-10-13 12:22:44 +02:00
|
|
|
$result = base64_encode(serialize($result));
|
|
|
|
$id = $Rapport->setReport($CompanyId,
|
2013-06-14 18:00:22 +02:00
|
|
|
$Type,
|
|
|
|
$Pays,
|
|
|
|
$result,
|
|
|
|
$Language);
|
2011-10-13 12:22:44 +02:00
|
|
|
}
|
2013-06-14 18:00:22 +02:00
|
|
|
|
2013-05-23 15:42:00 +02:00
|
|
|
$report_id = $Rapport->getRapportExistId($CompanyId, $Language);
|
2013-06-14 18:00:22 +02:00
|
|
|
|
2011-10-13 12:22:44 +02:00
|
|
|
$CommandeP->login = $Utilisateur->getLogin();
|
|
|
|
$CommandeP->date = date("Y-m-d");
|
2011-11-14 11:01:41 +01:00
|
|
|
$CommandeP->typeReport = $function->getTypeReport($Type);
|
2011-10-13 12:22:44 +02:00
|
|
|
$CommandeP->price = 0;
|
|
|
|
$CommandeP->pays = strtolower($Pays);
|
2013-03-11 14:41:59 +01:00
|
|
|
$CommandeP->rapportId = $report_id[0]['id'];
|
2013-05-23 15:42:00 +02:00
|
|
|
//$CommandeP->lang = $Utilisateur->getLang();
|
2013-03-11 14:41:59 +01:00
|
|
|
/*echo'<pre>';
|
|
|
|
print_r($report_id);
|
|
|
|
echo'</pre>';
|
2011-10-13 12:22:44 +02:00
|
|
|
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->typeReport, $CommandeP->pays)) {
|
2013-06-14 18:00:22 +02:00
|
|
|
$Commande->setCommandes($CommandeP);
|
2013-03-11 14:41:59 +01:00
|
|
|
}*/
|
|
|
|
$Commande->setCommandes($CommandeP);
|
|
|
|
|
2011-10-13 12:22:44 +02:00
|
|
|
return ($id);
|
|
|
|
}
|
2013-06-14 18:00:22 +02:00
|
|
|
public function monitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode,$Pays)
|
|
|
|
{
|
|
|
|
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
|
|
|
$result = $rapport->GetStartMonitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode);
|
|
|
|
return ($result);
|
|
|
|
}
|
2011-10-13 12:22:44 +02:00
|
|
|
|
|
|
|
protected function parcourTableau($array)
|
2013-06-14 18:00:22 +02:00
|
|
|
{
|
|
|
|
$tableau = array();
|
|
|
|
foreach($array as $key => $element){
|
|
|
|
if((is_array($element)) && (($element instanceof stdClass)))
|
|
|
|
GiantControllerLib::parcourTableau($element);
|
|
|
|
else
|
|
|
|
return $element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAvisDeCredit($report) {
|
|
|
|
$getAvisDeCredit = new AvisDeCredit($report, $this->pathImg);
|
|
|
|
return ($getAvisDeCredit->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getStructureEntreprise($report) {
|
|
|
|
$StructureEntreprise = new StructureEntreprise($report, $this->pathImg);
|
|
|
|
return ($StructureEntreprise->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPositionFinanciere($report) {
|
|
|
|
$PositionFinanciere = new PositionFinanciere($report, $this->pathImg);
|
|
|
|
return ($PositionFinanciere->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getInformationGenerale($report) {
|
|
|
|
$InformationGenerale = new InformationGenerale($report, $this->pathImg);
|
|
|
|
return ($InformationGenerale->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHistoriques($report) {
|
|
|
|
$Historique = new Historiques($report, $this->pathImg);
|
|
|
|
return ($Historique->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDirigeant($report) {
|
|
|
|
$Dirigeant = new Dirigeant($report, $this->pathImg);
|
|
|
|
return ($Dirigeant->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getComportementPaiement($report) {
|
|
|
|
$ComportementPaiement = new ComportementPaiement($report, $this->pathImg);
|
|
|
|
return ($ComportementPaiement->getDatas());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getComptesAnnuels($report) {
|
|
|
|
$ComptesAnnuels = new ComptesAnnuels($report, $this->pathImg);
|
|
|
|
return ($ComptesAnnuels->getDatas());
|
|
|
|
}
|
2011-10-13 12:22:44 +02:00
|
|
|
|
|
|
|
public function getComparaisonValeurs($report) {
|
|
|
|
$ComparaisonValeurs = new ComparaisonValeurs($report, $this->pathImg);
|
|
|
|
return ($ComparaisonValeurs->getDatas());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Class GiantRechercheController extends GiantFunction
|
|
|
|
{
|
2013-06-14 18:00:22 +02:00
|
|
|
protected $listAutorized = array(
|
|
|
|
'FR' => '006', 'BE' => '001', 'ES' => '001',
|
|
|
|
'GB' => '002', 'NL' => '003'
|
|
|
|
);
|
|
|
|
protected $Provider;
|
|
|
|
public $soapG;
|
|
|
|
|
|
|
|
protected $Search;
|
|
|
|
public $CreditData;
|
|
|
|
|
|
|
|
public function __construct($CountryCode, $TestIndication = true)
|
|
|
|
{
|
|
|
|
$this->Provider = new stdClass();
|
|
|
|
$this->Provider->CountryCode = $CountryCode;
|
|
|
|
$this->Provider->ProviderId = parent::setCountryCode($CountryCode, $this->listAutorized);
|
|
|
|
$this->Provider->TestIndication = $TestIndication;
|
|
|
|
$this->soapG = new WSgiant($this->Provider);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function Liste($parametres, $page)
|
|
|
|
{
|
|
|
|
if (parent::selectTypeSearch($parametres))
|
|
|
|
return (self::ListeSearch($parametres, $page));
|
|
|
|
else
|
|
|
|
return (self::ListeAdvancedSearch($parametres, $page));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ListeSearch($parametres, $page)
|
|
|
|
{
|
|
|
|
$this->Search = new Search($this->soapG);
|
|
|
|
$searchParametre = new stdClass();
|
|
|
|
$searchParametre->Query = '';
|
|
|
|
$searchParametre->StartRow = $page;
|
|
|
|
$searchParametre->NumRows = parent::getNumRows();
|
|
|
|
$champQuery = array( 'raisonSociale', 'numero', 'voie', 'cpVille',
|
|
|
|
'telFax', 'naf', 'siret'
|
|
|
|
);
|
|
|
|
$this->soapG->getAllMethodesFromWsdl('search');
|
|
|
|
foreach($parametres as $champ => $parametre) {
|
|
|
|
if(!empty($parametre)) {
|
|
|
|
foreach($champQuery as $valeur) {
|
|
|
|
if($champ == $valeur)
|
|
|
|
$searchParametre->Query .= $parametre.' ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$result = $this->Search->getMethode('search', array($searchParametre, $page));
|
|
|
|
if ($result->NumberOfHits > 0)
|
|
|
|
$result = parent::replaceAcronyme($result);
|
|
|
|
|
|
|
|
return ($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ListeAdvancedSearch($parametres, $page)
|
|
|
|
{
|
|
|
|
$this->Search = new Search($this->soapG);
|
|
|
|
$advancedParametres = new stdClass();
|
|
|
|
$TypeAdvanced = new stdClass();
|
|
|
|
$advancedParametres->StartRow = $page;
|
|
|
|
$advancedParametres->NumRows = parent::getNumRows();
|
|
|
|
|
|
|
|
//((strlen($parametres['siret']) == 9) ? $id = 'CompanyRegisterNumber' : $id = 'CompanyId');
|
|
|
|
$labelForm = array(
|
|
|
|
'siret' => 'CompanyId',
|
|
|
|
'raisonSociale' => 'RegisteredName',
|
|
|
|
'numero' => 'HouseNumber',
|
|
|
|
'voie' => 'Street',
|
|
|
|
'cpVille' => 'City'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($parametres as $champ => $parametre) {
|
|
|
|
if (!empty($parametre)) {
|
|
|
|
foreach ($labelForm as $nameForm => $valeur) {
|
|
|
|
if ($champ == $nameForm)
|
|
|
|
$TypeAdvanced->$valeur = $parametre;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$advancedParametres->Query = $TypeAdvanced;
|
|
|
|
if($page == 0 and empty($_SESSION['recherche']['giant']['query'])) {
|
|
|
|
$_SESSION['recherche']['giant']['query'] = serialize($advancedParametres);
|
|
|
|
$result = $this->Search->getMethode('advancedSearch', array($advancedParametres, $page));
|
|
|
|
$this->Search->setQuery(implode(' ', $parametres));
|
|
|
|
} else {
|
|
|
|
$result = $this->Search->getMethode('advancedSearch', array(unserialize($_SESSION['recherche']['giant']['query']), $page));
|
|
|
|
$this->Search->setQuery(implode(' ', $parametres));
|
|
|
|
}
|
|
|
|
|
|
|
|
return ($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function Identite($siret, $pays)
|
|
|
|
{
|
|
|
|
$this->Search = new Search($this->soapG);
|
|
|
|
$parametres = new stdClass();
|
|
|
|
$parametres->siret = $siret;
|
|
|
|
$parametres->pays = $pays;
|
|
|
|
$result = $this->Search->advancedSearch($parametres);
|
|
|
|
|
|
|
|
foreach ($result->Results->Company as $element) {
|
|
|
|
if ($element->CompanyId == $siret)
|
|
|
|
return ($element);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function GetRapport($CompanyId, $DataSetType, $Language)
|
|
|
|
{
|
|
|
|
$this->CreditData = new CreditData($this->soapG, $CompanyId);
|
|
|
|
$result = $this->CreditData->getMethode('OrderDataSet', array($DataSetType, $Language));
|
|
|
|
$result = $this->CreditData->getMethode('RetrieveDataSet', array($result->Order->InternalOrderId));
|
|
|
|
return ($result);
|
|
|
|
}
|
|
|
|
public function GetStartMonitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode)
|
|
|
|
{
|
|
|
|
$this->CreditData = new CreditData($this->soapG, $CompanyId);
|
|
|
|
$result = $this->CreditData->getMethode('StartMonitoring', array($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode));
|
|
|
|
return ($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ListeRapport($CompanyId)
|
|
|
|
{
|
|
|
|
$this->CreditData = new CreditData($this->soapG, $CompanyId);
|
|
|
|
$result = $this->CreditData->getMethode('RetreiveOptions', array($CompanyId));
|
|
|
|
return ($result);
|
|
|
|
}
|
2011-10-13 12:22:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Class GiantIdentiteController extends GiantControllerLib
|
|
|
|
{
|
2013-06-14 18:00:22 +02:00
|
|
|
protected $objet;
|
|
|
|
protected $datas = array();
|
|
|
|
protected $liste = array(
|
|
|
|
'CompanyId', 'Vat', 'CompanyName', 'CompanyStatus',
|
|
|
|
'CompanyAddress', 'TelephoneNumber', 'Telefax', 'WebAddress',
|
|
|
|
'EmailAddress', 'IncorporationDate', 'LegalForm', 'IsUltimateParent'
|
|
|
|
);
|
2011-10-13 12:22:44 +02:00
|
|
|
protected $changingStatus = array('FINANCIAL.CREDIT_RECOMMENDATION_CHANGE' => '',
|
2013-06-14 18:00:22 +02:00
|
|
|
'GENERAL.ADDRESS_CHANGE' => '',
|
|
|
|
'GENERAL.COMPANY_NAME_CHANGE' => '',
|
|
|
|
'GENERAL.LEGALFORM_CHANGE' => '',
|
|
|
|
'GENERAL.ACQUISITION' => '',
|
|
|
|
'GENERAL.NEWS' => '',
|
|
|
|
'FINANCIAL.ANNUAL_ACCOUNT_FILED' => '',
|
|
|
|
'FINANCIAL.CAPITAL_CHANGE' => '',
|
|
|
|
'FINANCIAL.CREDIT_RECOMMENDATION_CHANGE' => '',
|
|
|
|
'EXCEPTION.BANKRUPTCY_OR_LIQUIDATION' => ''
|
2011-10-13 12:22:44 +02:00
|
|
|
|
|
|
|
);
|
|
|
|
|
2013-06-14 18:00:22 +02:00
|
|
|
protected $FinancialSummary = array('Revenue', 'TotalEquity', 'WorkingCapital');
|
|
|
|
|
|
|
|
public function __construct($objet)
|
|
|
|
{
|
|
|
|
$this->objet = $objet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ficheAction()
|
|
|
|
{
|
|
|
|
if(isset($this->objet->DataSet->Company)) {
|
|
|
|
foreach($this->objet->DataSet->Company as $key => $valeur) {
|
|
|
|
foreach ($this->liste as $element) {
|
|
|
|
if ($element == $key) {
|
|
|
|
if(!is_array($valeur)) {
|
|
|
|
if(!empty($valeur)) {
|
|
|
|
$this->datas['fiche'][$key] = $valeur;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->datas['fiche'][$key] = parent::parcourTableau($valeur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function chiffreAction()
|
|
|
|
{
|
|
|
|
foreach ($this->objet->FinancialSummary[0] as $key => $valeur) {
|
|
|
|
foreach($this->FinancialSummary as $element) {
|
|
|
|
if (!empty($valeur)) {
|
|
|
|
$this->datas['chiffre'][$key] = $valeur->_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function secondairesAction()
|
|
|
|
{
|
|
|
|
foreach($this->objet->Branch as $key => $valeur) {
|
|
|
|
if($key != 'BranchAddress') {
|
|
|
|
if(!is_array($valeur))
|
|
|
|
$this->datas['secondaires'][$key] = $valeur;
|
|
|
|
else
|
|
|
|
$this->datas['secondaires'][$key] = parent::parcourTableau($valeur);
|
|
|
|
|
|
|
|
} else
|
|
|
|
$this->datas['secondaires'][$key] = $valeur[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function pieceAction()
|
|
|
|
{
|
|
|
|
foreach($this->objet->Event as $key => $valeur) {
|
|
|
|
$this->datas['piece'][$valeur->Source->code][$valeur->Date] = array($valeur->Description, $valeur->FreeText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getObjet($data)
|
|
|
|
{
|
|
|
|
return ($this->datas[$data]);
|
|
|
|
}
|
2011-10-13 12:22:44 +02:00
|
|
|
}
|
|
|
|
?>
|