From c8ef0d9d174ed38aa9946ac3314d5d6852e73e4d Mon Sep 17 00:00:00 2001 From: Damien LASSERRE Date: Mon, 4 Jul 2011 15:26:22 +0000 Subject: [PATCH] =?UTF-8?q?Modification=20de=20giant=20Cr=C3=A9ation=20des?= =?UTF-8?q?=20acces=20au=20rapport=20!=20+=20library=20r=C3=A9utilisable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/GiantController.php | 33 +++++----- .../views/default/scripts/giant/full.phtml | 1 - .../default/scripts/giant/identite.phtml | 4 +- .../scripts/giant/partials/fiche.phtml | 66 +++++++++++++++++++ .../views/default/scripts/giant/rapport.phtml | 5 ++ library/Giant/Controller/GiantController.php | 13 ++++ .../Giant/Controller/IdentiteController.php | 58 ++++++++++++++-- .../Giant/Controller/RechercheController.php | 18 ++++- library/Giant/CreditData.lib.php | 13 ++-- 9 files changed, 178 insertions(+), 33 deletions(-) delete mode 100644 application/views/default/scripts/giant/full.phtml create mode 100644 application/views/default/scripts/giant/partials/fiche.phtml create mode 100644 application/views/default/scripts/giant/rapport.phtml diff --git a/application/controllers/GiantController.php b/application/controllers/GiantController.php index a09fae5e3..c1b62af14 100644 --- a/application/controllers/GiantController.php +++ b/application/controllers/GiantController.php @@ -6,6 +6,8 @@ require_once ('Giant/CreditData.lib.php'); require_once ('Giant/Controller/RechercheController.php'); require_once ('Scores/Utilisateur.php'); require_once ('Giant/Functions.php'); +require_once ('Giant/Controller/GiantController.php'); +require_once ('Giant/Controller/IdentiteController.php'); class GiantController extends Zend_Controller_Action { @@ -68,23 +70,20 @@ class GiantController extends Zend_Controller_Action $this->view->soap = $ListeRapport->soapG; } - public function fullAction() + public function rapportAction() { - - } - - public function compactAction() - { - - } - - public function creditAction() - { - - } - - public function flexAction() - { - + $rechercheParams = new RechercheHistorique(); + if (count($rechercheParams->liste()) > 0) + { + $recherche = $rechercheParams->item(0); + $type = $recherche['type']; + $params = $recherche['params']; + } + $Full = new GiantRechercheController($params['pays'], $this->TestIndication); + $result = $Full->GetRapport($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type')); + $identiteController = new GiantIdentiteController($result); + $identiteController->ficheAction(); + + $this->view->fiche = $identiteController->getObjet('fiche'); } } \ No newline at end of file diff --git a/application/views/default/scripts/giant/full.phtml b/application/views/default/scripts/giant/full.phtml deleted file mode 100644 index b3d9bbc7f..000000000 --- a/application/views/default/scripts/giant/full.phtml +++ /dev/null @@ -1 +0,0 @@ -
- Dernières modifications au + Dernières modifications au

Identite

@@ -59,7 +59,7 @@ - Consulter le rapport en immédiat + Consulter le rapport en immédiat diff --git a/application/views/default/scripts/giant/partials/fiche.phtml b/application/views/default/scripts/giant/partials/fiche.phtml new file mode 100644 index 000000000..021577616 --- /dev/null +++ b/application/views/default/scripts/giant/partials/fiche.phtml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CompanyIdfiche['CompanyId'];?>
Vatfiche['Vat']->VatNumber;?>
CompanyNamefiche['CompanyName']->_;?>
CompanyStatusfiche['CompanyStatus'];?>
CompanyAddress + fiche['CompanyAddress']->HouseNumber;?> fiche['CompanyAddress']->Street;?>
+ fiche['CompanyAddress']->PostCode;?> fiche['CompanyAddress']->City;?> +
TelephoneNumberfiche['TelephoneNumber']->_;?>
Telefaxfiche['Telefax'];?>
WebAddressfiche['WebAddress'];?>
EmailAddressfiche['EmailAddress'];?>
IncorporationDatefiche['IncorporationDate']->_;?>
LegalFormfiche['LegalForm']->CountryLegalForm->_;?>
IsUltimateParentfiche['IsUltimateParent'];?>
+
fiche);?>
\ No newline at end of file diff --git a/application/views/default/scripts/giant/rapport.phtml b/application/views/default/scripts/giant/rapport.phtml new file mode 100644 index 000000000..21692c482 --- /dev/null +++ b/application/views/default/scripts/giant/rapport.phtml @@ -0,0 +1,5 @@ +
+
+ partial('giant/partials/fiche.phtml', null, array('fiche'=> $this->fiche));?> +
+
\ No newline at end of file diff --git a/library/Giant/Controller/GiantController.php b/library/Giant/Controller/GiantController.php index 0e1578a91..a02f86b3a 100644 --- a/library/Giant/Controller/GiantController.php +++ b/library/Giant/Controller/GiantController.php @@ -5,4 +5,17 @@ Class GiantControllerLib { } + + protected function parcourTableau($array) + { + $tableau = array(); + + foreach($array as $key => $element){ + + if((is_array($element)) && (($element instanceof stdClass))) + GiantControllerLib::parcourTableau($element); + else + return $element; + } + } } \ No newline at end of file diff --git a/library/Giant/Controller/IdentiteController.php b/library/Giant/Controller/IdentiteController.php index f5bfa78eb..5c0fc5217 100644 --- a/library/Giant/Controller/IdentiteController.php +++ b/library/Giant/Controller/IdentiteController.php @@ -1,28 +1,72 @@ objet = $objet; } public function ficheAction() { - + + 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 secondaireAction() + 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]); } } \ No newline at end of file diff --git a/library/Giant/Controller/RechercheController.php b/library/Giant/Controller/RechercheController.php index 721211665..1bc7af097 100644 --- a/library/Giant/Controller/RechercheController.php +++ b/library/Giant/Controller/RechercheController.php @@ -1,5 +1,7 @@ Provider->CountryCode = $CountryCode; $this->Provider->ProviderId = parent::setCountryCode($CountryCode, $this->listAutorized); $this->Provider->TestIndication = $TestIndication; - $this->soapG = new WSgiant($this->Provider); + $this->soapG = new WSgiant($this->Provider); } public function Liste($parametres, $page) @@ -100,6 +102,20 @@ Class GiantRechercheController extends GiantFunctionController return (false); } + public function GetRapport($CompanyId, $DataSetType) + { + $cache = new Cache('giant-'.$DataSetType.'-'.$CompanyId); + if(!$cache->exist()) { + $this->CreditData = new CreditData($this->soapG, $CompanyId); + $result = $this->CreditData->getMethode('OrderDataSet', array($DataSetType)); + $result = $this->CreditData->getMethode('RetrieveDataSet', array($result->Order->InternalOrderId)); + $cache->setBlock($result); + } else { + $result = $cache->getBlock(); + } + return ($result); + } + public function ListeRapport($CompanyId) { $this->CreditData = new CreditData($this->soapG, $CompanyId); diff --git a/library/Giant/CreditData.lib.php b/library/Giant/CreditData.lib.php index a4347fb20..d80588dbb 100644 --- a/library/Giant/CreditData.lib.php +++ b/library/Giant/CreditData.lib.php @@ -1,10 +1,12 @@ companyId = $this->companyId; + $parametres->CompanyId = $this->companyId; $parametres->DataSetType = $DataSetType; + $parametres->DataSetVersion = DATA_SET_VERSION; $parametres->Version = $Version; - $parametres->LanguageCode = $LanguageCode; + $parametres->LanguageCode = 'en'; try { $result = $this->soapG->OrderDataSet($parametres); } catch (SoapFault $soapFault) {