435 lines
18 KiB
PHP
435 lines
18 KiB
PHP
<?php
|
|
require_once 'Giant/WSgiant.php';
|
|
require_once 'Giant/Controllers.lib.php';
|
|
require_once 'Giant/RequestDatabase.lib.php';
|
|
require_once 'Giant/Functions.lib.php';
|
|
|
|
class GiantController extends Zend_Controller_Action
|
|
{
|
|
protected $TestIndication = false;
|
|
protected $config = array();
|
|
|
|
protected $TestCompanies = array(
|
|
'BE' => array(
|
|
'0439546194', '0436576412', '0430459076', '0430000604', '0404869783', '0404869783',
|
|
'0406952018'
|
|
),
|
|
'ES' => array(
|
|
'A00000000', 'A80192727'
|
|
),
|
|
'GB' => array(
|
|
'00000086', '00082932', '98888888', '214436', '1777777', '991581', '1800000'
|
|
),
|
|
'NL' => array(
|
|
'533885', '1383988', '1383989', '891962239', '891974008', '892130032', '896614719',
|
|
'896614735', '896614735', '896615243'
|
|
),
|
|
'FR' => array(
|
|
'55214450300018', '49496793800031', '47997411500012', '48765114300017',
|
|
'43235433000040', '39435613300022', '39504742600014', '76980020200020',
|
|
'35379698000020', '56202109700018', '70204756400068', '70204756400068'
|
|
),
|
|
);
|
|
|
|
protected $Companies = array(
|
|
'FR' =>'France',
|
|
'BE' => 'Belgium',
|
|
'ES' => 'Spain',
|
|
'GB' => 'United Kingdom',
|
|
'NL' => 'The Netherlands',
|
|
);
|
|
|
|
|
|
public function init()
|
|
{
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
|
|
$this->view->debug = false;
|
|
$this->config = new Zend_Config_Ini( APPLICATION_PATH.'/../library/Giant/giant.ini' );
|
|
$this->TestIndication = $this->config->test->TestIndication;
|
|
}
|
|
|
|
public function searchAction()
|
|
{
|
|
$user = new Scores_Utilisateur();
|
|
$params = $this->getRequest()->getParams();
|
|
$search = new GiantRechercheController($params['pays'], $this->TestIndication);
|
|
$result = $search->Liste($params, $this->getRequest()->getParam('page'));
|
|
$this->view->TestIndication= $this->TestIndication;
|
|
$this->view->TestCompanies = $this->TestCompanies[$params['pays']];
|
|
$this->view->label = $search->getObjet()->getLabelDesc();
|
|
$this->view->labelResults = $search->getObjet()->getLabelResults();
|
|
$this->view->pays = $params['pays'];
|
|
$this->view->currentPage = $search->getObjet()->getCurrentPage();
|
|
$this->view->userMaxResult = $user->getNbRep();
|
|
$this->view->resultats = $result;
|
|
$this->view->page = $this->getRequest()->getParam('page');
|
|
$this->view->referer = $search->getObjet()->getQuery();
|
|
$this->view->lienReferer = $search->getQueryLink($params);
|
|
if($this->view->debug)
|
|
$this->view->soap = $search->soapG;
|
|
}
|
|
|
|
public function identiteAction()
|
|
{
|
|
$rechercheParams = new Scores_Session_Recherche();
|
|
$giantFunction = new GiantFunction();
|
|
$test = $this->getRequest()->getParam('test');
|
|
if($test == true){
|
|
$this->TestIndication = true;
|
|
}
|
|
if (count($rechercheParams->liste()) > 0)
|
|
{
|
|
$recherche = $rechercheParams->item(0);
|
|
$type = $recherche['type'];
|
|
$params = $recherche['params'];
|
|
}
|
|
$Commande = new Commandes();
|
|
$user = new Scores_Utilisateur();
|
|
$listeCommandes = $Commande->getCommandesByLogin($user->getLogin());
|
|
$total = 0;
|
|
$liste = $giantFunction->divCommande($listeCommandes, $total);
|
|
$ListeRapport = new GiantRechercheController($params['pays'], $this->TestIndication);
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$result = $giantController->commandePays($this->getRequest()->getParam('CompanyId'),$params['pays'], $this->TestIndication);
|
|
$this->view->TestIndication = $this->TestIndication;
|
|
$this->view->total = $total;
|
|
$this->view->listeCommandes = $liste;
|
|
$this->view->modification = (isset($result->MonitoringOptions))?($ListeRapport->getModification($result->MonitoringOptions->MonitoringOption[0])):null;
|
|
$this->view->description = $ListeRapport->getDescription();
|
|
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
|
|
$this->view->listeRapport = $result;
|
|
$this->view->telephone = $this->getRequest()->getParam('telephone');
|
|
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
|
|
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
|
|
$this->view->CompanyRegisterNumber = $this->getRequest()->getParam('CompanyRegisterNumber');
|
|
$this->view->Pays = $this->getRequest()->getParam('Pays');
|
|
$this->view->Adresse = explode(':', $this->getRequest()->getParam('Adresse'));
|
|
if($this->view->debug)
|
|
$this->view->soap = $ListeRapport->soapG;
|
|
}
|
|
|
|
public function creditrecommendationAction()
|
|
{
|
|
$test = $this->getRequest()->getParam('test');
|
|
if($test == true){
|
|
$this->TestIndication = true;
|
|
}
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('Type'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$this->getRequest()->getParam('Language'),
|
|
$this->TestIndication
|
|
);
|
|
$creditrecommendationAction = array('getAvisDeCredit' => 'CreditRecommendation');
|
|
$creditrecommendation = unserialize(base64_decode($id));
|
|
$identiteController = new GiantIdentiteController($creditrecommendation);
|
|
$giantConstroller = new GiantControllerLib($this->getRequest()->getParam('CompanyId').'-'.$this->getRequest()->getParam('Type'));
|
|
$identiteController->ficheAction();
|
|
$fiche = $identiteController->getObjet('fiche');
|
|
|
|
foreach($creditrecommendationAction as $action => $val) {
|
|
if(isset($creditrecommendation->DataSet->Company->$val)) {
|
|
$creditrecommendation = $giantConstroller->$action($creditrecommendation);
|
|
}
|
|
}
|
|
$fiche = $giantConstroller->getInformationGenerale($creditrecommendation);
|
|
$this->view->carte = $this->getRequest()->getParam('Pays');
|
|
$this->view->reportType = $this->getRequest()->getParam('Type');
|
|
$this->view->report = $fiche;
|
|
$this->view->Type = $this->getRequest()->getParam('Type');
|
|
$this->view->assign('exportObjet', $creditrecommendation);
|
|
}
|
|
|
|
public function compactAction()
|
|
{
|
|
$test = $this->getRequest()->getParam('test');
|
|
if($test == true){
|
|
$this->TestIndication = true;
|
|
}
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('Type'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$this->getRequest()->getParam('Language'),
|
|
$this->TestIndication
|
|
);
|
|
$compactAction = array('getAvisDeCredit' => 'CreditRecommendation', 'getPositionFinanciere' => 'FinancialSummary',
|
|
'getStructureEntreprise' => 'Associated', 'getDirigeant' => 'Position'
|
|
);
|
|
$compact = unserialize(base64_decode($id));
|
|
$identiteController = new GiantIdentiteController($compact);
|
|
$giantConstroller = new GiantControllerLib($this->getRequest()->getParam('CompanyId').'-'.$this->getRequest()->getParam('Type'));
|
|
$identiteController->ficheAction();
|
|
$fiche = $identiteController->getObjet('fiche');
|
|
foreach($compactAction as $action => $val) {
|
|
if(isset($compact->DataSet->Company->$val)) {
|
|
$compact = $giantConstroller->$action($compact);
|
|
}
|
|
}
|
|
$fiche = $giantConstroller->getInformationGenerale($compact);
|
|
$this->view->carte = $this->getRequest()->getParam('Pays');
|
|
$this->view->reportType = $this->getRequest()->getParam('Type');
|
|
$this->view->report = $fiche;
|
|
$this->view->Type = $this->getRequest()->getParam('Type');
|
|
$this->view->assign('exportObjet', $compact);
|
|
}
|
|
|
|
public function fullAction()
|
|
{
|
|
$test = $this->getRequest()->getParam('test');
|
|
if($test == true){
|
|
$this->TestIndication = true;
|
|
}
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId').'-'.$this->getRequest()->getParam('Type'));
|
|
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('Type'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$this->getRequest()->getParam('Language'),
|
|
$this->TestIndication
|
|
);
|
|
$fullAction = array('getAvisDeCredit' => 'CreditRecommendation', 'getComptesAnnuels' => 'AnnualAccounts', 'getPositionFinanciere' => 'FinancialSummary',
|
|
'getComportementPaiement' => 'PaymentBehaviour', 'getStructureEntreprise' => 'Associated', 'getDirigeant' => 'Position',
|
|
'getComparaisonValeurs'=> 'PeerGroup', 'getHistoriques' => 'Event'
|
|
);
|
|
$full = unserialize(base64_decode($id));
|
|
$full->DataSet->Company->CompanyId= $this->getRequest()->getParam('CompanyId');
|
|
$identiteController = new GiantIdentiteController($full);
|
|
$giantConstroller = new GiantControllerLib($this->getRequest()->getParam('CompanyId').'-'.$this->getRequest()->getParam('Type'));
|
|
$identiteController->ficheAction();
|
|
$fiche = $identiteController->getObjet('fiche');
|
|
|
|
foreach($fullAction as $action => $val) {
|
|
if(isset($full->DataSet->Company->$val))
|
|
$full = $giantConstroller->$action($full);
|
|
}
|
|
$fiche = $giantConstroller->getInformationGenerale($full);
|
|
$this->view->carte = $this->getRequest()->getParam('Pays');
|
|
$this->view->reportType = $this->getRequest()->getParam('Type');
|
|
$this->view->report = $fiche;
|
|
$this->view->Type = $this->getRequest()->getParam('Type');
|
|
$this->view->assign('exportObjet', $full);
|
|
}
|
|
|
|
public function getForm()
|
|
{
|
|
$form = new Zend_Form();
|
|
$form->setMethod('post')
|
|
->setAction('investigation');
|
|
|
|
$reference = $form->createElement('text', 'reference', array('label' => 'Votre Reference'));
|
|
$reference->setRequired(true);
|
|
$elements[] = $reference;
|
|
|
|
$telephone = $form->createElement('text', 'telephone', array('label' => 'Votre téléphone'));
|
|
$telephone->setRequired(true);
|
|
$elements[] = $telephone;
|
|
|
|
$mail = $form->createElement('text', 'mail', array('label' => 'Adresse Email'));
|
|
$mail->setRequired(true);
|
|
$elements[] = $mail;
|
|
|
|
$elements[] = $form->createElement('textarea', 'remarque', array('label' => 'Remarque ou commentaire à destination de l\'enquêteur :'));
|
|
$elements[] = $form->createElement('text', 'domiciliation', array('label' => 'Domiciliation Bancaire :'));
|
|
$elements[] = $form->createElement('text', 'Encours', array('label' => 'Encours demandé :'));
|
|
$elements[] = $form->createElement('text', 'nbEcheance', array('label' => 'Nombre d\'échéances :'));
|
|
|
|
$form->addElements($elements)
|
|
->addElement('submit', 'Envoyer', array('label' => 'Envoyer'));
|
|
return ($form);
|
|
}
|
|
|
|
public function investigationAction()
|
|
{
|
|
|
|
if($this->getRequest()->isPost()) {
|
|
$data = $this->getRequest()->getPost();
|
|
if($this->getForm()->isValid($data))
|
|
$this->view->form = $this->getRequest()->getParam('reference');
|
|
else {
|
|
return ($this->view->form = $this->getForm());
|
|
}
|
|
} else
|
|
$this->view->form = $this->getForm();
|
|
}
|
|
public function startmonitoringAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
|
|
$this->view->lang = $this->getRequest()->getParam('lang');
|
|
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
|
|
$this->view->Pays = $this->getRequest()->getParam('Pays');
|
|
$this->view->CompanyName = $this->getRequest()->getParam('CompanyName');
|
|
$this->view->action = $this->getRequest()->getParam('action');
|
|
$this->view->values = $this->getRequest()->getParams();
|
|
$result = new GiantControllerLib();
|
|
foreach($this->Companies as $key=>$pays){
|
|
if(($value = $result->getCache($key)) === false || empty($value->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)) {
|
|
unset($this->Companies[$key]);
|
|
}
|
|
}
|
|
$this->view->countries = $this->Companies;
|
|
if ($this->getRequest()->isPost()) {
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$result = $giantController->startmonitoring($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->TestIndication,
|
|
$this->getRequest()->getParam('CompanyName')
|
|
);
|
|
$this->view->result = $result;
|
|
}
|
|
|
|
}
|
|
public function stopmonitoringAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
|
|
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
|
|
$this->view->InternalOrderId = $this->getRequest()->getParam('InternalOrderId');
|
|
$this->view->Pays = $this->getRequest()->getParam('Pays');
|
|
$this->view->InternalOrderId = $this->getRequest()->getParam('InternalOrderId');
|
|
$this->view->CompanyName = $this->getRequest()->getParam('CompanyName');
|
|
$this->view->action = $this->getRequest()->getParam('action');
|
|
$this->view->values = $this->getRequest()->getParams();
|
|
|
|
if ($this->getRequest()->isPost()) {
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$result = $giantController->stopmonitoring($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('EndDate'),
|
|
$this->getRequest()->getParam('InternalOrderId'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$this->TestIndication
|
|
);
|
|
$this->view->result = $result;
|
|
}
|
|
}
|
|
public function updatemonitoringAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$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->InternalOrderId = $this->getRequest()->getParam('InternalOrderId');
|
|
$this->view->Pays = $this->getRequest()->getParam('Pays');
|
|
$this->view->CompanyName = $this->getRequest()->getParam('CompanyName');
|
|
$this->view->action = $this->getRequest()->getParam('action');
|
|
$this->view->values = $this->getRequest()->getParams();
|
|
|
|
if ($this->getRequest()->isPost()) {
|
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
|
$result = $giantController->updatemonitoring($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('InternalOrderId'),
|
|
$this->getRequest()->getParam('CategoryName'),
|
|
$this->getRequest()->getParam('EventType'),
|
|
$this->getRequest()->getParam('StartDate'),
|
|
$this->getRequest()->getParam('Version'),
|
|
$this->getRequest()->getParam('LanguageCode'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$this->TestIndication
|
|
);
|
|
$this->view->result = $result;
|
|
}
|
|
|
|
}
|
|
public function retriveAction()
|
|
{
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant_monitoring.js', 'text/javascript');
|
|
$giantController = new GiantControllerLib();
|
|
$auth = Zend_Auth::getInstance();
|
|
if ( $auth->hasIdentity() ) {
|
|
$identity = $auth->getIdentity();
|
|
}
|
|
$result = $auth->getStorage()->read($identity);
|
|
if(!empty($result->result->mon_result)){
|
|
$result = $result->result->mon_result;
|
|
}
|
|
else{
|
|
$result = $giantController->retrive(1,$this->TestIndication,'RetrieveMonitoringEventsForCustomer');
|
|
$sess = new stdClass();
|
|
$sess->mon_result = $result;
|
|
$identity->result = $sess;
|
|
$auth->getStorage()->write($identity);
|
|
}
|
|
$resultDB = $giantController->retrivDB();
|
|
$this->view->resultDB = $resultDB;
|
|
$this->view->result = $result;
|
|
$merged =Array();
|
|
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
|
|
if ($merged[$MonitoringEvent->ProviderOrderId]){
|
|
array_push($merged[$MonitoringEvent->ProviderOrderId],$MonitoringEvent) ;
|
|
} else {
|
|
$merged[$MonitoringEvent->ProviderOrderId][]=$MonitoringEvent;
|
|
}
|
|
endforeach;
|
|
$this->view->val = $merged;
|
|
|
|
$merged_siren =Array();
|
|
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
|
|
if ($merged_siren[$MonitoringEvent->Company->CompanyId]){
|
|
array_push($merged_siren[$MonitoringEvent->Company->CompanyId],$MonitoringEvent) ;
|
|
} else {
|
|
$merged_siren[$MonitoringEvent->Company->CompanyId][]=$MonitoringEvent;
|
|
}
|
|
endforeach;
|
|
$this->view->val_siren = $merged_siren;
|
|
|
|
|
|
}
|
|
public function retAction()
|
|
{
|
|
$giantController = new GiantControllerLib();
|
|
$resultDB = $giantController->retrivDB($this->getRequest()->getParam('date_st'));
|
|
print_r(serialize($resultDB[0]));
|
|
}
|
|
public function getpaysAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$pays = $this->getRequest()->getParam('Pays');
|
|
$result = new GiantControllerLib();
|
|
if(($value = $result->getCache($pays)) === false || empty($value->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)) {
|
|
print_r(array('no'));
|
|
}
|
|
else {
|
|
print_r(json_encode($value->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode));
|
|
}
|
|
}
|
|
public function reteventsAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant_monitoring.js', 'text/javascript');
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
|
|
$auth = Zend_Auth::getInstance();
|
|
$identity = $auth->getIdentity();
|
|
$result = $auth->getStorage()->read($identity);
|
|
$result = $result->result->mon_result;
|
|
$merged_siren = Array();
|
|
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
|
|
if ($merged_siren[$MonitoringEvent->Company->CompanyId]){
|
|
array_push($merged_siren[$MonitoringEvent->Company->Event[0]->EventCode],$MonitoringEvent) ;
|
|
} else {
|
|
$merged_siren[$MonitoringEvent->Company->Event[0]->EventCode][]=$MonitoringEvent;
|
|
}
|
|
endforeach;
|
|
$type = $this->getRequest()->getParam('Type');
|
|
$id = $this->getRequest()->getParam('Id');
|
|
|
|
$merged = Array();
|
|
foreach ($merged_siren[$type] as $MonitoringEvent):
|
|
if ($merged[$MonitoringEvent->ProviderOrderId]){
|
|
array_push($merged[$MonitoringEvent->ProviderOrderId],$MonitoringEvent) ;
|
|
} else {
|
|
$merged[$MonitoringEvent->ProviderOrderId][]=$MonitoringEvent;
|
|
}
|
|
endforeach;
|
|
$this->view->result = $merged[$id];
|
|
}
|
|
} |