issue #0001649: Start monitoring multi-language support

This commit is contained in:
Arman KYOKCHAN 2013-06-14 13:24:18 +00:00
parent ceb36fcda5
commit 0c27f1f47b
6 changed files with 293 additions and 254 deletions

View File

@ -230,6 +230,22 @@ class GiantController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
$this->view->lang = $this->getRequest()->getParam('lang');
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
$this->view->values = $this->getRequest()->getParam('values');
$this->view->Pays = $this->getRequest()->getParam('Pays');
$this->view->values = $this->getRequest()->getParams();
if ($this->getRequest()->isPost()) {
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
$result = $giantController->monitoring($this->getRequest()->getParam('CompanyId'),
$this->getRequest()->getParam('CategoryName'),
$this->getRequest()->getParam('EventType'),
$this->getRequest()->getParam('StartDate'),
$this->getRequest()->getParam('EndDate'),
$this->getRequest()->getParam('Version'),
$this->getRequest()->getParam('LanguageCode'),
$this->getRequest()->getParam('Pays')
);
$this->view->result = $result;
}
}
}

View File

@ -133,7 +133,7 @@
<h1>Liste des monitoring<img style="margin-top:4px;float:right" src="/themes/default/images/giant/expanded.gif" ></h1>
<a class="dial" title="monitoring" href='/giant/startmonitoring/CompanyId/<?=$this->CompanyId?>/lang/<?=serialize($this->listeRapport->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)?>'>Start monitoring</a>
<a class="dial" title="monitoring" href='/giant/startmonitoring/CompanyId/<?=$this->CompanyId?>/Pays/<?=$this->Pays?>/lang/<?=serialize($this->listeRapport->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)?>'>Start monitoring</a>
<?php echo'<pre>';print_r($this->modification); ?>

View File

@ -1,6 +1,7 @@
<div id="center">
<form>
<input type="hidden" name="CompanyId" value="<?=$this->CompanyId?>" />
<input type="hidden" name="Pays" value="<?=$this->Pays?>" />
<p>
<strong>CompanyId: </strong><?=$this->CompanyId?><br /><br />
@ -25,8 +26,9 @@
<strong>PreferredEndDate: </strong><br />
<input type="text" id='datepicker1' name="EndDate" value="" /> optional<br /><br />
<strong>MonitoringVersion: </strong><br />
<input type="text" name="CategoryName" value="1.0" required /><br /><br />
<input type="text" name="Version" value="1.0" required /><br /><br />
</p>
</form>
<?php echo'<pre>'; print_r($this->values);print_r($this->result);?>
</div>
<script type="text/javascript" src="/themes/default/scripts/giant_monitoring.js" />

View File

@ -1,8 +1,8 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
* and open the template in the editor.
*/
require_once 'Vendors/ChartDirector/phpchartdir.php';
require_once ('Giant/WSgiant.php');
require_once ('Scores/Cache.php');
@ -12,10 +12,10 @@ Class GiantControllerLib
{
private $pathImg;
public function __construct($companyId)
public function __construct($companyId)
{
$c = Zend_Registry::get('config');
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
$c = Zend_Registry::get('config');
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
}
@ -33,14 +33,14 @@ Class GiantControllerLib
$result = $rapport->GetRapport($CompanyId, $Type, $Language);
$result = base64_encode(serialize($result));
$id = $Rapport->setReport($CompanyId,
$Type,
$Pays,
$result,
$Language);
$Type,
$Pays,
$result,
$Language);
}
$report_id = $Rapport->getRapportExistId($CompanyId, $Language);
$CommandeP->login = $Utilisateur->getLogin();
$CommandeP->date = date("Y-m-d");
$CommandeP->typeReport = $function->getTypeReport($Type);
@ -52,63 +52,69 @@ Class GiantControllerLib
print_r($report_id);
echo'</pre>';
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->typeReport, $CommandeP->pays)) {
$Commande->setCommandes($CommandeP);
$Commande->setCommandes($CommandeP);
}*/
$Commande->setCommandes($CommandeP);
return ($id);
}
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);
}
protected function parcourTableau($array)
{
$tableau = array();
foreach($array as $key => $element){
if((is_array($element)) && (($element instanceof stdClass)))
GiantControllerLib::parcourTableau($element);
else
return $element;
}
}
{
$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 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 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 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 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 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 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 getComportementPaiement($report) {
$ComportementPaiement = new ComportementPaiement($report, $this->pathImg);
return ($ComportementPaiement->getDatas());
}
public function getComptesAnnuels($report) {
$ComptesAnnuels = new ComptesAnnuels($report, $this->pathImg);
return ($ComptesAnnuels->getDatas());
}
public function getComptesAnnuels($report) {
$ComptesAnnuels = new ComptesAnnuels($report, $this->pathImg);
return ($ComptesAnnuels->getDatas());
}
public function getComparaisonValeurs($report) {
$ComparaisonValeurs = new ComparaisonValeurs($report, $this->pathImg);
@ -118,208 +124,218 @@ Class GiantControllerLib
Class GiantRechercheController extends GiantFunction
{
protected $listAutorized = array(
'FR' => '006', 'BE' => '001', 'ES' => '001',
'GB' => '002', 'NL' => '003'
);
protected $Provider;
public $soapG;
protected $listAutorized = array(
'FR' => '006', 'BE' => '001', 'ES' => '001',
'GB' => '002', 'NL' => '003'
);
protected $Provider;
public $soapG;
protected $Search;
public $CreditData;
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 __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 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);
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);
}
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();
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'
);
//((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));
}
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);
}
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);
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);
}
foreach ($result->Results->Company as $element) {
if ($element->CompanyId == $siret)
return ($element);
}
return (false);
}
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 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);
}
public function ListeRapport($CompanyId)
{
$this->CreditData = new CreditData($this->soapG, $CompanyId);
$result = $this->CreditData->getMethode('RetreiveOptions', array($CompanyId));
return ($result);
}
}
Class GiantIdentiteController extends GiantControllerLib
{
protected $objet;
protected $datas = array();
protected $liste = array(
'CompanyId', 'Vat', 'CompanyName', 'CompanyStatus',
'CompanyAddress', 'TelephoneNumber', 'Telefax', 'WebAddress',
'EmailAddress', 'IncorporationDate', 'LegalForm', 'IsUltimateParent'
);
protected $objet;
protected $datas = array();
protected $liste = array(
'CompanyId', 'Vat', 'CompanyName', 'CompanyStatus',
'CompanyAddress', 'TelephoneNumber', 'Telefax', 'WebAddress',
'EmailAddress', 'IncorporationDate', 'LegalForm', 'IsUltimateParent'
);
protected $changingStatus = array('FINANCIAL.CREDIT_RECOMMENDATION_CHANGE' => '',
'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' => ''
'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' => ''
);
protected $FinancialSummary = array('Revenue', 'TotalEquity', 'WorkingCapital');
protected $FinancialSummary = array('Revenue', 'TotalEquity', 'WorkingCapital');
public function __construct($objet)
{
$this->objet = $objet;
}
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 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 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);
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];
}
}
} 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 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]);
}
public function getObjet($data)
{
return ($this->datas[$data]);
}
}
?>

View File

@ -216,14 +216,15 @@ Class CreditData extends GiantFunction
return ($result);
}
protected function StartMonitoring($CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version = null, $LanguageCode = null)
protected function StartMonitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode)
{
$parametres = new stdClass();
$parametres->CategorieName = $CategorieName;
$parametres->CompanyId = $CompanyId;
$parametres->CategoryName = $CategorieName;
$parametres->EventType = $EventType;
$parametres->PreferredStartDate = $PreferredStartDate;
$parametres->PreferredEndDate = $PreferredEndDate;
$parametres->Version = $Version;
$parametres->MonitoringVersion = $Version;
$parametres->LanguageCode = $LanguageCode;
try {
$result = $this->soapG->StartMonitoring($parametres);

View File

@ -12,28 +12,32 @@ $('[required]').blur(function() {
});
$(document).ready(function() {
validate();
$(function() {
$("#datepicker").datepicker($.datepicker.regional[ "fr" ]);
$("#datepicker").datepicker($.datepicker.regional["fr"]);
});
$(function() {
$("#datepicker1").datepicker($.datepicker.regional[ "fr" ]);
$("#datepicker1").datepicker($.datepicker.regional["fr"]);
});
$('#dial').dialog({
buttons : [ {
text : "Valider",
click : function() {
var values = $(this).find('form').serialize();
$.post('/giant/startmonitoring', values, function(data) {
$('#dial').html(data);
});
}
}, {
text : "Fermer",
click : function() {
if ($(".message p").text() == 'Cut-off mis à jour.') {
location.reload();
}
$(this).dialog('close');
}
} ]
});
$('#dial').dialog({ buttons: [
{ text: "Valider", click: function() {
var values = $(this).find('form').serialize();
$.post('/giant/startmonitoring', values, function(data) {
$('#dial').html(data);
alert(data);
});
}},
{ text: "Fermer", click: function() {
if($(".message p").text()=='Cut-off mis à jour.') { location.reload(); }
$(this).dialog('close');
}
}
] });
});