Merge from branch 2.7

This commit is contained in:
Michael RICOIS 2015-08-07 13:41:38 +00:00
commit b991ccce98
4 changed files with 66 additions and 49 deletions

View File

@ -97,6 +97,11 @@ class IndexController extends Zend_Controller_Action
}
}
public function odeaAction()
{
$this->redirect('http://odea.scores-decisions.com');
}
/**
* Display browser agent
*/

View File

@ -684,21 +684,16 @@ class SurveillanceController extends Zend_Controller_Action
*/
public function fichierAction()
{
$request = $this->getRequest();
ini_set('max_execution_time', 120);
$request = $this->getRequest();
$user = new Scores_Utilisateur();
$this->view->assign('login', $user->getLogin());
$this->view->assign('nom', $user->getNom());
$client = new SoapClient(null, array(
'trace' => 1,
'soap_version' => SOAP_1_1,
'location' => 'http://78.31.45.206/ws2/',
'uri' => 'http://78.31.45.206/',
'login' => $user->getLogin(),
'password' => $user->getPassword()
));
$client = new Scores_Ws_Client('interne', '0.6');
$nomFic = $request->getParam('nomFic', '');
$getCSV = $request->getParam('get', '');
@ -706,13 +701,7 @@ class SurveillanceController extends Zend_Controller_Action
$c = Zend_Registry::get('config');
$path = $c->profil->path->files;
//Lister les fichiers
/**
* test de client en dur login ou client
* @todo client 32
* @todo client 82
* @todo cnasea, omni, bodacc, cpcambr. . .
*/
// --- Lister les fichiers
if (empty($nomFic)){
$ref = $user->getPrenom();
if ( strtolower($user->getLogin())=='cnasea95'
@ -728,21 +717,25 @@ class SurveillanceController extends Zend_Controller_Action
$ref='*';
}
try {
$O = $client->getListeFichierSurv($user->getLogin(), $ref, $nomFic);
$tabFichier = $O['results'];
$params = new stdClass();
$params->login = $user->getLogin();
$params->ref = $ref;
$params->nomFic = '';
$response = $client->getListeFichierSurv($params);
$tabFichier = $response->result->item;
} catch (SoapFault $fault) {}
$listeFichier = array();
foreach($tabFichier as $fichier){
$tabTmp = explode('_', $fichier);
$tabTmp = explode('_', $fichier->UrlFichier);
$date = new Zend_Date(substr($tabTmp[2],0,8),'yyyyMMdd');
$localfile = $path.'/'.$fichier;
$localfile = $path.'/'.basename($fichier->UrlFichier);
$dejaLu = false;
if (!file_exists($localfile)) {
$dejaLu = true;
}
$result = array(
'fichier' => $fichier,
'fichier' => basename($fichier->UrlFichier),
'date' => $date->toString('dd/MM/yyyy'),
'dejaLu' => $dejaLu,
);
@ -754,10 +747,10 @@ class SurveillanceController extends Zend_Controller_Action
elseif (empty($getCSV))
{
$selectFiltre = array(
'procol' => array('lib'=> 'Procédures collectives', 'select'=>''),
'radiations' => array('lib'=> 'Radiations', 'select'=>''),
'ventes' => array('lib'=> 'Ventes/Cessions', 'select'=>''),
'mmd' => array('lib'=> 'Modifications diverses', 'select'=>''),
'procol' => array('lib'=> 'Procédures collectives', 'select'=>''),
'radiations' => array('lib'=> 'Radiations', 'select'=>''),
'ventes' => array('lib'=> 'Ventes/Cessions', 'select'=>''),
'mmd' => array('lib'=> 'Modifications diverses', 'select'=>''),
);
$filtre = $request->getParam('filtre', '');
@ -769,9 +762,9 @@ class SurveillanceController extends Zend_Controller_Action
$filtre = 'procol';
} elseif (strtolower($user->getLogin())=='cpcambr14') {
$selectFiltre = array(
'radiations' => array('lib'=> 'Radiations', 'select'=>''),
'ventes' => array('lib'=> 'Ventes/Cessions', 'select'=>''),
'mmd' => array('lib'=> 'Modifications diverses', 'select'=>''),
'radiations' => array('lib'=> 'Radiations', 'select'=>''),
'ventes' => array('lib'=> 'Ventes/Cessions', 'select'=>''),
'mmd' => array('lib'=> 'Modifications diverses', 'select'=>''),
);
}
@ -797,16 +790,21 @@ class SurveillanceController extends Zend_Controller_Action
if (!file_exists($file) || filesize($file)==0 ) {
//Génération du fichier
try {
$O = $client->getListeFichierSurv($user->getLogin(), $user->getPrenom(), $nomFic);
$params = new stdClass();
$params->login = $user->getLogin();
$params->ref = $ref;
$params->nomFic = $nomFic;
$response = $client->getListeFichierSurv($params);
$fileUrl = $response->result->item[0]->UrlFichier.'.bz2';
} catch (SoapFault $fault) {}
try {
$client = new Zend_Http_Client('http://78.31.45.206/csv/'.$nomFic.'.bz2');
$client = new Zend_Http_Client($fileUrl);
$client->setStream();
$response = $client->request('GET');
if ( copy($response->getStreamName(), $file.'.bz2') ) {
$bz = bzopen($file.'.bz2', "r") or die("Impossible d'ouvrir le fichier $file");
$fp=fopen($file, 'w');
$bz = bzopen($file.'.bz2', "r");
$fp = fopen($file, 'w');
while (!feof($bz)) {
fwrite($fp, bzread($bz, 4096));
}
@ -892,17 +890,22 @@ class SurveillanceController extends Zend_Controller_Action
$file = $path.'/'.$nomFic;
if (!file_exists($file) || filesize($file)==0 ) {
//Génération du fichier
try {
$O = $client->getListeFichierSurv($user->getLogin(), $user->getPrenom(), $nomFic);
try {
$params = new stdClass();
$params->login = $user->getLogin();
$params->ref = $ref;
$params->nomFic = $nomFic;
$response = $client->getListeFichierSurv($params);
$fileUrl = $response->item[0]->UrlFichier.'.bz2';
} catch (SoapFault $fault) {}
try {
$client = new Zend_Http_Client('http://78.31.45.206/csv/'.$nomFic.'.bz2');
$client = new Zend_Http_Client($fileUrl);
$client->setStream();
$response = $client->request('GET');
if ( copy($response->getStreamName(), $file.'.bz2') ) {
$bz = bzopen($file.'.bz2', "r") or die("Impossible d'ouvrir le fichier $file");
$fp=fopen($file, 'w');
$bz = bzopen($file.'.bz2', "r");
$fp = fopen($file, 'w');
while (!feof($bz)) {
fwrite($fp, bzread($bz, 4096));
}
@ -942,14 +945,7 @@ class SurveillanceController extends Zend_Controller_Action
$user = new Scores_Utilisateur();
$client = new SoapClient(null, array(
'trace' => 1,
'soap_version' => SOAP_1_1,
'location' => 'http://78.31.45.206/ws2/',
'uri' => 'http://78.31.45.206/',
'login' => $user->getLogin(),
'password' => $user->getPassword()
));
$client = new Scores_Ws_Client('interne', '0.6');
$nomFic = $request->getParam('q', '');
@ -978,12 +974,17 @@ class SurveillanceController extends Zend_Controller_Action
$file = $path.'/'.$nomFic;
if (!file_exists($file) || filesize($file)==0 ) {
//Génération du fichier
try {
$O = $client->getListeFichierSurv($user->getLogin(), $user->getPrenom(), $nomFic);
} catch (SoapFault $fault) {}
try {
$params = new stdClass();
$params->login = $user->getLogin();
$params->ref = $ref;
$params->nomFic = $nomFic;
$response = $client->getListeFichierSurv($params);
$fileUrl = $response->item[0]->UrlFichier;
} catch (SoapFault $fault) {}
try {
$client = new Zend_Http_Client('http://78.31.45.206/csv/'.$nomFic.'.bz2');
$client = new Zend_Http_Client($fileUrl);
$client->setStream();
$response = $client->request('GET');
if ( copy($response->getStreamName(), $file.'.bz2') ) {

View File

@ -424,6 +424,11 @@ class Scores_Menu
array('controller'=> 'order', 'action'=>'greffebilan'),
),
'pages' => array(
array(
'label' => 'Données et prospection',
'controller' => 'index',
'action' => 'odea',
),
array(
'label' => 'Nouveautés',
'controller' => 'aide',
@ -925,6 +930,9 @@ class Scores_Menu
case 'order':
return true;
break;
case 'index':
return true;
break;
}
}

View File

@ -7,5 +7,8 @@ return array(
'getRncsJugement' => array(
'debug' => true,
),
'getListeFichierSurv' => array(
'debug' => true,
)
),
);