Fichier CRM
This commit is contained in:
parent
ca541cb6c7
commit
7f3bb2c3fb
@ -168,7 +168,7 @@ class FichierController extends Zend_Controller_Action
|
||||
|
||||
$fichier = $this->getRequest()->getParam('fichier');
|
||||
|
||||
$content_type = 'application/x-bzip2';
|
||||
$content_type = 'application/x-bzip';
|
||||
// --- Envoi du fichier sur la sortie standard
|
||||
$filepath = $directory.'/'.$fichier;
|
||||
if ( file_exists($filepath) ) {
|
||||
|
@ -24,7 +24,8 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
|| ( $controller == 'fichier' && $action == 'kbis' )
|
||||
|| ( $controller == 'fichier' && $action == 'csv' )
|
||||
|| ( $controller == 'fichier' && $action == 'associations' )
|
||||
|| ( $controller == 'fichier' && $action == 'greffes' )) {
|
||||
|| ( $controller == 'fichier' && $action == 'greffes' )
|
||||
|| ( $controller == 'fichier' && $action == 'crm' )) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
|
@ -1478,72 +1478,65 @@ class Interne extends Scores_Ws_Server
|
||||
public function getListeFichierSurv($login, $ref='*', $nomFic='')
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
$path = '/mnt/ftp';
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = "/mnt/clients/oldcrm";
|
||||
if (empty($ref)) $ref = '*';
|
||||
if (empty($nomFic)) $nomFic = '';
|
||||
$error = new ErrorType();
|
||||
$tabFichier=$tabDates=array();
|
||||
$numAbo=substr($ref, 0,5);
|
||||
if (strtolower($login)=='vwbank') {
|
||||
$repClient='volkswagen bank';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDCFTVWBANK';
|
||||
$numAbo=$ref='19300';
|
||||
} elseif (substr($login,0,6)=='apicil') {
|
||||
$repClient='apicil';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDCFTAPICIL';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='omni04') {
|
||||
$repClient='aggm mederic ';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDFTSOMNIREP';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='bodacca3m') {
|
||||
$repClient='aggm mederic ';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDFTSMEDERIC';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='bodaccomni') {
|
||||
$repClient='aggm mederic ';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDFTSOMNIREP';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='bodacccrr') {
|
||||
$repClient='aggm mederic ';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDFTSCRR';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='cpcambr13' || strtolower($login)=='cpcambr14') {
|
||||
$repClient='cpcam des bouches du rhône';
|
||||
$ficClient='diffusionBodacc_DIFBODPRDMAICPCAM13';
|
||||
$numAbo=$ref='';
|
||||
} elseif (strtolower($login)=='frbsurveillance'){
|
||||
$repClient='france boissons';
|
||||
$ficClient='surveillanceBodacc_SURBODPRDFTPFBOISSON';
|
||||
} else {
|
||||
$repClient='cnasea';
|
||||
$ficClient='surveillanceBodacc_SURBODTSTFTSCNASEA';
|
||||
}
|
||||
|
||||
// --- Lecture du repertoire
|
||||
$dh = opendir($path."/$repClient/");
|
||||
$dh = opendir($path."/");
|
||||
if (!$dh) {
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = "Impossible d'ouvrir le dossier client";
|
||||
} else {
|
||||
while (false !== ($filename = readdir($dh))) {
|
||||
if ($filename<>'.' && $filename<>'..' && substr($filename, -4)=='.csv' && substr($filename,0,42)==$ficClient.$numAbo) {
|
||||
if($filename=='.' && $filename=='..')
|
||||
continue;
|
||||
if (substr($filename, -4)=='.csv' && substr($filename,0,42)==$ficClient.$numAbo) {
|
||||
$tabFichier[] = $filename;
|
||||
$tabDates[]=substr($filename,43,8);
|
||||
$tabClients[]=substr($filename,0,42);
|
||||
}
|
||||
elseif ($ref=='*' && $filename<>'.' && $filename<>'..' && substr($filename, -4)=='.csv' && substr($filename,0,37)==$ficClient && substr($filename,37,1)<>'_') {
|
||||
elseif ($ref=='*' && substr($filename, -4)=='.csv' && substr($filename,0,37)==$ficClient && substr($filename,37,1)<>'_') {
|
||||
$tabFichier[] = $filename;
|
||||
$tabDates[]=substr($filename,43,8);
|
||||
$tabClients[]=substr($filename,0,42);
|
||||
}
|
||||
elseif ($filename<>'.' && $filename<>'..' && substr($filename, -4)=='.csv' && substr($filename,0,37)==$ficClient && substr($filename,37,1)=='_' && $repClient=='apicil') {
|
||||
elseif (substr($filename, -4)=='.csv' && substr($filename,0,37)==$ficClient && substr($filename,37,1)=='_') {
|
||||
$tabFichier[] = $filename;
|
||||
$tabDates[]=substr($filename,38,8);
|
||||
$tabClients[]=substr($filename,0,37);
|
||||
}
|
||||
elseif ($filename<>'.' && $filename<>'..' && substr($filename, -4)=='.csv' && substr($filename,0,38)==$ficClient && substr($filename,38,1)=='_' && $repClient=='aggm mederic ') {
|
||||
elseif (substr($filename, -4)=='.csv' && substr($filename,0,38)==$ficClient && substr($filename,38,1)=='_') {
|
||||
$tabFichier[] = $filename;
|
||||
$tabDates[]=substr($filename,39,8);
|
||||
$tabClients[]=substr($filename,0,38);
|
||||
@ -1563,21 +1556,21 @@ class Interne extends Scores_Ws_Server
|
||||
// Boucle sur les dates de livraison
|
||||
foreach ($tabDates as $dateFic) {
|
||||
if (strlen($dateFic)<>8) continue;
|
||||
if (!file_exists($path."/$repClient/$ficClient".'_'."$dateFic.csv") ||
|
||||
filesize($path."/$repClient/$ficClient".'_'."$dateFic.csv")==0) {
|
||||
if (!file_exists($path."/$ficClient".'_'."$dateFic.csv")
|
||||
|| filesize($path."/$ficClient".'_'."$dateFic.csv")==0) {
|
||||
|
||||
$fpW=fopen($path."/$repClient/$ficClient".'_'."$dateFic.csv",'w');
|
||||
$fpW=fopen($path."/$ficClient".'_'."$dateFic.csv",'w');
|
||||
$entete=true;
|
||||
// Boucle afin de vérifier si on est sur le bon client
|
||||
foreach ($tabClients as $nomClient) {
|
||||
$dh = opendir($path."/$repClient/");
|
||||
$dh = opendir($path."/");
|
||||
while (false !== ($filename = readdir($dh))) {
|
||||
if (substr($filename,0,51)==$nomClient.'_'.$dateFic && substr($filename,-4)=='.csv') {
|
||||
$fichier=$filename;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
$fpR=fopen($path."/$repClient/$fichier",'r');
|
||||
$fpR=fopen($path."/".$fichier,'r');
|
||||
//return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'results'=>array(($fichier)));//die;
|
||||
if ($fpR) {
|
||||
while (!feof($fpR)) {
|
||||
@ -1587,8 +1580,9 @@ class Interne extends Scores_Ws_Server
|
||||
$entete=false;
|
||||
}
|
||||
elseif (substr($ligne,0,5)<>'Siren' && trim($ligne)<>'') {
|
||||
fwrite($fpW, strtr($nomClient, array('surveillanceBodacc_SURBODTSTFTS'=>'',
|
||||
'surveillanceBodacc_SURBODPRDCFT'=>'')).';'.$ligne.EOL);
|
||||
fwrite($fpW, strtr($nomClient, array(
|
||||
'surveillanceBodacc_SURBODTSTFTS'=>'',
|
||||
'surveillanceBodacc_SURBODPRDCFT'=>'')).';'.$ligne.EOL);
|
||||
}
|
||||
}
|
||||
fclose($fpR);
|
||||
@ -1603,10 +1597,9 @@ class Interne extends Scores_Ws_Server
|
||||
rsort($tabFichier);
|
||||
|
||||
if ($nomFic!='') {
|
||||
$c = Zend_Registry::get('config');
|
||||
$directory = $c->profil->path->files;
|
||||
if (!file_exists($directory."/$nomFic.bz2") || filesize($directory."/$nomFic.bz2")<=14) {
|
||||
$string = file_get_contents($path."/$repClient/$nomFic");
|
||||
$string = file_get_contents($path."/$nomFic");
|
||||
$bz = bzopen($directory."/$nomFic.bz2",'w');
|
||||
if ($bz) {
|
||||
bzwrite($bz, $string, strlen($string));
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
|
Loading…
Reference in New Issue
Block a user