Gestion des fichiers CRM
This commit is contained in:
parent
bb730beb21
commit
1d18085804
@ -691,14 +691,7 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
$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 +699,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 +715,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->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.'/'.$fichier->UrlFichier;
|
||||
$dejaLu = false;
|
||||
if (!file_exists($localfile)) {
|
||||
$dejaLu = true;
|
||||
}
|
||||
$result = array(
|
||||
'fichier' => $fichier,
|
||||
'fichier' => $fichier->UrlFichier,
|
||||
'date' => $date->toString('dd/MM/yyyy'),
|
||||
'dejaLu' => $dejaLu,
|
||||
);
|
||||
@ -754,10 +745,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 +760,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,11 +788,16 @@ 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->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') ) {
|
||||
@ -892,12 +888,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);
|
||||
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') ) {
|
||||
@ -942,14 +943,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 +972,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') ) {
|
||||
|
@ -7,5 +7,8 @@ return array(
|
||||
'getRncsJugement' => array(
|
||||
'debug' => true,
|
||||
),
|
||||
'getListeFichierSurv' => array(
|
||||
'debug' => true,
|
||||
)
|
||||
),
|
||||
);
|
Loading…
Reference in New Issue
Block a user