Désactivation pour problème de performance

This commit is contained in:
Michael RICOIS 2016-09-07 14:34:07 +02:00
parent b73146ad37
commit 64a096d0b3
2 changed files with 64 additions and 65 deletions

View File

@ -21,51 +21,48 @@ class Application_Controller_Plugin_Histo extends Zend_Controller_Plugin_Abstrac
$layout = Zend_Layout::getMVCInstance();
if ( $layout->isEnabled() ) {
$user = new Scores_Utilisateur();
if ( $user->isLog() ) {
$view = $layout->getView();
$view->MenuHisto = true;
// --- Detecter les changements d'entité pour ne recharger la liste qu'au changement
$session = new Zend_Session_Namespace('histo');
$getLogs = true;
if (count($session->UserHisto) > 0) {
Zend_Registry::get('firebug')->info($session->UserHisto);
$lastHisto = $session->UserHisto[0];
if ($lastHisto->CompanyId == $siret) {
$getLogs = false;
}
if ($siret === null) {
$getLogs = false;
}
$view = $layout->getView();
$view->MenuHisto = true;
// --- Detecter les changements d'entité pour ne recharger la liste qu'au changement
$session = new Zend_Session_Namespace('histo');
$getLogs = true;
if (count($session->UserHisto) > 0) {
Zend_Registry::get('firebug')->info($session->UserHisto);
$lastHisto = $session->UserHisto[0];
if ($lastHisto->CompanyId == $siret) {
$getLogs = false;
}
// --- Get Log
if ($getLogs) {
$view->UserHisto = array();
$ws = new Scores_Ws_Client('account', '0.1');
try {
$result = $ws->getUserHistory();
if ($result !== false) {
if (count($result->item) > 0) {
foreach ($result->item as $i) {
$struct = new stdClass();
$struct->CompanyName = $i->CompanyName;
$struct->CompanyId = $i->CompanyId;
$date = new Zend_Date($i->Date);
$struct->Date = $date->toString('dd/MM/yyyy HH:mm:ss');
$view->UserHisto[] = $struct;
}
if ($siret === null) {
$getLogs = false;
}
}
$getLogs = false;
// --- Get Log
if ($getLogs) {
$view->UserHisto = array();
$ws = new Scores_Ws_Client('account', '0.1');
try {
$result = $ws->getUserHistory();
if ($result !== false) {
if (count($result->item) > 0) {
foreach ($result->item as $i) {
$struct = new stdClass();
$struct->CompanyName = $i->CompanyName;
$struct->CompanyId = $i->CompanyId;
$date = new Zend_Date($i->Date);
$struct->Date = $date->toString('dd/MM/yyyy HH:mm:ss');
$view->UserHisto[] = $struct;
}
}
Zend_Registry::get('firebug')->info('PLUGIN HISTO - MAJ');
$session->UserHisto = $view->UserHisto;
} catch (Exception $e) {
Zend_Registry::get('firebug')->info($e->getMessage());
}
} else {
$view->UserHisto = $session->UserHisto;
Zend_Registry::get('firebug')->info('PLUGIN HISTO - MAJ');
$session->UserHisto = $view->UserHisto;
} catch (Exception $e) {
Zend_Registry::get('firebug')->info($e->getMessage());
}
}
} else {
$view->UserHisto = $session->UserHisto;
}
}
Zend_Registry::get('firebug')->info('PLUGIN HISTO - END');
}

View File

@ -26,39 +26,41 @@ class Application_Controller_Plugin_Suivi extends Zend_Controller_Plugin_Abstrac
$layout = Zend_Layout::getMVCInstance();
if ( $layout->isEnabled() ) {
$view = $layout->getView();
$view->MenuSuivi = null;
$view->MenuSuivi = true;
$view->Suivi = array();
$siret = $request->getParam('siret');
$siren = substr($siret, 0, 9);
$ws = new Scores_Ws_Client('entreprise', '0.8');
$params = new stdClass();
$params->filtre->item = $siren;
$params->filtre->itemMode = 'siren';
$params->filtre->source = $source;
$params->filtre->tri = 'siren';
$params->filtre->triMode = 'asc';
$params->filtre->detail = false;
try {
$view->MenuSuivi = true;
$response = $ws->getSurveillances($params);
if ($response !== false) {
if (count($response->result->item[0]->sources->item) > 0) {
$item = $response->result->item[0]->sources->item;
foreach ($item as $i) {
$struct = new stdClass();
$struct->label = $i->ref . " <small>(".$i->source.")</small>";
$view->Suivi[] = $struct;
/*if (intval($siren) != 0) {
$ws = new Scores_Ws_Client('entreprise', '0.8');
$params = new stdClass();
$params->filtre->item = $siren;
$params->filtre->itemMode = 'siren';
$params->filtre->source = $source;
$params->filtre->tri = 'siren';
$params->filtre->triMode = 'asc';
$params->filtre->detail = false;
try {
$view->MenuSuivi = true;
$response = $ws->getSurveillances($params);
if ($response !== false) {
if (count($response->result->item[0]->sources->item) > 0) {
$item = $response->result->item[0]->sources->item;
foreach ($item as $i) {
$struct = new stdClass();
$struct->label = $i->ref . " <small>(".$i->source.")</small>";
$view->Suivi[] = $struct;
}
}
} else {
$view->SuiviMsg = "Chargement impossible !";
}
} else {
$view->SuiviMsg = "Chargement impossible !";
} catch (Exception $e) {
$view->MenuSuivi = null;
Zend_Registry::get('firebug')->info($e->getMessage());
}
} catch (Exception $e) {
$view->MenuSuivi = null;
Zend_Registry::get('firebug')->info($e->getMessage());
}
}*/
}
Zend_Registry::get('firebug')->info('PLUGIN SUIVI - END');