Merge from branch 2.7
This commit is contained in:
commit
c6f424a647
19
README
Normal file
19
README
Normal file
@ -0,0 +1,19 @@
|
||||
A FAIRE
|
||||
|
||||
- Un seul fichier autoload_classmap.php
|
||||
application/
|
||||
library/Application
|
||||
library/Metier
|
||||
library/Scores
|
||||
library/SdMetier
|
||||
library/Zend
|
||||
|
||||
- Revoir les services WsScores :
|
||||
Simplification des noms {Service}/v{Version}/Config.php, Service.php, Types.php
|
||||
todo : a supprimer les anciennes class, uniquement pour reperer les changements
|
||||
|
||||
- Modifier library/framework => librairie compatible PSR-autoloading et la placer dans Metier
|
||||
|
||||
- Nouveau batch genTypes.php : permet de générer automatiquement la config à partir du fichier type
|
||||
|
||||
- Faire la nouvelle librairie Scoring : Intégration plus modulaire
|
@ -1,13 +1,12 @@
|
||||
<h1>Démonstration - Liste des méthodes</h1>
|
||||
|
||||
<p class="bg-info">Uniquement disponible à titre d'information. Se référer à la documentation pour réaliser des tests.</p>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
foreach($this->methods as $method){
|
||||
?>
|
||||
<?php foreach($this->methods as $method){ ?>
|
||||
<li>
|
||||
<a href="<?php echo $method['url'];?>">
|
||||
<?php echo $method['nom'];?></a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
@ -186,4 +186,9 @@ Vhost réel
|
||||
|
||||
|
||||
|
||||
|
||||
$db->getProfiler()->setEnabled(true);
|
||||
$db->update( ... );
|
||||
$query = $db->getProfiler()->getLastQueryProfile()->getQuery();
|
||||
$queryParams = $db->getProfiler()->getLastQueryProfile()->getQueryParams();
|
||||
$logger->log('SQL: ' . $db->quoteInto($query, $queryParams), Zend_Log::DEBUG);
|
||||
$db->getProfiler()->setEnabled(false);
|
||||
|
@ -23,7 +23,7 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$config = include APPLICATION_PATH . '/configs/menu.config.php';
|
||||
$container = new Zend_Navigation($config);
|
||||
|
||||
//Add services
|
||||
// --- Add services
|
||||
$pagesService = array();
|
||||
if ( count($view->WsServices)>0 ) {
|
||||
foreach ( $view->WsServices as $service => $params ) {
|
||||
@ -44,6 +44,14 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$found = $container->findOneByLabel("Documentation");
|
||||
$found->addPages($pagesService);
|
||||
|
||||
// --- Secure demo mode
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->idClient != 1) {
|
||||
$toSecure = $container->findOneBy('Label', "Démonstration");
|
||||
$container->removePage($toSecure);
|
||||
}
|
||||
|
||||
$view->navigation($container);
|
||||
}
|
||||
|
||||
|
@ -1,425 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Infogreffe provider
|
||||
*/
|
||||
class Metier_Infogreffe
|
||||
{
|
||||
|
||||
/**
|
||||
* Activate debug mode
|
||||
* @var boolean
|
||||
*/
|
||||
public $debug = false;
|
||||
|
||||
/**
|
||||
* Config definition
|
||||
* @var Zend_Config
|
||||
*/
|
||||
public $config;
|
||||
|
||||
/**
|
||||
* Reference client - customer reference
|
||||
* G[Number]
|
||||
* @var string
|
||||
*/
|
||||
public $reference_client;
|
||||
|
||||
/**
|
||||
* Type de document
|
||||
* @var string
|
||||
*/
|
||||
public $type_document;
|
||||
|
||||
/**
|
||||
* Mode de diffusion
|
||||
* XL : XML
|
||||
* M : Mail
|
||||
* C : Courrier
|
||||
* T : Téléchargement
|
||||
* @var string
|
||||
*/
|
||||
public $mode_diffusion;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $greffe;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $dossier_millesime;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $dossier_statut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $dossier_chrono;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
public $date_depot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $num_depot;
|
||||
|
||||
/**
|
||||
* BI : Date de cloture
|
||||
* @var string
|
||||
*/
|
||||
public $date_cloture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
public $date_acte;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
public $type_acte;
|
||||
|
||||
/**
|
||||
* AC : Numéro de l'acte
|
||||
* @var string
|
||||
*/
|
||||
public $num;
|
||||
|
||||
/**
|
||||
* SIREN
|
||||
* @var string
|
||||
*/
|
||||
public $siren;
|
||||
|
||||
/**
|
||||
* Request XML
|
||||
* @var string
|
||||
*/
|
||||
protected $xml = '';
|
||||
|
||||
/**
|
||||
* Cache delay
|
||||
* @var unknown
|
||||
*/
|
||||
protected $cacheFiletime;
|
||||
|
||||
/**
|
||||
* Initialize configuration
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//Load configuration
|
||||
if ( Zend_Registry::isRegistered('config') ){
|
||||
$c = Zend_Registry::get('config');
|
||||
} else {
|
||||
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
|
||||
}
|
||||
$this->config = $c->profil->infogreffe;
|
||||
if ( null === $this->config ) {
|
||||
throw new Exception('Unable to load configuration file.');
|
||||
}
|
||||
|
||||
$this->cacheFiletime = $c->profil->infogreffe->cache->time;
|
||||
}
|
||||
|
||||
public function callRequest()
|
||||
{
|
||||
$fromCache = false;
|
||||
if ( $this->mode_diffusion == 'XL' && $this->fileIsCache() ){
|
||||
$fromCache = true;
|
||||
}
|
||||
|
||||
if ($fromCache) {
|
||||
$xml = $this->fileFromCache();
|
||||
} else {
|
||||
$xml = $this->getProduitsXML();
|
||||
}
|
||||
|
||||
$this->error($xml);
|
||||
|
||||
if ( $this->mode_diffusion == 'XL' ){
|
||||
$this->fileTocache($xml);
|
||||
}
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data in cache
|
||||
* @param string $xml
|
||||
*/
|
||||
protected function fileTocache($xml)
|
||||
{
|
||||
$filename = $this->type_document . '-' . $this->siren . '.xml';
|
||||
$file = $this->config->cache->path . DIRECTORY_SEPARATOR . $filename;
|
||||
file_put_contents($file, $xml);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $xml
|
||||
* @return string
|
||||
*/
|
||||
protected function fileFromCache()
|
||||
{
|
||||
$filename = $this->type_document . '-' . $this->siren . '.xml';
|
||||
$file = $file = $this->config->cache->path . DIRECTORY_SEPARATOR . $filename;
|
||||
return file_get_contents($file);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function fileIsCache()
|
||||
{
|
||||
$filename = $this->type_document . '-' . $this->siren . '.xml';
|
||||
$file = $file = $this->config->cache->path . DIRECTORY_SEPARATOR . $filename;
|
||||
if ( !file_exists($file) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dateFile = filemtime($file);
|
||||
$now = mktime(date('G'), date('i'), date('s'), date('m') , date('d'), date('Y'));
|
||||
$maxTime = mktime(
|
||||
date('G',$dateFile)+$this->cacheFiletime,
|
||||
date('i',$dateFile),
|
||||
date('s',$dateFile),
|
||||
date("m",$dateFile),
|
||||
date("d",$dateFile),
|
||||
date("Y",$dateFile)
|
||||
);
|
||||
|
||||
if ( $now>$maxTime ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect error
|
||||
* @param string $xml
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function error($xml)
|
||||
{
|
||||
if ( !empty($xml) ) {
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
|
||||
if ( !$load ) {
|
||||
$tmp = explode('-', $xml);
|
||||
$errNum = intval($tmp[0]);
|
||||
$errMsg = $tmp[1];
|
||||
throw new Exception($errMsg, $errNum);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
throw new Exception('XML content is empty.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download file from URL
|
||||
* @param string $url
|
||||
* @param string $filename
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
protected function download($url, $filename)
|
||||
{
|
||||
$file = $this->config->storage->path . '/' . $filename;
|
||||
|
||||
try {
|
||||
$client = new Zend_Http_Client($url);
|
||||
$client->setStream();
|
||||
$response = $client->request('GET');
|
||||
if ( $response->isSuccessful() && substr($response->getBody(),0,4)=='%PDF' ) {
|
||||
if ( copy($response->getStreamName(), $file) ) {
|
||||
return $file;
|
||||
} else {
|
||||
throw new Exception( "Erreur lors de l'ecriture du fichier" );
|
||||
}
|
||||
} else {
|
||||
throw new Exception( "Fichier non PDF" );
|
||||
}
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
throw new Exception( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pdf information
|
||||
* @param string $pdf
|
||||
* @return array
|
||||
* pages => number of pages
|
||||
* version => pdf version
|
||||
* size => pdf filesize
|
||||
*/
|
||||
public function pdfInfos($pdf)
|
||||
{
|
||||
if ( false !== ( $file = file_get_contents( $pdf ) ) ) {
|
||||
//Number of page
|
||||
$pages = preg_match_all( "/\/Page\W/", $file, $matches );
|
||||
|
||||
//Pdf Version
|
||||
preg_match("/^\%PDF\-(.*)\s/U", $file, $matches);
|
||||
$version = $matches[1];
|
||||
|
||||
//Pdf size
|
||||
$size = filesize($pdf);
|
||||
|
||||
return array(
|
||||
'pages' => $pages,
|
||||
'version' => $version,
|
||||
'size' => $size,
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define XML for the request
|
||||
*/
|
||||
protected function setXML()
|
||||
{
|
||||
//Construct the request
|
||||
$xml = new SimpleXMLElement('<demande></demande>');
|
||||
$emetteur = $xml->addChild('emetteur');
|
||||
$emetteur->addChild('code_abonne', $this->config->user);
|
||||
$emetteur->addChild('mot_passe', $this->config->password);
|
||||
|
||||
$code_requete = $emetteur->addChild('code_requete');
|
||||
$code_requete->addChild('type_profil', 'A');
|
||||
$code_requete->addChild('origine_emetteur', 'IC');
|
||||
|
||||
// C = Commande de documents
|
||||
$code_requete->addChild('nature_requete', 'C');
|
||||
|
||||
$code_requete->addChild('type_document', $this->type_document);
|
||||
$code_requete->addChild('type_requete', 'S'); // S = Simple
|
||||
|
||||
// Mode de diffusion : C = Courrier, T = Téléchargement, M = Mail, XL = XML
|
||||
$mode_diffusion = $code_requete->addChild('mode_diffusion');
|
||||
if ( $this->mode_diffusion=='XL' )
|
||||
{
|
||||
//On ajoute tout les types de diffusions pour XL
|
||||
$mode_diffusion->addChild('mode')->addAttribute('type', 'C');
|
||||
$mode_diffusion->addChild('mode')->addAttribute('type', 'T');
|
||||
}
|
||||
$mode_diffusion->addChild('mode')->addAttribute('type', $this->mode_diffusion);
|
||||
|
||||
$code_requete->addChild('media', 'WS');
|
||||
|
||||
$commande = $xml->addChild('commande');
|
||||
$commande->addChild('num_siren', $this->siren);
|
||||
|
||||
if ( $this->mode_diffusion!='XL' )
|
||||
{
|
||||
// Commande de documents : bilan saisie ou bilan complet
|
||||
if ( ($this->type_document=='BS' || $this->type_document=='BI') )
|
||||
{
|
||||
$num_gest = $commande->addChild('num_gest');
|
||||
$num_gest->addChild('greffe',$this->greffe);
|
||||
$num_gest->addChild('dossier_millesime',$this->dossier_millesime);
|
||||
$num_gest->addChild('dossier_statut',$this->dossier_statut);
|
||||
$num_gest->addChild('dossier_chrono',$this->dossier_chrono);
|
||||
$commande->addChild('num_depot',$this->num_depot);
|
||||
//Date de cloture au format dd/MM/yyyy
|
||||
$commande->addChild('date_cloture', $this->date_cloture);
|
||||
}
|
||||
// Commande de documents : actes
|
||||
elseif ( $this->type_document=='AC' )
|
||||
{
|
||||
$num_gest = $commande->addChild('num_gest');
|
||||
$num_gest->addChild('greffe',$this->greffe);
|
||||
$num_gest->addChild('dossier_millesime',$this->dossier_millesime);
|
||||
$num_gest->addChild('dossier_statut',$this->dossier_statut);
|
||||
$num_gest->addChild('dossier_chrono',$this->dossier_chrono);
|
||||
$commande->addChild('num_depot',$this->num_depot);
|
||||
$liste_actes = $commande->addChild('liste_actes');
|
||||
$liste_actes->addChild('acte')->addAttribute('num', $this->num);
|
||||
}
|
||||
}
|
||||
|
||||
//Set Command ID
|
||||
$commande->addChild('reference_client', $this->reference_client);
|
||||
|
||||
$xml = str_replace('<?xml version="1.0"?>', '', $xml->asXML());
|
||||
|
||||
$this->xml = $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send XML Request
|
||||
* We have some problem to use SOAP so we use CURL
|
||||
* @throws Exception
|
||||
* @return string XML Response
|
||||
*/
|
||||
protected function getProduitsXML()
|
||||
{
|
||||
$this->setXML();
|
||||
|
||||
$req = $this->xml;
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents($this->type_document.'-'.$this->siren.'-'.$this->mode_diffusion.'.query', $this->xml);
|
||||
}
|
||||
|
||||
//Create XML request
|
||||
$post = '<?xml version="1.0" encoding="UTF-8"?>'.
|
||||
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" '.
|
||||
'xmlns:ns1="https://webservices.infogreffe.fr/" '.
|
||||
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '.
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '.
|
||||
'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" '.
|
||||
'SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'.
|
||||
'<SOAP-ENV:Body>'.
|
||||
'<ns1:getProduitsWebServicesXML>'.
|
||||
'<param0 xsi:type="xsd:string">'.$req.'</param0>'.
|
||||
'</ns1:getProduitsWebServicesXML>'.
|
||||
'</SOAP-ENV:Body>'.
|
||||
'</SOAP-ENV:Envelope>';
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $this->config->url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE);
|
||||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if ( curl_errno($ch) ) {
|
||||
throw new Exception( curl_error($ch) );
|
||||
}
|
||||
|
||||
//Remove SOAP part of XML
|
||||
$response = str_replace("<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:getProduitsWebServicesXMLResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='xsd:string'>", '', $response);
|
||||
$response = str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>','', $response);
|
||||
|
||||
if ($this->debug) {
|
||||
file_put_contents($this->type_document.'-'.$this->siren.'-'.$this->mode_diffusion.'.response', $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -1,625 +0,0 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Acte
|
||||
*/
|
||||
class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
const INT = 1000;
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $siren
|
||||
*/
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//Set type
|
||||
$this->type_document = 'AC';
|
||||
|
||||
//Set Siren
|
||||
$this->siren = $siren;
|
||||
|
||||
//Get defaut database adapter
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $onlyDb
|
||||
* @return array
|
||||
*/
|
||||
public function getList($onlyDb = false)
|
||||
{
|
||||
$this->mode_diffusion = 'XL';
|
||||
$this->reference_client = 'list-' . $this->siren;
|
||||
|
||||
$actesM = new Application_Model_JoGreffesActes($this->db);
|
||||
|
||||
//Requete WebService
|
||||
$actesXML = null;
|
||||
if ( $onlyDb === false ) {
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
$requestOk = true;
|
||||
} catch( Exception $e ) {
|
||||
$requestOk = false;
|
||||
//file_put_contents('debug.log', $e->getMessage());
|
||||
//@todo : get error message
|
||||
//echo $e->getMessage();
|
||||
}
|
||||
if ( $requestOk === true ) {
|
||||
try {
|
||||
$actesM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
||||
}
|
||||
$actesXML = $this->formatList($xml);
|
||||
}
|
||||
}
|
||||
|
||||
//Lecture de la base de données
|
||||
$sql = $actesM->select()
|
||||
->from($actesM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'pdfSize',
|
||||
'pdfPage',
|
||||
'num_depot',
|
||||
'date_depot',
|
||||
'date_acte',
|
||||
'LPAD(num_acte,2,0) AS num_acte',
|
||||
'type_acte',
|
||||
'type_acte_libelle',
|
||||
'nbpages_acte',
|
||||
'decision_nature',
|
||||
'decision_libelle',
|
||||
'mode_diffusion'
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('actif=1')
|
||||
->order('date_depot DESC')
|
||||
->order('num_depot DESC')
|
||||
->order('num_acte ASC')
|
||||
->order('date_acte DESC');
|
||||
$rows = $actesM->fetchAll($sql);
|
||||
|
||||
$actes = array();
|
||||
if ( count($rows)>0 ) {
|
||||
foreach ( $rows as $row ) {
|
||||
$item = new stdClass();
|
||||
$item->File = $row->pdfLink;
|
||||
$item->FileSize = $row->pdfSize;
|
||||
$item->FileNumberOfPages = $row->pdfPage;
|
||||
$item->DepotNum = $row->num_depot;
|
||||
$item->DepotDate = $row->date_depot;
|
||||
$item->ActeNum = $row->num_acte;
|
||||
$item->ActeDate = $row->date_acte;
|
||||
$item->ActeNumberOfPages = $row->nbpages_acte;
|
||||
$item->ActeType = $row->type_acte;
|
||||
$item->ActeTypeLabel = $row->type_acte_libelle;
|
||||
$item->ActeDecisionNature = $row->decision_nature;
|
||||
$item->ActeDecisionLabel = $row->decision_libelle;
|
||||
|
||||
$decisions = $row->decision_nature;
|
||||
if (!empty($row->decision_nature) && !empty($row->decision_libelle)) {
|
||||
$decisions.= ' : ';
|
||||
}
|
||||
$decisions.= $row->decision_libelle;
|
||||
|
||||
$item->infos[] = $decisions;
|
||||
|
||||
$mode_diffusion = explode(',', $row->mode_diffusion);
|
||||
if (in_array('T',$mode_diffusion) || !empty($item->File)) {
|
||||
$item->ModeDiffusion = 'T';
|
||||
} elseif (in_array('C',$mode_diffusion)) {
|
||||
$item->ModeDiffusion = 'C';
|
||||
} else {
|
||||
$item->ModeDiffusion = '';
|
||||
}
|
||||
|
||||
$actes[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $actes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo : En cours
|
||||
* @param string $depotDate
|
||||
* @param int $depotNum
|
||||
* @param string $acteType
|
||||
* @param string $acteDate
|
||||
* @param int $acteNum
|
||||
* @param int $orderId
|
||||
* @throws Exception
|
||||
* @return string
|
||||
* Return the full path of the file
|
||||
*/
|
||||
public function getCommandeT($depotDate, $depotNum, $acteType, $acteDate, $acteNum, $orderId = null)
|
||||
{
|
||||
//Lire dans la base de données
|
||||
$actesM = new Application_Model_JoGreffesActes($this->db);
|
||||
|
||||
$sql = $actesM->select()
|
||||
->from($actesM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'num_depot',
|
||||
'date_depot',
|
||||
'date_acte',
|
||||
'LPAD(num_acte,2,0) AS num_acte',
|
||||
'type_acte',
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('num_depot=?', $depotNum)
|
||||
->where('date_depot=?', $depotDate)
|
||||
->where('num_acte=?', $acteNum)
|
||||
->where('date_acte=?', $acteDate)
|
||||
->where('type_acte=?', $acteType);
|
||||
|
||||
$row = $actesM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new Exception('Not exist');
|
||||
}
|
||||
|
||||
$this->mode_diffusion = 'T';
|
||||
$this->reference_client = 'T'.date('YmdHis');
|
||||
$this->greffe = $row->numGreffe;
|
||||
$this->dossier_millesime = substr($row->numRC,0,2);
|
||||
$this->dossier_statut = substr($row->numRC,2,1);
|
||||
$this->dossier_chrono = substr($row->numRC,3);
|
||||
$this->date_depot = $row->date_depot;
|
||||
$this->num_depot = $row->num_depot;
|
||||
$this->date_acte = $row->date_acte;
|
||||
$this->num = $row->num_acte;
|
||||
|
||||
//Needed element for filename
|
||||
$date = $row->date_acte;
|
||||
if ( $date == '0000-00-00' ) {
|
||||
$date = $row->date_depot;
|
||||
}
|
||||
$type = $row->type_acte;
|
||||
$num = $row->num_acte;
|
||||
$options = $row->numGreffe . '-' . substr($row->numRC,0,2) . '-' . substr($row->numRC,2,1) . '-' . substr($row->numRC,3) . '-' . $row->num_depot;
|
||||
|
||||
//Set filename
|
||||
$filename = $this->getFilePath($date) . '/' . $this->getFileName($date, $num, $type, $options);
|
||||
|
||||
if ( $row->pdfLink != '' ) {
|
||||
|
||||
//Set the filename
|
||||
$filename = $this->getFilePath($date) . '/' . $row->pdfLink;
|
||||
|
||||
//Check if filename exist
|
||||
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
throw new Exception('File not found', self::INT);
|
||||
}
|
||||
|
||||
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($this->config->storage->path . '/' . $filename);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
throw new Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$acte = $this->formatItem($xml);
|
||||
$url = $acte['actes'][0]['url_acces'];
|
||||
if (empty($url)) {
|
||||
throw new Exception('File url not given');
|
||||
}
|
||||
|
||||
if ( $orderId !== null ) {
|
||||
$commandeM = new Application_Model_Sdv1GreffeCommandesAc();
|
||||
$commandeM->update(array(
|
||||
'cmdUrl'=> $url,
|
||||
'dateCommande' => date('YmdHis'),
|
||||
), 'id='.$orderId);
|
||||
}
|
||||
|
||||
//Récupérer le fichier
|
||||
$getfile = $this->download($url, $filename);
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($getfile);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $depotDate
|
||||
* @param unknown $depotNum
|
||||
* @param unknown $acteType
|
||||
* @param unknown $acteDate
|
||||
* @param unknown $acteNum
|
||||
* @param string $reference
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCommandeC($depotDate, $depotNum, $acteType, $acteDate, $acteNum, $reference = '')
|
||||
{
|
||||
//Lire dans la base de données
|
||||
$actesM = new Application_Model_JoGreffesActes();
|
||||
$sql = $actesM->select()
|
||||
->from($actesM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'num_depot',
|
||||
'date_depot',
|
||||
'date_acte',
|
||||
'LPAD(num_acte,2,0) AS num_acte',
|
||||
'type_acte',
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('num_depot=?', $depotNum)
|
||||
->where('date_depot=?', $depotDate)
|
||||
->where('num_acte=?', $acteNum)
|
||||
->where('date_acte=?', $acteDate)
|
||||
->where('type_acte=?', $acteType);
|
||||
$row = $actesM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new Exception('Not exist');
|
||||
}
|
||||
|
||||
$this->mode_diffusion = 'C';
|
||||
$this->reference_client = $reference;
|
||||
|
||||
//Générer les paramètres de commande depuis la base de données
|
||||
$this->greffe = $row->numGreffe;
|
||||
$this->dossier_millesime = substr($row->numRC,0,2);
|
||||
$this->dossier_statut = substr($row->numRC,2,1);
|
||||
$this->dossier_chrono = substr($row->numRC,3);
|
||||
$this->num_depot = $row->num_depot;
|
||||
$this->type_acte = $row->type_acte;
|
||||
$this->date_acte = $row->date_acte;
|
||||
$this->num = $row->num_acte;
|
||||
|
||||
//Faire la requete
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
//La prise en charge du courrier est effective
|
||||
if ( $e->getCode() != 17 ) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $date
|
||||
* Date de l'acte au format AAAA-MM-JJ
|
||||
* @param string $num
|
||||
* Numéro de l'acte
|
||||
* @param string $type
|
||||
* Type de l'acte
|
||||
* @param string $options
|
||||
* (Numéro du Greffe)-(dossier_millesime)-(dossier_statut)-(dossier_chrono)-(num_depot)
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($date, $num, $type, $options)
|
||||
{
|
||||
$date = substr($date,0,4) . substr($date,5,2) . substr($date,8,2);
|
||||
return 'acte-' . $this->siren . '-' . $type . '-' . $date . '-' . $options . '-' . $num . '.pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $date
|
||||
* Date de l'acte au format AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath($date)
|
||||
{
|
||||
$dir = 'actes/' . substr($date,0,4) . '/' . substr($date,5,2);
|
||||
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
|
||||
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for a list of items
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatList($xml)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
|
||||
$liste_depot_acte = $doc->getElementsByTagName('liste_depot_acte')->item(0);
|
||||
$depot_actes = $liste_depot_acte->getElementsByTagName('depot_acte');
|
||||
$actes = array();
|
||||
foreach($depot_actes as $depot_acte)
|
||||
{
|
||||
$acte = array();
|
||||
|
||||
$acte['num_gest'] = array();
|
||||
$num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0);
|
||||
$acte['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||||
$acte['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||||
$acte['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||||
$acte['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||||
|
||||
$acte['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||||
$acte['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||||
$acte['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue;
|
||||
|
||||
$infoActes = $depot_acte->getElementsByTagName('acte');
|
||||
$acte['depot'] = array();
|
||||
foreach($infoActes as $infoActe)
|
||||
{
|
||||
$actenum = array();
|
||||
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||||
if ($infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue == '') {
|
||||
$actenum['date_acte'] = '0000-00-00';
|
||||
}
|
||||
$actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||||
$actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||||
$actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||||
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||||
if($decision)
|
||||
{
|
||||
$actenum['decision'] = array();
|
||||
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||||
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
$actenum['mode_diffusion'] = array();
|
||||
$mode_diffusion = $infoActe->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
|
||||
foreach($mode_diffusion as $mode)
|
||||
{
|
||||
$actenum['mode_diffusion'][] = $mode->getAttribute('type');
|
||||
}
|
||||
$acte['depot'][] = $actenum;
|
||||
}
|
||||
//Fin listes des infos acte
|
||||
|
||||
//Enregistrer dans la bdd
|
||||
$this->dbUpdateItem($acte);
|
||||
|
||||
//Génération de l'index pour le tri
|
||||
if(!empty($acte['date_depot'])){ $date = $acte['date_depot']; }
|
||||
else { $date = ''; }
|
||||
|
||||
if(!empty($date))
|
||||
{
|
||||
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
|
||||
$key = $datef.'-'.$acte['num_depot'];
|
||||
//Affectation liste générale avec un index permettant le tri
|
||||
$actes[$key] = $acte;
|
||||
}
|
||||
//Prise en compte de l'acte -1
|
||||
if($acte['num_depot']==-1)
|
||||
{
|
||||
$actes[0] = $acte;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Tri suivant la date d'acte ou de depot
|
||||
krsort($actes);
|
||||
return $actes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for one item
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatItem($xml)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
|
||||
$depot_acte = $doc->getElementsByTagName('depot_acte')->item(0);
|
||||
|
||||
$info = array();
|
||||
$info['num_gest'] = array();
|
||||
|
||||
$num_gest = $depot_acte->getElementsByTagName('num_gest')->item(0);
|
||||
|
||||
$info['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||||
$info['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||||
$info['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||||
$info['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||||
|
||||
$info['num_siren'] = $depot_acte->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||||
$info['num_depot'] = $depot_acte->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||||
$info['date_depot'] = $depot_acte->getElementsByTagName('date_depot')->item(0)->nodeValue;
|
||||
|
||||
$infoActes = $depot_acte->getElementsByTagName('acte');
|
||||
$info['actes'] = array();
|
||||
foreach($infoActes as $infoActe)
|
||||
{
|
||||
$actenum = array();
|
||||
$actenum['date_acte'] = $infoActe->getElementsByTagName('date_acte')->item(0)->nodeValue;
|
||||
$actenum['num_acte'] = $infoActe->getElementsByTagName('num_acte')->item(0)->nodeValue;
|
||||
$actenum['type_acte'] = $infoActe->getElementsByTagName('type_acte')->item(0)->nodeValue;
|
||||
$actenum['type_acte_libelle'] = $infoActe->getElementsByTagName('type_acte_libelle')->item(0)->nodeValue;
|
||||
$actenum['nbpages_acte'] = $infoActe->getElementsByTagName('nbpages_acte')->item(0)->nodeValue;
|
||||
|
||||
$decision = $infoActe->getElementsByTagName('decision')->item(0);
|
||||
if($decision)
|
||||
{
|
||||
$actenum['decision'] = array();
|
||||
$actenum['decision']['nature'] = $decision->getElementsByTagName('nature')->item(0)->nodeValue;
|
||||
$actenum['decision']['libelle'] = $decision->getElementsByTagName('libelle')->item(0)->nodeValue;
|
||||
}
|
||||
$actenum['url_acces'] = htmlspecialchars_decode($infoActe->getElementsByTagName('url_acces')->item(0)->nodeValue);
|
||||
$info['actes'][] = $actenum;
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update informations about an item in database
|
||||
* @param array $list
|
||||
*/
|
||||
protected function dbUpdateItem($list)
|
||||
{
|
||||
foreach ($list['depot'] as $depot) {
|
||||
$data = array(
|
||||
'siren' => $list['num_siren'],
|
||||
'numRC' => $list['num_gest']['dossier_millesime'].
|
||||
$list['num_gest']['dossier_statut'].$list['num_gest']['dossier_chrono'],
|
||||
'numGreffe' => $list['num_gest']['greffe'],
|
||||
'num_depot' => $list['num_depot'],
|
||||
'date_depot' => $list['date_depot'],
|
||||
'date_acte' => $depot['date_acte'],
|
||||
'num_acte' => $depot['num_acte'],
|
||||
'type_acte' => $depot['type_acte'],
|
||||
'type_acte_libelle' => $depot['type_acte_libelle'],
|
||||
'nbpages_acte' => $depot['nbpages_acte'],
|
||||
'decision_nature' => empty($depot['decision']['nature']) ? '' : $depot['decision']['nature'] ,
|
||||
'decision_libelle' => empty($depot['decision']['libelle']) ? '' : $depot['decision']['libelle'] ,
|
||||
'mode_diffusion' => join(',',$depot['mode_diffusion']),
|
||||
'actif' => 1,
|
||||
);
|
||||
|
||||
//Only new element are inserted
|
||||
try {
|
||||
$acteM = new Application_Model_JoGreffesActes($this->db);
|
||||
$sql = $acteM->select()
|
||||
->where('siren=?', $list['num_siren'])
|
||||
->where('num_depot=?', intval($list['num_depot']))
|
||||
->where('date_depot=?', $list['date_depot'])
|
||||
//->where('date_acte=?', $depot['date_acte'])
|
||||
->where('num_acte=?', intval($depot['num_acte']))
|
||||
->order('dateInsert DESC');
|
||||
$rows = $acteM->fetchAll($sql);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
//Insert new element
|
||||
if ( count($rows)==0 ) {
|
||||
try {
|
||||
//Add dateInsert
|
||||
$data['dateInsert'] = date('YmdHis');
|
||||
$result = $acteM->insert($data);
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
//Update information
|
||||
else {
|
||||
//Correct multiple item
|
||||
$item = $rows[0];
|
||||
if ( count($rows) > 1 ) {
|
||||
try {
|
||||
$result = $acteM->delete(array(
|
||||
'siren='.$this->siren,
|
||||
'num_depot='.intval($list['num_depot']),
|
||||
'date_depot="'.$list['date_depot'].'"',
|
||||
'num_acte='.intval($depot['num_acte']),
|
||||
'id!='.$item->id,
|
||||
));
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $acteM->update($data, 'id='.$item->id);
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file informations in database
|
||||
* @param string $filename
|
||||
* @param int $size
|
||||
* @param int $numberOfPage
|
||||
* @param string $version
|
||||
* @return boolean
|
||||
*/
|
||||
protected function dbSetFile($filename, $size = 0, $numberOfPage = '', $version = '')
|
||||
{
|
||||
$data = array(
|
||||
'pdfLink' => $filename,
|
||||
'pdfSize' => $size,
|
||||
'pdfPage' => $numberOfPage,
|
||||
'pdfVer' => $version,
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
|
||||
$where = array(
|
||||
'siren='.$this->siren,
|
||||
'num_depot='.$this->num_depot,
|
||||
'date_depot="'.$this->date_depot.'"',
|
||||
'date_acte="'.$this->date_acte.'"',
|
||||
'num_acte='.$this->num,
|
||||
);
|
||||
|
||||
try {
|
||||
$acteM = new Application_Model_JoGreffesActes();
|
||||
$result = $acteM->update($data, $where);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,586 +0,0 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
*/
|
||||
class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
const INT = 1000;
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* consolides|sociaux
|
||||
* @var string
|
||||
*/
|
||||
public $type_comptes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $siren
|
||||
*/
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//Set type
|
||||
$this->type_document = 'BI';
|
||||
|
||||
//Set Siren
|
||||
$this->siren = $siren;
|
||||
|
||||
//Get defaut database adapter
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $onlyDb
|
||||
* @return array
|
||||
*/
|
||||
public function getList($onlyDb = false)
|
||||
{
|
||||
$this->mode_diffusion = 'XL';
|
||||
$this->reference_client = 'list-' . $this->siren;
|
||||
|
||||
$bilansM = new Application_Model_JoGreffesBilans();
|
||||
|
||||
//Requete WebService
|
||||
$bilansXML = null;
|
||||
if ( $onlyDb === false ) {
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
$requestOk = true;
|
||||
} catch( Exception $e ) {
|
||||
$requestOk = false;
|
||||
//@todo : get error message
|
||||
}
|
||||
if ( $requestOk === true ) {
|
||||
//Set All line state to 0
|
||||
try {
|
||||
$bilansM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
||||
}
|
||||
$bilansXML = $this->formatList($xml);
|
||||
}
|
||||
}
|
||||
|
||||
//Lecture de la base de données
|
||||
$sql = $bilansM->select()
|
||||
->from($bilansM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'pdfSize',
|
||||
'pdfPage',
|
||||
'millesime',
|
||||
'num_depot',
|
||||
'date_cloture',
|
||||
'type_comptes',
|
||||
'mode_diffusion',
|
||||
'duree_exercice',
|
||||
'saisie_date',
|
||||
'saisie_code',
|
||||
'pages',
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('actif=1')
|
||||
->order('date_cloture DESC')
|
||||
->order('num_depot DESC')
|
||||
->order('dateInsert DESC');
|
||||
//GROUP BY type_comptes, date_cloture AND ORDER BY num_depot DESC
|
||||
$rows = $bilansM->fetchAll($sql);
|
||||
|
||||
$bilans = array();
|
||||
if ( count($rows)>0 ) {
|
||||
foreach ( $rows as $row ) {
|
||||
$item = new stdClass();
|
||||
$item->File = $row->pdfLink;
|
||||
$item->FileSize = $row->pdfSize;
|
||||
$item->NumberOfPages = $row->pdfPage;
|
||||
$item->Millesime = $row->millesime;
|
||||
$item->NumDepot = $row->num_depot;
|
||||
$item->DateCloture = $row->date_cloture;
|
||||
if ( empty($row->type_comptes) ) {
|
||||
$item->Type = 'sociaux';
|
||||
} else {
|
||||
$item->Type = $row->type_comptes;
|
||||
}
|
||||
$mode_diffusion = explode(',', $row->mode_diffusion);
|
||||
|
||||
if (in_array('T', $mode_diffusion) || !empty($item->File)) {
|
||||
$item->ModeDiffusion = 'T';
|
||||
} elseif (in_array('C',$mode_diffusion)) {
|
||||
$item->ModeDiffusion = 'C';
|
||||
} else {
|
||||
$item->ModeDiffusion = '';
|
||||
}
|
||||
$item->DureeExercice = $row->duree_exercice;
|
||||
|
||||
/**
|
||||
* Following data are not as expected as the type and other data could change
|
||||
* Only num depot don't change.
|
||||
*/
|
||||
$item->SaisieDate = $row->saisie_date;
|
||||
$item->SaisieCode = $row->saisie_code;
|
||||
switch ( $row->saisie_code ) {
|
||||
case '00': $item->SaisieLabel = "Bilan saisi sans anomalie"; break;
|
||||
case '01': $item->SaisieLabel = "Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)"; break;
|
||||
case '02': $item->SaisieLabel = "Bilan avec Actif, Passif ou Compte de Résultat nul"; break;
|
||||
case '03': $item->SaisieLabel = "Bilan incomplet (des pages manquent)"; break;
|
||||
case '04': $item->SaisieLabel = "Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)"; break;
|
||||
case '05': $item->SaisieLabel = "Bilan reçu en double exemplaire"; break;
|
||||
case '06': $item->SaisieLabel = "Bilan intermédiaire - Situation provisoire"; break;
|
||||
case '07': $item->SaisieLabel = "Bilan illisible"; break;
|
||||
case 'A7': $item->SaisieLabel = "Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)"; break;
|
||||
case 'B7': $item->SaisieLabel = "Bilan manuscrits"; break;
|
||||
case 'C7': $item->SaisieLabel = "Bilan illisible, présentant des caractères trop gras"; break;
|
||||
case 'D7': $item->SaisieLabel = "Bilan scanné en biais ou qui présentent des pages rognées"; break;
|
||||
case 'E7': $item->SaisieLabel = "Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)"; break;
|
||||
case 'F7': $item->SaisieLabel = "Bilan illisible"; break;
|
||||
case '08': $item->SaisieLabel = "Bilan consolidé"; break;
|
||||
case '09': $item->SaisieLabel = "Déclaration d'impôts"; break;
|
||||
case '10': $item->SaisieLabel = "Document autre que bilan"; break;
|
||||
case '11': $item->SaisieLabel = "Bilan de clôture de liquidation"; break;
|
||||
case '12': $item->SaisieLabel = "Bilan de Société financière"; break;
|
||||
case '13': $item->SaisieLabel = "Bilan de Société d'assurance"; break;
|
||||
case '14': $item->SaisieLabel = "Bilan de Société immobilière"; break;
|
||||
case '15': $item->SaisieLabel = "Bilan de Société étrangère"; break;
|
||||
default: $item->SaisieLabel = ""; break;
|
||||
}
|
||||
$bilans[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $bilans;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download file
|
||||
* @param string $dateCloture
|
||||
* Format AAAA-MM-DD
|
||||
* @param string $type
|
||||
* sociaux ou consolides
|
||||
* @params int $orderId
|
||||
* Id de commande pour l'enregistrement dans la table de gestion
|
||||
* @throws Exception
|
||||
* @return string
|
||||
* Return path (not complete) and filename
|
||||
*/
|
||||
public function getCommandeT($dateCloture = null, $type = 'sociaux', $orderId = null)
|
||||
{
|
||||
//Lire dans la base de données
|
||||
$bilansM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilansM->select()
|
||||
->from($bilansM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'millesime',
|
||||
'num_depot',
|
||||
'date_cloture',
|
||||
'type_comptes',
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('date_cloture=?', $dateCloture);
|
||||
if ( $type == 'sociaux' || $type == '' ) {
|
||||
$sql->where("(type_comptes='sociaux' OR type_comptes='')");
|
||||
} else {
|
||||
$sql->where('type_comptes=?',$type);
|
||||
}
|
||||
$sql->order('dateInsert DESC')->order('num_depot DESC')->limit(1);
|
||||
|
||||
$row = $bilansM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new Exception("Element doesn't exist");
|
||||
}
|
||||
|
||||
$this->mode_diffusion = 'T';
|
||||
$this->reference_client = 'T'.date('YmdHis');
|
||||
$this->greffe = $row->numGreffe;
|
||||
$this->dossier_millesime = substr($row->numRC,0,2);
|
||||
$this->dossier_statut = substr($row->numRC,2,1);
|
||||
$this->dossier_chrono = substr($row->numRC,3);
|
||||
$this->num_depot = $row->num_depot;
|
||||
$this->date_cloture = $row->date_cloture;
|
||||
$this->type_comptes = $row->type_comptes;
|
||||
|
||||
//Set the filename
|
||||
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
|
||||
|
||||
if ($row->pdfLink != '') {
|
||||
|
||||
//Check if filename exist
|
||||
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
throw new Exception('File not found', self::INT);
|
||||
}
|
||||
|
||||
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($this->config->storage->path . '/' . $filename);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
throw new Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$bilan = $this->formatItem($xml);
|
||||
$url = $bilan['url_acces'];
|
||||
if ( empty($url) ) {
|
||||
throw new Exception('File url not given');
|
||||
}
|
||||
|
||||
if ( $orderId !== null ) {
|
||||
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$commandeM->update(array(
|
||||
'cmdUrl'=> $url,
|
||||
'dateCommande' => date('YmdHis'),
|
||||
), 'id='.$orderId);
|
||||
}
|
||||
|
||||
//Récupérer le fichier
|
||||
$getfile = $this->download($url, $filename);
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($getfile);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo : Vérifier fonctionnement
|
||||
* @param string $dateCloture
|
||||
* @param string $type
|
||||
* @param string $reference
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCommandeC($dateCloture = null, $type = 'sociaux', $reference = '')
|
||||
{
|
||||
$this->mode_diffusion = 'C';
|
||||
|
||||
//Lire dans la base de données
|
||||
$bilansM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilansM->select()
|
||||
->from($bilansM, array(
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'millesime',
|
||||
'num_depot',
|
||||
'date_cloture',
|
||||
'type_comptes',
|
||||
))
|
||||
->where('siren=?', $this->siren)
|
||||
->where('date_cloture=?', $dateCloture);
|
||||
if ($type=='sociaux') {
|
||||
$sql->where("(type_comptes='sociaux' OR type_comptes='')");
|
||||
} else {
|
||||
$sql->where('type_comptes=?',$type);
|
||||
}
|
||||
$row = $bilansM->fetchRow($sql);
|
||||
if ( null === $row ) {
|
||||
throw new Exception('Not exist');
|
||||
}
|
||||
|
||||
$this->reference_client = $reference;
|
||||
|
||||
//Générer les paramètres de commande depuis la base de données
|
||||
$this->greffe = $row->numGreffe;
|
||||
$this->dossier_millesime = substr($row->numRC,0,2);
|
||||
$this->dossier_statut = substr($row->numRC,2,1);
|
||||
$this->dossier_chrono = substr($row->numRC,3);
|
||||
$this->num_depot = $row->num_depot;
|
||||
$this->date_cloture = $row->date_cloture;
|
||||
|
||||
//Faire la requete
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
//La prise en charge du courrier est effective
|
||||
if ( $e->getCode() != 17 ) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$date = substr($dateCloture,0,4).substr($dateCloture,5,2).substr($dateCloture,8,2);
|
||||
|
||||
return 'bilan-' . $this->siren . '-' . $type . '-' . $date . '.pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
|
||||
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
|
||||
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for a list of items
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatList($xml)
|
||||
{
|
||||
//Parse XML to make an array
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
$liste_bilan_complet = $doc->getElementsByTagName('liste_bilan_complet')->item(0);
|
||||
$bilan_complet = $liste_bilan_complet->getElementsByTagName('bilan_complet');
|
||||
|
||||
$bilans = array();
|
||||
if ( count($bilan_complet)>0 )
|
||||
{
|
||||
foreach( $bilan_complet as $element )
|
||||
{
|
||||
$bilan = array();
|
||||
$num_gest = $element->getElementsByTagName('num_gest')->item(0);
|
||||
$bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||||
$bilan['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||||
$bilan['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||||
$bilan['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||||
$bilan['num_siren'] = $element->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||||
$bilan['date_cloture'] = $element->getElementsByTagName('date_cloture')->item(0)->nodeValue;
|
||||
$bilan['date_cloture_iso'] = $element->getElementsByTagName('date_cloture_iso')->item(0)->nodeValue;
|
||||
$bilan['millesime'] = $element->getElementsByTagName('millesime')->item(0)->nodeValue;
|
||||
$bilan['num_depot'] = $element->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||||
$bilan['type_comptes'] = $element->getElementsByTagName('type_comptes')->item(0)->nodeValue;
|
||||
$mode_diffusion = $element->getElementsByTagName('mode_diffusion')->item(0)->getElementsByTagName('mode');
|
||||
foreach($mode_diffusion as $mode)
|
||||
{
|
||||
$bilan['mode_diffusion'][] = $mode->getAttribute('type');
|
||||
}
|
||||
|
||||
//Enregistrer dans la bdd
|
||||
$this->dbUpdateItem($bilan);
|
||||
|
||||
//Génération de l'index pour le tri
|
||||
$date = $bilan['date_cloture_iso'];
|
||||
if( !empty($date) )
|
||||
{
|
||||
$key = substr($date,0,4).substr($date,5,2).substr($date,8,2).'-'.$bilan['num_depot'];
|
||||
//Affectation liste générale avec un index permettant le tri
|
||||
$bilans[$key] = $bilan;
|
||||
}
|
||||
}
|
||||
}
|
||||
krsort($bilans);
|
||||
return $bilans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for one item
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatItem($xml)
|
||||
{
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadXML($xml);
|
||||
$bilan_complet = $doc->getElementsByTagName('bilan_complet')->item(0);
|
||||
$bilan = array();
|
||||
$bilan['num_gest'] = array();
|
||||
$num_gest = $bilan_complet->getElementsByTagName('num_gest')->item(0);
|
||||
$bilan['num_gest']['greffe'] = $num_gest->getElementsByTagName('greffe')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_millesime'] = $num_gest->getElementsByTagName('dossier_millesime')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_statut'] = $num_gest->getElementsByTagName('dossier_statut')->item(0)->nodeValue;
|
||||
$bilan['num_gest']['dossier_chrono'] = $num_gest->getElementsByTagName('dossier_chrono')->item(0)->nodeValue;
|
||||
$bilan['num_siren'] = $bilan_complet->getElementsByTagName('num_siren')->item(0)->nodeValue;
|
||||
$bilan['date_cloture'] = $bilan_complet->getElementsByTagName('date_cloture')->item(0)->nodeValue;
|
||||
$bilan['date_cloture_iso'] = $bilan_complet->getElementsByTagName('date_cloture_iso')->item(0)->nodeValue;
|
||||
$bilan['millesime'] = $bilan_complet->getElementsByTagName('millesime')->item(0)->nodeValue;
|
||||
$bilan['num_depot'] = $bilan_complet->getElementsByTagName('num_depot')->item(0)->nodeValue;
|
||||
$bilan['type_comptes'] = $bilan_complet->getElementsByTagName('type_comptes')->item(0)->nodeValue;
|
||||
$bilan['url_acces'] = $bilan_complet->getElementsByTagName('url_acces')->item(0)->nodeValue;
|
||||
|
||||
return $bilan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update informations about an item in database
|
||||
* @param array $list
|
||||
* @return boolean
|
||||
*/
|
||||
protected function dbUpdateItem($list)
|
||||
{
|
||||
//Insert or Update
|
||||
$data = array(
|
||||
'siren' => $list['num_siren'],
|
||||
'numRC' => $list['num_gest']['dossier_millesime'].
|
||||
$list['num_gest']['dossier_statut'].$list['num_gest']['dossier_chrono'],
|
||||
//'numRC2' => '',
|
||||
'numGreffe' => intval($list['num_gest']['greffe']),
|
||||
'millesime' => $list['millesime'],
|
||||
'num_depot' => $list['num_depot'],
|
||||
'date_cloture' => $list['date_cloture_iso'],
|
||||
'type_comptes' => $list['type_comptes'],
|
||||
'mode_diffusion' => join(',',$list['mode_diffusion']),
|
||||
'actif' => 1,
|
||||
);
|
||||
|
||||
$this->db->getProfiler()->setEnabled(true);
|
||||
|
||||
try {
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilanM->select()
|
||||
->where('siren=?', $this->siren)
|
||||
->where('num_depot=?', $list['num_depot'])
|
||||
->where('date_cloture=?', $list['date_cloture_iso'])
|
||||
//->where('type_comptes=?', $list['type_comptes'])
|
||||
->order('dateInsert ASC');
|
||||
$rows = $bilanM->fetchAll($sql);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
/*echo $query = $this->db->getProfiler()->getLastQueryProfile()->getQuery();
|
||||
echo "\n";
|
||||
$queryParams = $this->db->getProfiler()->getLastQueryProfile()->getQueryParams();
|
||||
print_r($queryParams);
|
||||
echo "\n";*/
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
$this->db->getProfiler()->setEnabled(false);
|
||||
|
||||
if ( count($rows) == 0 ) {
|
||||
//Add dateInsert
|
||||
$data['dateInsert'] = date('YmdHis');
|
||||
try {
|
||||
$result = $bilanM->insert($data);
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
//Correct multiple item
|
||||
$item = $rows[0];
|
||||
if ( count($rows) > 1 ) {
|
||||
try {
|
||||
$result = $bilanM->delete(array(
|
||||
$bilanM->getAdapter()->quoteInto('siren=?', $this->siren),
|
||||
$bilanM->getAdapter()->quoteInto('num_depot=?', $list['num_depot']),
|
||||
$bilanM->getAdapter()->quoteInto('date_cloture=?', $list['date_cloture_iso']),
|
||||
$bilanM->getAdapter()->quoteInto('type_comptes=?', $list['type_comptes']),
|
||||
'id!='.$item->id,
|
||||
));
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $bilanM->update($data, 'id='.$item->id);
|
||||
} catch(Zend_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file informations in database
|
||||
* @param string $filename
|
||||
* @param int $size
|
||||
* @param int $numberOfPage
|
||||
* @param string $version
|
||||
* @return boolean
|
||||
*/
|
||||
public function dbSetFile($filename, $size = 0, $numberOfPage = '', $version = '')
|
||||
{
|
||||
$data = array(
|
||||
'pdfLink' => $filename,
|
||||
'pdfSize' => $size,
|
||||
'pdfPage' => $numberOfPage,
|
||||
'pdfVer' => $version,
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
|
||||
$where = array(
|
||||
'siren='.$this->siren,
|
||||
'date_cloture="'.$this->date_cloture.'"',
|
||||
'type_comptes="'.$this->type_comptes.'"',
|
||||
);
|
||||
|
||||
try {
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$result = $bilanM->update($data, $where);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
*/
|
||||
class Metier_Infogreffe_St extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $siren
|
||||
*/
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//Set type
|
||||
$this->type_document = 'ST';
|
||||
|
||||
//Set Siren
|
||||
$this->siren = $siren;
|
||||
|
||||
//Get defaut database adapter
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getCommandeT()
|
||||
{
|
||||
|
||||
$this->mode_diffusion = 'T';
|
||||
$this->reference_client = 'T'.date('YmdHis');
|
||||
|
||||
//Set the filename
|
||||
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
|
||||
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
throw new Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$item = $this->formatItem($xml);
|
||||
$url = $item['url_acces'];
|
||||
if ( empty($url) ) {
|
||||
throw new Exception('File url not given');
|
||||
}
|
||||
|
||||
if ( $orderId !== null ) {
|
||||
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$commandeM->update(array(
|
||||
'cmdUrl'=> $url,
|
||||
'dateCommande' => date('YmdHis'),
|
||||
), 'id='.$orderId);
|
||||
}
|
||||
|
||||
//Récupérer le fichier
|
||||
$getfile = $this->download($url, $filename);
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($getfile);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$date = substr($dateCloture,0,4).substr($dateCloture,5,2).substr($dateCloture,8,2);
|
||||
|
||||
return 'ST-' . $this->siren . '-' . $type . '-' . $date . '.pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
|
||||
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
|
||||
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for a list of items
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatList($xml)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for one item
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatItem($xml)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update informations about an item in database
|
||||
* @param array $list
|
||||
* @return boolean
|
||||
*/
|
||||
protected function dbUpdateItem($list)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file informations in database
|
||||
* @param string $filename
|
||||
* @param int $size
|
||||
* @param int $numberOfPage
|
||||
* @param string $version
|
||||
* @return boolean
|
||||
*/
|
||||
public function dbSetFile($filename, $size = 0, $numberOfPage = '', $version = '')
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
|
||||
INFOGREFFE
|
||||
----------
|
||||
|
||||
Document
|
||||
AC =>
|
||||
BI =>
|
||||
ST =>
|
||||
|
||||
File name pattern
|
||||
|
||||
AC => acte-[siren]-[type]-[YYYYMMdd]-[num].pdf
|
||||
siren = [0-9]{9}
|
||||
type =
|
||||
num = [0-9]{2}
|
||||
|
||||
Files are store in actes/YYYY/MM/filename.pdf
|
||||
|
||||
BI => bilan-[siren]-[type]-[YYYYMMdd].pdf
|
||||
siren = [0-9]{9}
|
||||
type = [consolide|sociaux]
|
||||
|
||||
Files are store in bilans/[type]/[YYYY];
|
||||
|
||||
ST => statut-
|
||||
|
||||
Files are store in status/
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
Add to the main configuration (application.ini), these keys :
|
||||
- infogreffe.cache.path => path for storing cache file
|
||||
- infogreffe.cache.time => define end of life for the cache in hours
|
||||
- infogreffe.storage.path =>
|
||||
|
||||
- infogreffe.wsdl = infogreffe.wsdl
|
||||
- infogreffe.url = https://webservices.infogreffe.fr/WSContextInfogreffe/INFOGREFFE
|
||||
- infogreffe.uri = https://webservices.infogreffe.fr/
|
||||
- infogreffe.user = 85000109
|
||||
- infogreffe.password = 166
|
||||
|
||||
|
||||
|
||||
- Rattraper l'historique des documents et les liés à jo.greffes_bilans et jo.greffes_actes
|
||||
Attention : Type de document 1 et 2
|
||||
Vérifier que nous possèdons le maximum d'infos sur l'association type 1 et 2
|
||||
Sinon passer une moulinette, pour chaque siren, récupérer la liste et analyse avec la table actes_files
|
||||
|
||||
jo.greffes_actes : Ajout d'une colonne type_acte2
|
||||
|
||||
Il est possible sans le type de trouver le fichier
|
||||
|
||||
SELECT siren, count(siren) as nb FROM `actes_files` WHERE `type_libelle` = '' GROUP BY siren ORDER BY nb DESC
|
@ -1,80 +0,0 @@
|
||||
|
||||
<definitions
|
||||
targetNamespace="java:com.experian.webserv.infogreffe"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="java:com.experian.webserv.infogreffe"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
>
|
||||
<types>
|
||||
<schema targetNamespace='java:com.experian.webserv.infogreffe'
|
||||
xmlns='http://www.w3.org/2001/XMLSchema'>
|
||||
</schema>
|
||||
</types>
|
||||
<message name="getProduitsWebServicesXMLRequest">
|
||||
<part name="arg0" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesXMLResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesRequest">
|
||||
<part name="arg0" type="xsd:string" />
|
||||
<part name="arg1" type="xsd:string" />
|
||||
<part name="arg2" type="xsd:string" />
|
||||
<part name="arg3" type="xsd:string" />
|
||||
<part name="arg4" type="xsd:string" />
|
||||
<part name="arg5" type="xsd:string" />
|
||||
<part name="arg6" type="xsd:string" />
|
||||
<part name="arg7" type="xsd:string" />
|
||||
<part name="arg8" type="xsd:string" />
|
||||
<part name="arg9" type="xsd:string" />
|
||||
<part name="arg10" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getVersionRequest">
|
||||
</message>
|
||||
<message name="getVersionResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<portType name="WebServicesProduitsPortType">
|
||||
<operation name="getProduitsWebServicesXML">
|
||||
<input message="tns:getProduitsWebServicesXMLRequest"/>
|
||||
<output message="tns:getProduitsWebServicesXMLResponse"/>
|
||||
</operation>
|
||||
<operation name="getProduitsWebServices">
|
||||
<input message="tns:getProduitsWebServicesRequest"/>
|
||||
<output message="tns:getProduitsWebServicesResponse"/>
|
||||
</operation>
|
||||
<operation name="getVersion">
|
||||
<input message="tns:getVersionRequest"/>
|
||||
<output message="tns:getVersionResponse"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name="WebServicesProduitsBinding" type="tns:WebServicesProduitsPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="getProduitsWebServicesXML">
|
||||
<soap:operation soapAction="urn:getProduitsWebServicesXML"/>
|
||||
<input><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
<operation name="getProduitsWebServices">
|
||||
<soap:operation soapAction="urn:getProduitsWebServices"/>
|
||||
<input><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
<operation name="getVersion">
|
||||
<soap:operation soapAction="urn:getVersion"/>
|
||||
<input><soap:body use="encoded" namespace='urn:Version' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:Version' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name="WebServicesProduits">
|
||||
<documentation>Service Soap Experian, Service Produit</documentation>
|
||||
<port name="WebServicesProduitsPort" binding="tns:WebServicesProduitsBinding">
|
||||
<soap:address location="https://webservices.infogreffe.fr:443/WSContextInfogreffe/INFOGREFFE"/>
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
@ -1,80 +0,0 @@
|
||||
|
||||
<definitions
|
||||
targetNamespace="java:com.experian.webserv.infogreffe"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="java:com.experian.webserv.infogreffe"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
>
|
||||
<types>
|
||||
<schema targetNamespace='java:com.experian.webserv.infogreffe'
|
||||
xmlns='http://www.w3.org/2001/XMLSchema'>
|
||||
</schema>
|
||||
</types>
|
||||
<message name="getProduitsWebServicesXMLRequest">
|
||||
<part name="arg0" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesXMLResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesRequest">
|
||||
<part name="arg0" type="xsd:string" />
|
||||
<part name="arg1" type="xsd:string" />
|
||||
<part name="arg2" type="xsd:string" />
|
||||
<part name="arg3" type="xsd:string" />
|
||||
<part name="arg4" type="xsd:string" />
|
||||
<part name="arg5" type="xsd:string" />
|
||||
<part name="arg6" type="xsd:string" />
|
||||
<part name="arg7" type="xsd:string" />
|
||||
<part name="arg8" type="xsd:string" />
|
||||
<part name="arg9" type="xsd:string" />
|
||||
<part name="arg10" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getProduitsWebServicesResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<message name="getVersionRequest">
|
||||
</message>
|
||||
<message name="getVersionResponse">
|
||||
<part name="return" type="xsd:string" />
|
||||
</message>
|
||||
<portType name="WebServicesProduitsPortType">
|
||||
<operation name="getProduitsWebServicesXML">
|
||||
<input message="tns:getProduitsWebServicesXMLRequest"/>
|
||||
<output message="tns:getProduitsWebServicesXMLResponse"/>
|
||||
</operation>
|
||||
<operation name="getProduitsWebServices">
|
||||
<input message="tns:getProduitsWebServicesRequest"/>
|
||||
<output message="tns:getProduitsWebServicesResponse"/>
|
||||
</operation>
|
||||
<operation name="getVersion">
|
||||
<input message="tns:getVersionRequest"/>
|
||||
<output message="tns:getVersionResponse"/>
|
||||
</operation>
|
||||
</portType>
|
||||
<binding name="WebServicesProduitsBinding" type="tns:WebServicesProduitsPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<operation name="getProduitsWebServicesXML">
|
||||
<soap:operation soapAction="urn:getProduitsWebServicesXML"/>
|
||||
<input><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
<operation name="getProduitsWebServices">
|
||||
<soap:operation soapAction="urn:getProduitsWebServices"/>
|
||||
<input><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:WebServicesProduits' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
<operation name="getVersion">
|
||||
<soap:operation soapAction="urn:getVersion"/>
|
||||
<input><soap:body use="encoded" namespace='urn:Version' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
|
||||
<output><soap:body use="encoded" namespace='urn:Version' encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
|
||||
</operation>
|
||||
</binding>
|
||||
<service name="WebServicesProduits">
|
||||
<documentation>Service Soap Experian, Service Produit</documentation>
|
||||
<port name="WebServicesProduitsPort" binding="tns:WebServicesProduitsBinding">
|
||||
<soap:address location="https://wsrcte.extelia.fr:80/WSContextInfogreffe/INFOGREFFE"/>
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
@ -846,7 +846,7 @@ class MInsee
|
||||
$siren=$siren_siret;
|
||||
else
|
||||
return false;
|
||||
$rep=$this->iDb->select('identite', 'CJ', "SIREN='$siren'");
|
||||
$rep=$this->iDb->select('insee.identite', 'CJ', "SIREN='$siren'");
|
||||
return $rep[0][0];
|
||||
}
|
||||
|
||||
@ -1183,12 +1183,12 @@ class MInsee
|
||||
$this->tabCodesNace = include $cacheNace;
|
||||
} else {
|
||||
$tabNafs = $tabNace = array();
|
||||
$tabTmp = $this->iDb->select('tabNaf4', 'codNaf700 AS naf, libNaf700 AS LibNaf', 1, false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.tabNaf4', 'codNaf700 AS naf, libNaf700 AS LibNaf', 1, false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf) {
|
||||
$tabNafs[$tabNaf['naf']]=$tabNaf['LibNaf'];
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDb->select('tabNaf5', 'codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1', 1, false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.tabNaf5', 'codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1', 1, false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf) {
|
||||
$tabNafs[$tabNaf['naf']]=$tabNaf['LibNaf'];
|
||||
$tabNace[$tabNaf['naf']]=$tabNaf['codNaf1'].preg_replace('/^0/','',substr($tabNaf['naf'],0,4));
|
||||
@ -1234,7 +1234,7 @@ class MInsee
|
||||
$this->tabCodesNafa = include $cache;
|
||||
} else {
|
||||
$tabNafs=array();
|
||||
$tabTmp=$this->iDb->select( 'tabNafa', 'codNafa AS nafa, libNafa', 1, true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabNafa', 'codNafa AS nafa, libNafa', 1, true, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf)
|
||||
$tabNafs[$tabNaf['nafa']]=$tabNaf['libNafa'];
|
||||
$this->tabCodesNafa=$tabNafs;
|
||||
@ -1527,7 +1527,7 @@ class MInsee
|
||||
{
|
||||
$fj=$code_forme_juridique*1;
|
||||
if ($fj>0 && $fj<10000) {
|
||||
$tmp=$this->iDb->select('tabFJur', 'libelle AS LibFJ, libelleCourt AS LibCourt', "code=$fj", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabFJur', 'libelle AS LibFJ, libelleCourt AS LibCourt', "code=$fj", false, MYSQL_ASSOC);
|
||||
$libLong =@$tmp[0]['LibFJ'];
|
||||
$libCourt=@$tmp[0]['LibCourt'];
|
||||
if ($court) {
|
||||
@ -1555,7 +1555,7 @@ class MInsee
|
||||
if ( file_exists($cache) ) {
|
||||
$tabFJ = include $cache;
|
||||
} else {
|
||||
$tabTmp=$this->iDb->select('tabFJur', 'code AS FJ, libelle AS libFJ', 'code>=1000', false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabFJur', 'code AS FJ, libelle AS libFJ', 'code>=1000', false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabCJ)
|
||||
$tabFJ[$tabCJ['FJ']]=str_replace('"','\"',$tabCJ['libFJ']);
|
||||
}
|
||||
@ -1687,29 +1687,29 @@ class MInsee
|
||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren=$siren $strDep $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
//Search without NIC
|
||||
elseif ($nic=='') {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"e.siren=$siren $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
//Search with NIC
|
||||
else {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
@ -1730,9 +1730,9 @@ class MInsee
|
||||
}
|
||||
}
|
||||
$strSiren=implode(',',$listeSiren);
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren IN ($strSiren) AND siege=1 ORDER BY e.rang DESC, e.actif DESC, e.nic ASC $limit", true, MYSQL_ASSOC);
|
||||
$strInfo='Siren saisi invalide';
|
||||
}
|
||||
@ -1755,7 +1755,7 @@ class MInsee
|
||||
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
if ( count($resultPays)>0 ) {
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
@ -1833,9 +1833,9 @@ class MInsee
|
||||
if ($typeId=='TEL') {
|
||||
debugLog('I',"Recherche par TEL de $id avec un maximum de $nbRep réponses",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep,".
|
||||
@ -1867,9 +1867,9 @@ class MInsee
|
||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
}
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
@ -1881,7 +1881,7 @@ class MInsee
|
||||
{
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
|
||||
@ -1934,7 +1934,7 @@ class MInsee
|
||||
function sirenExiste($siren)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$listeEtab=$this->iDb->select('etablissements', 'id', "siren=$siren LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$listeEtab=$this->iDb->select('jo.etablissements', 'id', "siren=$siren LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if (@count($listeEtab)>0)
|
||||
return true;
|
||||
return false;
|
||||
@ -1959,7 +1959,7 @@ class MInsee
|
||||
|
||||
$tabRet = array();
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"e.id, e.source, e.source_id, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0), e.siege, e.autre_id, e.triCode, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
@ -2036,7 +2036,7 @@ class MInsee
|
||||
{
|
||||
if (trim($codeIso)<>'') $strWhere="devIso='$codeIso'";
|
||||
else $strWhere='1';
|
||||
$liste=$this->iDb->select('tabDevises', 'devIso, devNom', $strWhere, false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabDevises', 'devIso, devNom', $strWhere, false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($liste as $ligne)
|
||||
$tabRet[$ligne['devIso']]=$ligne['devNom'];
|
||||
@ -2065,7 +2065,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 $strIdCA $strType ORDER BY sirenGrp", true, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 $strIdCA $strType ORDER BY sirenGrp", true, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2098,7 +2098,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 $strIdCA $strType $strCp ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 $strIdCA $strType $strCp ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2114,7 +2114,7 @@ class MInsee
|
||||
public function getMandataire($idMand)
|
||||
{
|
||||
$fields='id,sirenGrp,sirenMand,Nom,Prenom,type,coursAppel,coursAppel2,tribunal,Statut,stagiaire,adresse,adresseComp,cp,ville,tel,fax,email,web,contact';
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "id=$idMand", true, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "id=$idMand", true, MYSQL_ASSOC);
|
||||
return @$liste[0];
|
||||
}
|
||||
|
||||
@ -2129,7 +2129,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 AND type='H' $strIdCA ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 AND type='H' $strIdCA ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2144,7 +2144,7 @@ class MInsee
|
||||
**/
|
||||
public function getMandatairesParId($idMand) {
|
||||
if ($idMand>0) {
|
||||
$liste=$this->iDb->select('tabMandataires', "CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand", "id=$idMand", false);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', "CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand", "id=$idMand", false);
|
||||
return $liste[0][0];
|
||||
}
|
||||
return '';
|
||||
@ -2208,7 +2208,7 @@ class MInsee
|
||||
if ($id>0 && $siren<1000) $where=" id=$id ";
|
||||
elseif ($nic<>0) $where=" siren=$siren AND nic=$nic ";
|
||||
elseif ($siren<>0) $where=" siren=$siren ";//AND siege=1 ";
|
||||
$listeEtab = $this->iDb->select('etablissements e',
|
||||
$listeEtab = $this->iDb->select('jo.etablissements e',
|
||||
"e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren,9,0) as siren, LPAD(e.nic,5,0) as nic, e.siege, e.autre_id, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
@ -2267,21 +2267,21 @@ class MInsee
|
||||
/** Informations locales issues de la table infos_entrep **/
|
||||
if ($siren>100) {
|
||||
$info = $this->iDb->select(
|
||||
'infos_entrep',
|
||||
'jo.infos_entrep',
|
||||
"raisonSociale, isin, nscrl, tel, fax, web, mail, latitude, longitude, precis, dateCreation, dateFermeture, naf, naf_lib, ca, effectif, nbEtab, activite, LPAD(sirenDoublon,9,'0') AS sirenDoublon, waldec",
|
||||
"siren=$siren", false, MYSQL_ASSOC);
|
||||
if ( count($info)>0 ) {
|
||||
$tab=$info[0];
|
||||
$waldec = $tab['waldec'];
|
||||
if ( !array_key_exists('sirenDoublon', $tab) ) {
|
||||
$info = $this->iDb->select('infos_entrep', 'siren AS sirenDoublon', "sirenDoublon=$siren", false, MYSQL_ASSOC);
|
||||
$info = $this->iDb->select('jo.infos_entrep', 'siren AS sirenDoublon', "sirenDoublon=$siren", false, MYSQL_ASSOC);
|
||||
if ( count($info)>0 ) {
|
||||
$tab['sirenDoublon']=$info[0]['sirenDoublon'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$insee=$this->iDb->select('etablissements', 'CONCAT(SIREN,NIC) AS siret', "SIREN=$siren AND SIEGE=1 ORDER BY ACTIF%10 DESC, NIC DESC",false,MYSQL_ASSOC);
|
||||
$insee=$this->iDb->select('jo.etablissements', 'CONCAT(SIREN,NIC) AS siret', "SIREN=$siren AND SIEGE=1 ORDER BY ACTIF%10 DESC, NIC DESC",false,MYSQL_ASSOC);
|
||||
if ( count($insee)>0 ) {
|
||||
$siretSiege = $insee[0]['siret'];
|
||||
}
|
||||
@ -2340,7 +2340,7 @@ class MInsee
|
||||
);
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDb->select('etablissements', 'count(*) AS nbEtabs', "siren=$siren AND NIC<100000 AND ACTIF%10=1",false,MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.etablissements', 'count(*) AS nbEtabs', "siren=$siren AND NIC<100000 AND ACTIF%10=1",false,MYSQL_ASSOC);
|
||||
$nbEtab = 0;
|
||||
if ( count($tabTmp)>0 ) {
|
||||
$nbEtab = $tabTmp[0]['nbEtabs'];
|
||||
@ -2837,7 +2837,7 @@ class MInsee
|
||||
);
|
||||
if (in_array($tabInsee['APE_ENT'], $tabNafTourisme) ||
|
||||
in_array($tabInsee['APE_ETAB'], $tabNafTourisme) ) {
|
||||
$ret=$this->iDb->select('tourisme', 'id, nom, adresse, adrCp, adrVille, nbEtoiles, typeClasse, categorie, dateClasse, tel, fax, mail, web, typeChambres, capacite', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('jo.tourisme', 'id, nom, adresse, adrCp, adrVille, nbEtoiles, typeClasse, categorie, dateClasse, tel, fax, mail, web, typeChambres, capacite', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
if (isset($ret[0])) {
|
||||
$tabRet['NafEtabLib'].=' ('.$ret[0]['nbEtoiles'].' étoiles le '.
|
||||
$classWDate->dateT('Y-m-d','d/m/Y',$ret[0]['dateClasse']).')';
|
||||
@ -2959,7 +2959,7 @@ class MInsee
|
||||
$tabRet['SituationJuridique']='P';
|
||||
}
|
||||
//file_put_contents('test.log', $this->dureePlan."-".$this->finPlan." Situtation Juridique : ".$tabRet['SituationJuridique']);
|
||||
$tabTmp = $this->iDb->select('scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if( count($tabTmp) > 0 ) {
|
||||
if ($tabTmp[0]['scoreSolv']>0) {
|
||||
//Tri des dates de procol
|
||||
@ -3042,7 +3042,7 @@ class MInsee
|
||||
if ($siren>100) {
|
||||
if ($tabRet['CapitalSrc']<>5) {
|
||||
/** Recherche du n° RC, de la Forme Juridique et du Capital au Bodacc **/
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'Capital, CapitalDev',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'Capital, CapitalDev',
|
||||
"siren=$siren AND capital<>0 $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
if ($tabRet['Capital']==0 || $tabRet['CapitalDev']=='' || $tabRet['Capital']<>$annCap['Capital']*1) {
|
||||
@ -3092,19 +3092,19 @@ class MInsee
|
||||
|
||||
/** Recherche du code Tribunal du siège **/
|
||||
if ($tabRet['CapitalSrc']<>5) {
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'RC, FJ, Tribunal_Code',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'RC, FJ, Tribunal_Code',
|
||||
"siren=$siren AND RC<>'' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if ($tabRet['AutreId']=='') $tabRet['AutreId']=@$bodacc[0]['RC'];
|
||||
if ($tabRet['Tribunal']=='') $tabRet['Tribunal']=@$bodacc[0]['Tribunal_Code'];
|
||||
}
|
||||
|
||||
if ($tabRet['FJ_lib']=='') {
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'FJ',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'FJ',
|
||||
"siren=$siren AND FJ<>'' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabRet['FJ_lib']=@$bodacc[0]['FJ'];
|
||||
}
|
||||
/** Recherche de l'activité réelle **/
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'Activite', "siren=$siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'Activite', "siren=$siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=$bodacc[0];
|
||||
if ($tabInsee['CJ']<7000 || $tabInsee['CJ']>7999)
|
||||
$tabRet['Activite']=trim(/*preg_replace("/Adjonction.{1,7}activit(?:e|é)(?:.|)\:", '', */$annCap['Activite']);//);
|
||||
@ -3116,7 +3116,7 @@ class MInsee
|
||||
$siretMin=(''.$siren.'00000')*1;
|
||||
$siretMax=(''.$siren.'99999')*1;
|
||||
//$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet', "Siret BETWEEN $siretMin AND $siretMax AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet, Assoc_Nom, typeAsso, Waldec', "siren=$siren AND dateSuppr=0 AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet, Assoc_Nom, typeAsso, Waldec', "siren=$siren AND dateSuppr=0 AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
$tabRet['Activite'] = trim($annCap['Assoc_NObjet']);
|
||||
if (trim($tabRet['AutreId'])=='')
|
||||
@ -3165,11 +3165,11 @@ class MInsee
|
||||
}
|
||||
$timer['activiteReelle']=microtime(true);
|
||||
|
||||
$bodacc=$this->iDb->select('rncs_dirigeants',
|
||||
$bodacc=$this->iDb->select('jo.rncs_dirigeants',
|
||||
"nom, prenom, naissance_nom, civilite, fonction_code as code, fonction_lib as libelle, naissance_date AS dateNaiss, naissance_lieu AS lieuNaiss, dirRS as rs, '' as dateEffet",
|
||||
"siren=$siren AND actif%10=1 AND fonction_lib NOT LIKE '%Administrateur%' ORDER BY actif DESC, fonction_lib DESC", false, MYSQL_ASSOC);
|
||||
if (count($bodacc)==0)
|
||||
$bodacc=$this->iDb->select('rncs_dirigeants',
|
||||
$bodacc=$this->iDb->select('jo.rncs_dirigeants',
|
||||
"nom, prenom, naissance_nom, civilite, fonction_code as code, fonction_lib as libelle, naissance_date AS dateNaiss, naissance_lieu AS lieuNaiss, dirRS as rs, '' as dateEffet",
|
||||
"siren=$siren AND actif%10=0 AND fonction_lib NOT LIKE '%Administrateur%' ORDER BY actif DESC, fonction_lib DESC", false, MYSQL_ASSOC);
|
||||
|
||||
@ -3216,7 +3216,7 @@ class MInsee
|
||||
}
|
||||
}
|
||||
else {
|
||||
$bodacc=$this->iDb->select('bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
$bodacc=$this->iDb->select('jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct AND d.depart<>1 AND f.triCode IN ('ASS','COG','DID','DIR','GER','PCS','PDG','PRD','PRE','PRT','VIC') GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC", false, MYSQL_ASSOC);
|
||||
//$annCap=@$bodacc[0];
|
||||
@ -3245,7 +3245,7 @@ class MInsee
|
||||
$siretMin=(''.$siren.'00000')*1;
|
||||
$siretMax=(''.$siren.'99999')*1;
|
||||
//$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail', "Siret BETWEEN $siretMin AND $siretMax AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail', "siren=$siren AND dateSuppr=0 AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Assoc_Web, Assoc_Mail', "siren=$siren AND dateSuppr=0 AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
if ($tabRet['Web']=='') $tabRet['Web']=trim($annCap['Assoc_Web']);
|
||||
if ($tabRet['Mail']=='') $tabRet['Mail']=trim($annCap['Assoc_Mail']);
|
||||
@ -3254,7 +3254,7 @@ class MInsee
|
||||
} else {
|
||||
if ($etab['source']==3) {
|
||||
$id=$etab['source_id'];
|
||||
$bodacc=$this->iDb->select( 'asso', 'Activite, Sous_Prefecture, Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_Fusion, Assoc_Date_Declaration2', "id=$id AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Activite, Sous_Prefecture, Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_Fusion, Assoc_Date_Declaration2', "id=$id AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
$tabRet['Activite'] = $annCap['Assoc_Objet'];
|
||||
$tabRet['Web'] = $annCap['Assoc_Web'];
|
||||
@ -3312,7 +3312,7 @@ class MInsee
|
||||
if ($tabRet['Siege']==1 && $tabRet['Actif'] && $tabRet['Tribunal']=='')
|
||||
$tabRet['Tribunal']=$tabCodeTri;
|
||||
|
||||
$rep = $this->iDb->select('rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, dateRad*1 AS dateRadNum, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep = $this->iDb->select('jo.rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, dateRad*1 AS dateRadNum, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if (isset($entrep['numGreffe'])) { //ETRANGER//
|
||||
$tabRet['numGreffe'] = $entrep['numGreffe'];
|
||||
@ -3371,7 +3371,7 @@ class MInsee
|
||||
|
||||
/** Spécificité EIRL **/
|
||||
if ($fjInpi==1000) {
|
||||
$rep=$this->iDb->select('rncs_eirl',
|
||||
$rep=$this->iDb->select('jo.rncs_eirl',
|
||||
'denomination, activite',
|
||||
"siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
@ -3379,7 +3379,7 @@ class MInsee
|
||||
}
|
||||
|
||||
/** Informations sur l'établissement au RNCS **/
|
||||
$rep=$this->iDb->select('rncs_etab',
|
||||
$rep=$this->iDb->select('jo.rncs_etab',
|
||||
'id, siege, actif, enseigne, nomCommercial,
|
||||
adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie,
|
||||
cp, commune, adrComp, adresse1, adresse2, adresse3,
|
||||
@ -3416,7 +3416,7 @@ class MInsee
|
||||
/**
|
||||
** Recherche au RM
|
||||
**/
|
||||
$rep=$this->iDb->select('artisanat', 'siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nom,prenom,nomUsage,dateNaiss,lieuNaiss,qualite,qualif,dateQualif,dateFctDeb,dateFctFin,DATE(dateUpdate) AS jourUpdate, DATE(dateInsert) AS dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.artisanat', 'siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nom,prenom,nomUsage,dateNaiss,lieuNaiss,qualite,qualif,dateQualif,dateFctDeb,dateFctFin,DATE(dateUpdate) AS jourUpdate, DATE(dateInsert) AS dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if (isset($entrep['numRM'])) {
|
||||
$tabRet['AutreId'] = $entrep['numRM'];
|
||||
@ -3579,7 +3579,7 @@ class MInsee
|
||||
/**
|
||||
* Eléments Financiers en provenance du dernier Bilan
|
||||
*/
|
||||
$rep=$this->iDb->select('bilans', 'siren, dateExercice, dureeExercice, monnaie, typeBilan, unite, postes, dateProvPartenaire, dateInsert', "siren=$siren AND typeBilan IN ('N','S') ORDER BY dateExercice DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.bilans', 'siren, dateExercice, dureeExercice, monnaie, typeBilan, unite, postes, dateProvPartenaire, dateInsert', "siren=$siren AND typeBilan IN ('N','S') ORDER BY dateExercice DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
if ( count($rep)>0 ) {
|
||||
$entrep=$rep[0];
|
||||
$tabRet['bilanAnnee'] = substr($entrep['dateExercice'],0,4);
|
||||
@ -3765,7 +3765,7 @@ class MInsee
|
||||
if ($histo)
|
||||
{
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateInsert DESC, d.dateEffet DESC, d.fonction DESC", true, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
@ -3832,18 +3832,18 @@ class MInsee
|
||||
'Ancien' => $tabDir['depart'],
|
||||
'DateFct' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
);
|
||||
$this->iDb->insert('bodacc_dirigeants_histo', array(
|
||||
'siren' => $siren,
|
||||
'id' => $ann['ANBASE'],
|
||||
'num' => $iDir,
|
||||
'dateEffet' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'fonction' => $tabDir['fonction'],
|
||||
'rs' => $tabDir['rs'],
|
||||
'nom' => $nom,
|
||||
'prenom' => $tabDir['prenom'],
|
||||
'nomUsage' => $tabDir['nomUsage'],
|
||||
'depart' => $tabDir['depart'],
|
||||
), true);
|
||||
$this->iDb->insert('jo.bodacc_dirigeants_histo', array(
|
||||
'siren' => $siren,
|
||||
'id' => $ann['ANBASE'],
|
||||
'num' => $iDir,
|
||||
'dateEffet' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'fonction' => $tabDir['fonction'],
|
||||
'rs' => $tabDir['rs'],
|
||||
'nom' => $nom,
|
||||
'prenom' => $tabDir['prenom'],
|
||||
'nomUsage' => $tabDir['nomUsage'],
|
||||
'depart' => $tabDir['depart'],
|
||||
), true);
|
||||
|
||||
$iDir++;
|
||||
}
|
||||
@ -3857,9 +3857,9 @@ class MInsee
|
||||
if (!$histo || ($histo && count($tabRet)==0) )
|
||||
{
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants/* d, bodacc_fonctions f*/',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert/*f.libelle*/',
|
||||
"siren=$siren /*AND d.fonction_code=f.codeFct*/ AND actif%10=1", false, MYSQL_ASSOC);
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
|
||||
"siren=$siren AND actif%10=1", false, MYSQL_ASSOC);
|
||||
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
if ($dir['naissance_date']<>'0000-00-00') {
|
||||
@ -3902,7 +3902,7 @@ class MInsee
|
||||
/** Recherche de CAC si liste des dirigeants actifs **/
|
||||
if (!$histo) {
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct AND d.fonction BETWEEN 300 AND 304 GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC, d.fonction DESC", false, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
@ -3941,9 +3941,9 @@ class MInsee
|
||||
/** Si on ne trouve absolument rien, on regarde quand même dans l'histroique RNCS **/
|
||||
if (count($tabRet)==0) {
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants/* d, bodacc_fonctions f*/',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, /*f.libelle*/ date(dateUpdate)*1 as dateUpdate',
|
||||
"siren=$siren /*AND d.fonction_code=f.codeFct*/ AND actif%10=0 ORDER BY dateUpdate DESC", false, MYSQL_ASSOC);
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, date(dateUpdate)*1 as dateUpdate',
|
||||
"siren=$siren AND actif%10=0 ORDER BY dateUpdate DESC", false, MYSQL_ASSOC);
|
||||
|
||||
$dateUpdatePre=$dirs[0]['dateUpdate'];
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
@ -4009,7 +4009,7 @@ class MInsee
|
||||
'Ancien' =>0,
|
||||
'DateFct' =>$tabIdentite['DateCrea'],//$tabIdentite['DateImma'],
|
||||
);
|
||||
$this->iDb->insert('rncs_dirigeants', array(
|
||||
$this->iDb->insert('jo.rncs_dirigeants', array(
|
||||
'siren' => $siren,
|
||||
'raisonSociale' => $etab['Nom'],
|
||||
'civilite' => $civilite,
|
||||
@ -4187,7 +4187,7 @@ class MInsee
|
||||
|| $this->AnnoncesInMemory === false ) {
|
||||
|
||||
$bodacc = $this->iDb->select(
|
||||
'bodacc_detail d, bodacc b, tribunaux t',//.codEven Code évènement du mouvement Bodacc libEven ',
|
||||
'jo.bodacc_detail d, jo.bodacc b, jo.tribunaux t',//.codEven Code évènement du mouvement Bodacc libEven ',
|
||||
"b.id, b.Bodacc_Code, b.Bodacc_Annee_Parution, b.Bodacc_Num, b.Num_Annonce, b.Bodacc_Date_Parution, b.Tribunal_Dept, b.Tribunal_Code, d.Rubrique, b.typeAnnonce, b.corrNum_Annonce, b.corrBodacc_Date_Parution, b.corrPage, b.corrNumParution, b.corrTexteRectificatif, b.annonce, b.dateInsert, t.triCode, t.triNom, t.triSiret, d.typeEven, d.dateEffet, d.dateDebutActivite, d.dateCessationActivite, d.dateJugement, d.dateFinObservation, d.VenteMt, d.VenteDev, d.FJ, d.Capital, d.CapitalDev, CONCAT(d.commentaires,' ',d.fusion) as complement, d.raisonSociale, d.nomCommercial, d.enseigne, d.sigle, d.adresse, d.codePostal, d.ville, d.adresseSiege, d.codePostalSiege, d.villeSiege, IF(d.dateSuppr=0,'',d.dateSuppr) AS deleted",
|
||||
"$strCle AND d.id=b.id AND b.Tribunal_Code=t.triCode $strDeleted $strIdAnn $groupBy ORDER BY b.Bodacc_Date_Parution DESC", false, MYSQL_ASSOC);
|
||||
|
||||
@ -4421,7 +4421,7 @@ class MInsee
|
||||
reset($tabJugements);
|
||||
|
||||
$tabNoProcol=array();
|
||||
$tmp=$this->iDb->select('tabEvenements', 'codEven,affProcol', 'affProcol>0', false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabEvenements', 'codEven,affProcol', 'affProcol>0', false, MYSQL_ASSOC);
|
||||
foreach ($tmp as $tmp2)
|
||||
$tabNoProcol[$tmp2['codEven']]=$tmp2['affProcol'];
|
||||
|
||||
@ -4814,7 +4814,7 @@ class MInsee
|
||||
|
||||
$mBalo=new MBalo();
|
||||
|
||||
$bodacc=$this->iDb->select('balo', "Societe_Rcs, Categorie, Num_Affaire, Date_Parution, Num_Parution, Url_Annonce_Html, Url_Annonce_Pdf, Annonce_Html, dateInsert", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' $strIdAnn ORDER BY Date_Parution DESC, Num_Affaire LIMIT $offset, $lignes", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.balo', "Societe_Rcs, Categorie, Num_Affaire, Date_Parution, Num_Parution, Url_Annonce_Html, Url_Annonce_Pdf, Annonce_Html, dateInsert", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' $strIdAnn ORDER BY Date_Parution DESC, Num_Affaire LIMIT $offset, $lignes", false, MYSQL_ASSOC);
|
||||
// $RP=mysql_select('balo', " ", "Societe_Rcs='$rcs' ");
|
||||
$k=0;
|
||||
if (count($bodacc)>0) {
|
||||
@ -4851,7 +4851,7 @@ class MInsee
|
||||
*/
|
||||
function getAnnoncesBaloCount($siren)
|
||||
{
|
||||
$bodacc = $this->iDb->select('balo', "count(*) AS nb", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' ORDER BY Date_Parution DESC, Num_Affaire", false, MYSQL_ASSOC);
|
||||
$bodacc = $this->iDb->select('jo.balo', "count(*) AS nb", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' ORDER BY Date_Parution DESC, Num_Affaire", false, MYSQL_ASSOC);
|
||||
$nb = 0;
|
||||
if (count($bodacc)>0) {
|
||||
$nb = $bodacc[0]['nb'];
|
||||
@ -4894,7 +4894,7 @@ class MInsee
|
||||
}
|
||||
|
||||
$bodacc = $this->iDb->select(
|
||||
'boamp_lots l, boamp b, boamp_detail d',
|
||||
'jo.boamp_lots l, jo.boamp b, jo.boamp_detail d',
|
||||
"l.id, l.idAnn, l.Boamp_Code, l.Boamp_Rubrique, b.Boamp_Rubrique_Lib, b.typeAnnonce, l.Boamp_Date_Parution, b.Boamp_Num, b.Boamp_Annee_Parution, b.Num_AnnoncePre, b.Num_Annonce, b.Boamp_Dept, b.annonce, l.num, l.`desc` AS description, l.nom, d.raisonSociale, l.montantTxt, sum(l.montant) AS montant, l.montantAnMin, l.montantAnMax, l.trancheCond, l.trancheFerme, l.dateAttrib, l.intitule, l.nomenclature, l.objets, l.cpv, l.cpvComp, l.volume, l.execution, l.livraison, l.dureeJours, l.dureeMois, l.dateDeb, l.dateFin, l.dateInsert, d.titre, d.objet, d.titreMarche, d.typeObjetMarche, d.objetAutre, d.autres",
|
||||
"l.siren='$siren' AND l.idAnn=b.id AND l.idAnn=d.id $strIdAnn GROUP BY b.id ORDER BY l.Boamp_Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -5081,17 +5081,15 @@ class MInsee
|
||||
|
||||
/** Recherche dans les avis d'attribution **/
|
||||
$bodaccA=$this->iDb->select(
|
||||
'boamp_lots l, boamp b, boamp_detail d',
|
||||
'jo.boamp_lots l, jo.boamp b, jo.boamp_detail d',
|
||||
"l.id",
|
||||
"l.siren='$siren' AND l.idAnn=b.id AND l.idAnn=d.id GROUP BY b.id ORDER BY l.Boamp_Date_Parution",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
}
|
||||
if ( $type=='' || $type=='M') {
|
||||
|
||||
/** Recherche dans les avis de marchés **/
|
||||
$bodaccM=$this->iDb->select( 'boamp b, boamp_detail d',
|
||||
"d.id",
|
||||
$bodaccM = $this->iDb->select( 'jo.boamp b, jo.boamp_detail d', "d.id",
|
||||
"d.siren='$siren' AND d.id=b.id GROUP BY b.id ORDER BY d.Boamp_Date_Parution DESC",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -5120,7 +5118,7 @@ class MInsee
|
||||
|
||||
$classWDate = new WDate();
|
||||
|
||||
$bodacc=$this->iDb->select('asso', "id, Assoc_Nom, siren, nic, Waldec, Activite, Num_Annonce, Date_Parution, Num_Parution, Departement, Sous_Prefecture, Type_Annonce, Annonce_Html, Assoc_Objet, Assoc_Adresse, Assoc_NObjet, Assoc_AObjet, Assoc_NAdresse, Assoc_Fusion, Assoc_Annulation, Assoc_ANom, Assoc_NNom, Assoc_Date_Declaration, Assoc_Date_Declaration2, typeAnnonce, codEven, dateInsert", "$strIdAnn AND dateSuppr=0 ORDER BY Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.asso', "id, Assoc_Nom, siren, nic, Waldec, Activite, Num_Annonce, Date_Parution, Num_Parution, Departement, Sous_Prefecture, Type_Annonce, Annonce_Html, Assoc_Objet, Assoc_Adresse, Assoc_NObjet, Assoc_AObjet, Assoc_NAdresse, Assoc_Fusion, Assoc_Annulation, Assoc_ANom, Assoc_NNom, Assoc_Date_Declaration, Assoc_Date_Declaration2, typeAnnonce, codEven, dateInsert", "$strIdAnn AND dateSuppr=0 ORDER BY Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC);
|
||||
|
||||
$k=0;
|
||||
if (count($bodacc)>0) {
|
||||
@ -5214,7 +5212,7 @@ class MInsee
|
||||
$strIdAnn = "siren=$siren";
|
||||
}
|
||||
|
||||
$bodacc=$this->iDb->select('asso', "COUNT(*) AS nb", "$strIdAnn AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.asso', "COUNT(*) AS nb", "$strIdAnn AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$nb = 0;
|
||||
if (count($bodacc)>0) {
|
||||
$nb = $bodacc[0]['nb'];
|
||||
@ -5230,7 +5228,7 @@ class MInsee
|
||||
$tabRet=array();
|
||||
|
||||
/** Chargement initial au cas ou la requête Coface plante **/
|
||||
$tabTmp=$this->iDb->select('infos_entrep', 'raisonSociale, isin, nscrl, tel, fax, web, mail, DATE(dateUpdate)*1 as dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.infos_entrep', 'raisonSociale, isin, nscrl, tel, fax, web, mail, DATE(dateUpdate)*1 as dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$idComp=@$tabTmp[0];
|
||||
if (isset($idComp['raisonSociale'])) {
|
||||
// L'entrep est en base infos_entrep
|
||||
@ -5346,8 +5344,8 @@ class MInsee
|
||||
// 'effectif'=>$idComp['effectif'],
|
||||
);
|
||||
$tabInsert=array_merge($tabUpdate,array('siren'=>$siren));
|
||||
if (!$this->iDb->insert('infos_entrep', $tabInsert))
|
||||
$this->iDb->update('infos_entrep', $tabUpdate, "siren=$siren");
|
||||
if (!$this->iDb->insert('jo.infos_entrep', $tabInsert))
|
||||
$this->iDb->update('jo.infos_entrep', $tabUpdate, "siren=$siren");
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "MInsee::getIdentitePart sur $siren après accès Distant", print_r($tabRet, true));
|
||||
}
|
||||
@ -5411,7 +5409,7 @@ class MInsee
|
||||
if ($idAnnonce<>0) $strIdAnn.= " AND a.id=".preg_replace('/^0\./','', $idAnnonce);
|
||||
|
||||
/** Recherche des jugements enregistrés en base S&D **/
|
||||
$collecte = $this->iDb->select('annonces a, tribunaux t',
|
||||
$collecte = $this->iDb->select('jo.annonces a, jo.tribunaux t',
|
||||
'a.id, a.siren, a.typeEven, a.strEven, a.dateJugement, a.dateCessationPaiement, a.dateEffetFinP, a.numero, a.inter1type, a.inter1id, a.inter1nom, a.inter2type, a.inter2id, a.inter2nom, a.inter3type, a.inter3id, a.inter3nom, a.inter4type, a.inter4id, a.inter4nom, a.tribunal, a.montant, a.actionsNb, a.complement, a.nouvActivite, a.nouvDir, a.nouvAdr, a.nouvFJ, a.source, a.parutionIdJal, a.parutionNum, a.dateSource, a.annonce, a.dateInsert, t.triNom, t.triSiret, t.triCP, a.raisonSociale, a.adresse, a.codePostal, a.ville',
|
||||
"a.siren=$siren AND a.tribunal=t.triCode $strIdAnn AND a.dateSuppr=0 GROUP BY a.siren, a.dateJugement, typeEven ORDER BY a.dateJugement DESC", true, MYSQL_ASSOC);
|
||||
if (count($collecte)>0) {
|
||||
@ -5450,7 +5448,7 @@ class MInsee
|
||||
if (trim($ann['inter1type'])<>'' && ($ann['inter1id']>0 || trim($ann['inter1nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter1type']].' : '.$ann['inter1nom'];
|
||||
if ($ann['inter1id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter1id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter1id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5463,7 +5461,7 @@ class MInsee
|
||||
if (trim($ann['inter2type'])<>'' && ($ann['inter2id']>0 || trim($ann['inter2nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter2type']].' : '.$ann['inter2nom'];
|
||||
if ($ann['inter2id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter2id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter2id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5476,7 +5474,7 @@ class MInsee
|
||||
if (trim($ann['inter3type'])<>'' && ($ann['inter3id']>0 || trim($ann['inter3nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter3type']].' : '.$ann['inter3nom'];
|
||||
if ($ann['inter3id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter3id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter3id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5489,7 +5487,7 @@ class MInsee
|
||||
if (trim($ann['inter4type'])<>'' && ($ann['inter4id']>0 || trim($ann['inter4nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter4type']].' : '.$ann['inter4nom'];
|
||||
if ($ann['inter4id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter4id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter4id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5643,7 +5641,7 @@ class MInsee
|
||||
else $dep='Dep'.$dep;
|
||||
$strDep="AND (n.territoire='' OR n.territoire LIKE '%$dep%')";
|
||||
}
|
||||
$listeCC=$this->iDb->select('conv_naf n, conventions c',
|
||||
$listeCC=$this->iDb->select('jo.conv_naf n, jo.conventions c',
|
||||
'n.`id CC`, n.`nom CC`, n.`editeur CC`, n.`nb page CC`, n.`isbn CC`, n.`date edition CC`, c.infoCC, joCCmaj',
|
||||
"n.naf='$naf4' AND substring(n.`id CC`,1,4)=c.numBrochure $strDep GROUP BY n.`id CC`", false, MYSQL_ASSOC);
|
||||
return $listeCC;
|
||||
@ -5707,7 +5705,7 @@ class MInsee
|
||||
$tabAnnees[]=$an;
|
||||
$strAnnees.=implode(',', $tabAnnees).')';
|
||||
}
|
||||
$tabImportExport=$this->iDb->select('importExport', 'importExport, annee, /*siren, raisonSociale, naf, categorie, adresse,*/ rangNational, deptSiege', "1 $strImportExport $strAnnees AND siren=$siren ORDER BY annee DESC, importExport ASC",false, MYSQL_ASSOC);
|
||||
$tabImportExport=$this->iDb->select('jo.importExport', 'importExport, annee, rangNational, deptSiege', "1 $strImportExport $strAnnees AND siren=$siren ORDER BY annee DESC, importExport ASC",false, MYSQL_ASSOC);
|
||||
return $tabImportExport;
|
||||
}
|
||||
|
||||
@ -5756,7 +5754,7 @@ class MInsee
|
||||
if ($active) {
|
||||
$strAdrActive.=" AND (enActif=1 OR etActif=1) AND nbEntrep>30 AND pasEntrepDom=0 AND siren>1000 ";
|
||||
}
|
||||
$tabTmp=$this->iDb->select('tabAdrDom',
|
||||
$tabTmp=$this->iDb->select('jo.tabAdrDom',
|
||||
'id, siren, nic, enActif, etActif, procol, nom, nom2, sigle, enseigne, adrNum, adrBtq, adrTypVoie, adrLibVoie, ville, cp, adrComp, adrDistSp, cj, apen, apet, nbEntrep, dateInsert, dateUpdate',
|
||||
"adrNum=$num AND adrBtq='$indRep' AND adrTypVoie LIKE '%$typeVoie%' AND adrLibVoie LIKE '%$libVoie%' AND cp=$cp $strAdrActive GROUP BY siren ORDER BY enActif DESC, nbEntrep DESC", false, MYSQL_ASSOC);
|
||||
if (count($tabTmp)>0) {
|
||||
@ -6533,15 +6531,6 @@ class MInsee
|
||||
'grdQuartier'=>$ret[0]['GRD_QUART'],
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
/*
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMInsee::getInfosIris sur $codeCommune/$codeRivoli", "Debug IRIS sur $adrNum, $adrTypVoie, $adrLibVoie".EOL."SELECT codeInsee, codeIris, rivoli, codeInseeIris
|
||||
FROM iris
|
||||
WHERE codeInsee='$codeCommune' AND rivoli LIKE '$codeRivoli%' $strAdr GROUP BY codeInseeIris;
|
||||
|
||||
SELECT CODE_IRIS AS codeInseeIris, SUBSTRING(CODE_IRIS,6,4) AS codeIris, LIB_IRIS, TYP_IRIS, MODIF_IRIS, TRIRIS, GRD_QUART
|
||||
FROM insee_tabIris
|
||||
WHERE DEPCOM='$codeCommune' AND (TYP_IRIS='Z' OR CODE_IRIS='$codeComIris');".EOL.print_r($tabRet, true));
|
||||
*/
|
||||
} else {
|
||||
//typVoie, libVoie, rivoli, typeNum 1:chiffres impaires, 2:chiffres paires
|
||||
//numd, indd, numf, indf
|
||||
@ -6589,7 +6578,7 @@ class MInsee
|
||||
*/
|
||||
public function getCAnafEffectif($naf, $effectif=0)
|
||||
{
|
||||
$tabTmp=$this->iDb->select('ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM jo.ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", false, MYSQL_ASSOC);
|
||||
if (count($tabTmp)>0) {
|
||||
$caSecteur=round($tabTmp[0]['moyenne']*1000);
|
||||
// Encours moyen secteur * nb salariés
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
define ('ARTISANAT_DISPO_WEB', 1);
|
||||
define ('ARTISANAT_DISPO_WEB', 1);
|
||||
include_once(FWK_PATH.'common/curl.php');
|
||||
|
||||
class MArtisanat {
|
||||
@ -19,7 +19,7 @@ class MArtisanat {
|
||||
|
||||
function getIdentite($siren, $refresh=false) {
|
||||
$siren=$siren*1;
|
||||
$res=$this->iDb->select('artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=$this->iDb->select('jo.artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if (count($res)>0 && !$refresh) {
|
||||
$this->enCache=true;
|
||||
$tabInsert=$res[0];
|
||||
@ -93,7 +93,7 @@ class MArtisanat {
|
||||
}
|
||||
|
||||
/** Gestion des multi-inscriptions au RM **/
|
||||
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches))
|
||||
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches))
|
||||
{
|
||||
$nbRep=trim($matches[1])*1;
|
||||
$iRadMax=-1;
|
||||
@ -150,11 +150,11 @@ class MArtisanat {
|
||||
$actif=null;
|
||||
if (preg_match("/Renseignements.relatif(?:.*)entreprise(.*)<\/b>/Uis", $this->body, $matches)) {
|
||||
switch (trim(strtr($matches[1],array(chr(160)=>'')))) {
|
||||
case 'en activité': $actif=1; break;
|
||||
case 'en activité': $actif=1; break;
|
||||
case 'radiée': $actif=0; break;
|
||||
default: print_r($matches);die(); break;
|
||||
}
|
||||
//die(EOL.'$actif='.$actif.EOL.print_r($matches));
|
||||
//die(EOL.'$actif='.$actif.EOL.print_r($matches));
|
||||
}
|
||||
$tabInsert['actif']=$actif;
|
||||
if ($actif===null) {
|
||||
@ -174,7 +174,7 @@ class MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">enseigne<\/span><\/td>(?:.*)<td align="left" colspan="4">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['enseigne']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">forme juridique<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['fj']=$matches[1];
|
||||
$tabInsert['fj']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">effectif<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['effectif']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -195,7 +195,7 @@ class MArtisanat {
|
||||
$tabInsert['radiation']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabEtabs=array();
|
||||
if (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription complémentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches))
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
elseif (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Inscription complémentaire<\/b>(.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
if (preg_match_all('/<tr>(?:.*)<td><img alt="" src="inter\/pixtrans\.gif" width="30" height="1"><\/td>(?:.*)<td nowrap>(?:.*)<!-- adresse -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- code postal et ville -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- enseigne -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- debut activite -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- fin activite -->(.*)<\/td>(?:.*)<\/tr>/Uis', $matches[1], $matches2)) {
|
||||
@ -233,7 +233,7 @@ class MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['nomUsage']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise"> date de naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['dateNaiss']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['dateNaiss']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
// if (preg_match('/date de naissance(.*)<td background="inter\/pix3_turquoise\.gif" align="right"/Uis', $this->body, $matches))
|
||||
// die(print_r($matches));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> lieu de naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -256,11 +256,11 @@ class MArtisanat {
|
||||
|
||||
// Insertion en base de données
|
||||
$tabInsert['dateInsert']=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('artisanat', $tabInsert, true);
|
||||
$id=$this->iDb->insert('jo.artisanat', $tabInsert, true);
|
||||
$tabInsert['id']=$id;
|
||||
foreach ($tabEtabs as $tabInsert2) {
|
||||
$tabInsert2['dateInsert']=$tabInsert['dateInsert'];
|
||||
$id2=$this->iDb->insert('artisanat_etab', $tabInsert2, true);
|
||||
$id2=$this->iDb->insert('jo.artisanat_etab', $tabInsert2, true);
|
||||
}
|
||||
|
||||
$tabInsert['dateUpdate']=substr($tabInsert['dateInsert'],0,10);
|
||||
|
@ -286,7 +286,7 @@ class MBilans
|
||||
*/
|
||||
public function listeBilansDepose($accesPartenaire = false)
|
||||
{
|
||||
$result = $this->iDb->select('bodacc_detail', 'Bodacc_Date_Parution, dateEffet, typeEven',
|
||||
$result = $this->iDb->select('jo.bodacc_detail', 'Bodacc_Date_Parution, dateEffet, typeEven',
|
||||
"siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC);
|
||||
$dateDerDepot = 0;
|
||||
if ( count($result) > 0 ) {
|
||||
@ -315,7 +315,7 @@ class MBilans
|
||||
if ($nbMaxBilans>0) $limit="LIMIT 0, $nbMaxBilans";
|
||||
else $limit='';
|
||||
|
||||
$ret = $this->iDb->select('bilans',
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC, CASE typeBilan WHEN 'N' THEN 1 WHEN 'S' THEN 2 ELSE 3 END $limit",false, MYSQL_ASSOC);
|
||||
|
||||
@ -416,7 +416,7 @@ class MBilans
|
||||
|
||||
$bilan = null;
|
||||
|
||||
$ret = $this->iDb->select('bilans',
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert',
|
||||
"siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB' $strSansBilansWeb", false, MYSQL_ASSOC);
|
||||
|
||||
@ -459,11 +459,11 @@ class MBilans
|
||||
'postes' => $strPostes,
|
||||
'partenaire' => $tabBilan['SOURCE'],
|
||||
);
|
||||
if (!$this->iDb->insert('bilans', $tabInsert, true)) {
|
||||
$this->iDb->update('bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'");
|
||||
if (!$this->iDb->insert('jo.bilans', $tabInsert, true)) {
|
||||
$this->iDb->update('jo.bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'");
|
||||
}
|
||||
|
||||
$ret = $this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true);
|
||||
$ret = $this->iDb->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true);
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
@ -601,7 +601,7 @@ class MBilans
|
||||
) {
|
||||
|
||||
/** Il n'y a aucune information sur le bilan précédent **/
|
||||
$ret=$this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice<'$millesimeDB' ORDER BY dateExercice DESC LIMIT 0,1", true);
|
||||
$ret=$this->iDb->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice<'$millesimeDB' ORDER BY dateExercice DESC LIMIT 0,1", true);
|
||||
$bilanPre=$ret[0];
|
||||
$tabBilan['DATE_CLOTURE_PRE'] = $bilanPre['dateExercice']; // SSAAMMJJ
|
||||
$tabBilan['DUREE_MOIS_PRE'] = $bilanPre['dureeExercice'];
|
||||
|
@ -29,15 +29,14 @@ class MBilans {
|
||||
|
||||
function listeBilans($uniquementEnBase=true) {
|
||||
//if ($siren<>0) $this->siren=$siren;
|
||||
$iDb2=new WDB('insee');
|
||||
$ret=$iDb2->select( 'bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC");
|
||||
// if (count($ret)==0) return array(); // Pas de bilan disponible !
|
||||
// else {
|
||||
$tabRet=array();
|
||||
if (!$uniquementEnBase) {
|
||||
$iDb=new WDB('jo');
|
||||
$ret2=$iDb->select( 'bodacc_detail', 'Bodacc_Date_Parution, dateEffet, Bodacc_Num, Bodacc_Date_Parution, Num_Annonce, RC, raisonSociale, FJ, adrSiegeNum, adrSiegeIndRep, adrSiegeTypVoie, adrSiegeLibVoie, adrSiegeComp1, adrSiegeComp2, codePostalSiege, villeSiege', "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC");
|
||||
$ret2=$iDb->select( 'jo.bodacc_detail', 'Bodacc_Date_Parution, dateEffet, Bodacc_Num, Bodacc_Date_Parution, Num_Annonce, RC, raisonSociale, FJ, adrSiegeNum, adrSiegeIndRep, adrSiegeTypVoie, adrSiegeLibVoie, adrSiegeComp1, adrSiegeComp2, codePostalSiege, villeSiege', "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC");
|
||||
$dateDerDepot=WDate::dateT('Y-m-d','Ymd',@$ret2[0]['dateEffet'])*1;
|
||||
$dateDerExercice=$ret[0]['dateExercice']*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
@ -65,8 +64,8 @@ class MBilans {
|
||||
|
||||
function getBilan($millesime='', $source=1) {
|
||||
|
||||
$iDb2=new WDB('insee');
|
||||
$ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'", true);
|
||||
$iDb2=new WDB();
|
||||
$ret=$iDb2->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'", true);
|
||||
/*echo $this->siren.'<br/>';
|
||||
echo $millesime.'<br/>';
|
||||
print_r($ret[0]);die();*/
|
||||
@ -87,8 +86,8 @@ class MBilans {
|
||||
'postes' =>$tabBilan['POSTES'],
|
||||
'partenaire' =>1,
|
||||
);
|
||||
$iDb2->insert('bilans', $tabInsert);
|
||||
$ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'");
|
||||
$iDb2->insert('jo.bilans', $tabInsert);
|
||||
$ret=$iDb2->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'");
|
||||
$bilan=$ret[0];
|
||||
}
|
||||
}
|
||||
|
@ -295,22 +295,7 @@ class MEuridile {
|
||||
if ($this->curPage<>'recherche')
|
||||
$this->partInitRecherche();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
/* $ret=$iDb->select( 'rncs_vitrine',
|
||||
'siren, erreur, rcs, nom, adresse1, cp, ville, fj_lib, naf_code, naf_lib, bilans, dateUpdate',
|
||||
"siren=$this->siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['bilans']=unserialize($tabRet['bilans']);
|
||||
return $tabRet;
|
||||
}
|
||||
}*/
|
||||
|
||||
$iDb=new WDB();
|
||||
$tabRet=$tabBilan=array();
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['erreur']='';
|
||||
@ -409,8 +394,8 @@ class MEuridile {
|
||||
fclose($fp);
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['bilans']=serialize($tabRet['bilans']);
|
||||
if (!$iDb->insert( 'rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
if (!$iDb->insert( 'jo.rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'jo.rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
/** @todo S'il y a un enregistrement, prévoir son update
|
||||
**/
|
||||
|
||||
@ -781,8 +766,8 @@ class MEuridile {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -791,7 +776,7 @@ class MEuridile {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -1005,7 +990,7 @@ class MEuridile {
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -238,18 +238,6 @@ class MFacto
|
||||
'devise' => $tabPai['CODDEV'],
|
||||
);
|
||||
}
|
||||
//$this->tabPaiements=$tabRet;
|
||||
/*@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Paiements", "SELECT p.NUMACH, DATE_FORMAT(p.DATPIE, '%Y-%m') AS mois,
|
||||
CONCAT(DATE_FORMAT(p.DATPIE,'%Y'),'-',IF(DATE_FORMAT(p.DATPIE,'%m')<4,1,IF(DATE_FORMAT(p.DATPIE,'%m')<7,2,IF(DATE_FORMAT(p.DATPIE,'%m')<10,3,4)))) AS trimestre,
|
||||
count(*) AS nbPieces,
|
||||
AVG(DATEDIFF(NOW(), p.DATECH)) AS nbJourRetard, AVG(DATEDIFF(p.DATPAI, p.DATECH)) AS nbJourPaiement,
|
||||
ROUND(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF(p.DATPAI, p.DATECH))) AS nbJourMoyens,
|
||||
IF(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF( p.DATPAI, p.DATECH ) ) <6, 0, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <36, 30, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <66, 60, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <96, 90, 120 ) ) ) ) AS nbJours,
|
||||
SUM(p.MNTPIE) AS mtPieces, SUM(p.MNTFRF) AS mtPaiements, SUM(p.MNTLIT) AS mtLitiges,
|
||||
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE
|
||||
FROM ge_paiements p LEFT JOIN ge_acheteurs a ON a.NUMACH=p.NUMACH
|
||||
WHERE a.SIRENE=$siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC".EOL.EOL.print_r($tabRet, true).EOL);
|
||||
*/
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -2108,7 +2108,7 @@ class MGreffes
|
||||
'res' => $return->BilanResultat,
|
||||
'eff' => $return->BilanDateEffectif,
|
||||
);
|
||||
if (!$this->iDb->insert('greffes_identite', $tabInsert, true) ){
|
||||
if (!$this->iDb->insert('jo.greffes_identite', $tabInsert, true) ){
|
||||
//
|
||||
}
|
||||
|
||||
@ -2225,7 +2225,7 @@ class MGreffes
|
||||
'res' => $return->BilanResultat,
|
||||
'eff' => $return->BilanDateEffectif,
|
||||
);
|
||||
if (!$this->iDb->insert('greffes_identite', $tabInsert, true) ){
|
||||
if (!$this->iDb->insert('jo.greffes_identite', $tabInsert, true) ){
|
||||
//
|
||||
}
|
||||
|
||||
@ -2247,7 +2247,7 @@ class MGreffes
|
||||
*/
|
||||
function getIdentite($siren, $refresh=false)
|
||||
{
|
||||
$res=$this->iDb->select('greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
||||
$res=$this->iDb->select('jo.greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
||||
if (count($res)>0 && !$refresh) {
|
||||
$ent=$res[0];
|
||||
$id=$ent['id'];
|
||||
@ -2781,7 +2781,7 @@ class MGreffes
|
||||
'eff' => $eff,
|
||||
);
|
||||
$dateInsert=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('greffes_identite', $tabInsert, true);
|
||||
$id=$this->iDb->insert('jo.greffes_identite', $tabInsert, true);
|
||||
//sendMail('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug identite $siren", $this->body);
|
||||
// 997536917
|
||||
}
|
||||
@ -3000,7 +3000,7 @@ class MGreffes
|
||||
$perisable=false;
|
||||
/*`siren` , `dateRequete` , `strXml` , `type` , , `codeErreur`
|
||||
FROM ``*/
|
||||
$res=$this->iDb->select('greffes_requetes', 'dateRequete*1 as dateReq, strXml, codeErreur', "siren=$siren AND type='$type' AND `option`='$option' ORDER BY dateRequete DESC", false, MYSQL_ASSOC);
|
||||
$res=$this->iDb->select('jo.greffes_requetes', 'dateRequete*1 as dateReq, strXml, codeErreur', "siren=$siren AND type='$type' AND `option`='$option' ORDER BY dateRequete DESC", false, MYSQL_ASSOC);
|
||||
//print_r($res);
|
||||
//echo mysql_errno().' : '.mysql_error().EOL;
|
||||
|
||||
@ -3066,7 +3066,7 @@ $xml");
|
||||
'option' => $option,
|
||||
'codeErreur' => $errNum,
|
||||
);
|
||||
$this->iDb->insert('greffes_requetes', $tabInsert, true);
|
||||
$this->iDb->insert('jo.greffes_requetes', $tabInsert, true);
|
||||
//echo EOL.'Insertion réponse Infogreffe'.EOL;
|
||||
}
|
||||
}
|
||||
@ -3692,7 +3692,7 @@ function getListeActes($siren) {
|
||||
'actif' => 1,
|
||||
'dateInsert' => date('YmdHis'),
|
||||
);
|
||||
@$iDb->insert('greffes_actes', $tabInsert);
|
||||
@$iDb->insert('jo.greffes_actes', $tabInsert);
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes::Debug getListeActes($siren)", print_r($tabInsert,true).mysql_error()) ;
|
||||
}
|
||||
}
|
||||
@ -3884,9 +3884,9 @@ function getBilansImages($siren, $ref='') {
|
||||
'type_comptes' => $typeCpt,
|
||||
'mode_diffusion' => implode(',',$tabVecteurs),
|
||||
);
|
||||
if (!$iDb->insert('greffes_bilans', $tabInsert))
|
||||
if (!$iDb->update('greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes='$typeCpt'"))
|
||||
$iDb->update('greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes=''");
|
||||
if (!$iDb->insert('jo.greffes_bilans', $tabInsert))
|
||||
if (!$iDb->update('jo.greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes='$typeCpt'"))
|
||||
$iDb->update('jo.greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes=''");
|
||||
}
|
||||
|
||||
}
|
||||
@ -3896,7 +3896,7 @@ function getBilansImages($siren, $ref='') {
|
||||
|
||||
|
||||
function getInfosCessions($siren) {
|
||||
$ret=$this->iDb->select('greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('jo.greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$tabCes=$ret[0];
|
||||
if (count($ret)>1)
|
||||
@ -4130,7 +4130,7 @@ function getListeCessions($typeProcedure='rj') {
|
||||
$tabInfo['effectif']=trim($matches[1]);
|
||||
|
||||
$tabCessions[]=$tabInfo;
|
||||
$id=$this->iDb->insert('greffes_cessions', $tabInfo, true);
|
||||
$id=$this->iDb->insert('jo.greffes_cessions', $tabInfo, true);
|
||||
if ($id) $nbInsert++;
|
||||
else $nbDeja++;
|
||||
//echo "$k (".$tabInfo['siren'].') : '.$tabInfo['nom']." ($id)".EOL;
|
||||
|
@ -104,8 +104,8 @@ class MIntersud {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -114,7 +114,7 @@ class MIntersud {
|
||||
/** On v<EFBFBD>rifie qu'aucune annonce n'a <EFBFBD>t<EFBFBD> publi<EFBFBD> depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -328,7 +328,7 @@ class MIntersud {
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class MLiens {
|
||||
//echo $siren;
|
||||
//print_r($tabIdentite);
|
||||
$nic=$tabIdentite['Nic'];
|
||||
$tab=$this->iDb->select('liens',
|
||||
$tab=$this->iDb->select('jo.liens',
|
||||
'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, actif, source, dateLien*1 AS dateLien, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate',
|
||||
"Siren1='$siren' AND ActionPart=1 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC);
|
||||
//$tabActiDB=mysql_select('dbo_liens_fi', 'SirenEntite, NomAdresse, PourcentageDetenu, Ville, Lien, MAJLien, MAJImport', "Siren='$siren' AND CodeLien='AC' ORDER BY PourcentageDetenu DESC");
|
||||
@ -77,7 +77,7 @@ class MLiens {
|
||||
$codPays=strtoupper($lien['Pays']);
|
||||
$libPays='';
|
||||
if ($codPays<>'' && $codPays<>'FRA') {
|
||||
$tmp=$this->iDb->select('tabPays', 'libPays', "codPays3='$codPays'", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabPays', 'libPays', "codPays3='$codPays'", true, MYSQL_ASSOC);
|
||||
$libPays=$tmp[0]['libPays'];
|
||||
}
|
||||
if ($lien['MajMin']=='F') $majMin='A';
|
||||
@ -127,7 +127,7 @@ class MLiens {
|
||||
case 7179: // (Autre) Service déconcentré de l'État à compétence territoriale
|
||||
case 7381: // Organisme consulaire
|
||||
/** Ces établissements sont dans le fichier des tribunaux **/
|
||||
$tmp=$this->iDb->select('tribunaux', 'triSiret, triNom, dateUpdate', "triId=(SELECT triIdSup FROM tribunaux WHERE triSiret LIKE '$siren%' LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tribunaux', 'triSiret, triNom, dateUpdate', "triId=(SELECT triIdSup FROM tribunaux WHERE triSiret LIKE '$siren%' LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tabCC=$tmp[0];
|
||||
//$sirenCC=substr(,0,9);
|
||||
//if ($siren*1<>$sirenCC*1)
|
||||
@ -293,7 +293,7 @@ class MLiens {
|
||||
else $strFonctions='';
|
||||
$adresse=end(explode(' ', $tabIdentite['AdresseVoie']));
|
||||
$codePostal=$tabIdentite['CP'];
|
||||
$tab=$this->iDb->select('rncs_dirigeants', 'typeDir, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, actif, naissance_nom, naissance_date, naissance_lieu, nat, adresse, fonction_code, fonction_lib, source, cinf, dateInsert, dateUpdate',
|
||||
$tab=$this->iDb->select('jo.rncs_dirigeants', 'typeDir, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, actif, naissance_nom, naissance_date, naissance_lieu, nat, adresse, fonction_code, fonction_lib, source, cinf, dateInsert, dateUpdate',
|
||||
"siren='$siren' AND fonction_lib IN ('Associé-gérant' $strFonctions)", true, MYSQL_ASSOC);
|
||||
$majMin='+';
|
||||
if (count($tab)>1) $majMin='-';
|
||||
@ -364,12 +364,12 @@ class MLiens {
|
||||
'actif'=> 1,
|
||||
'source'=> 1600,
|
||||
'dateInsert'=> date('YmdHis')));
|
||||
$res=$this->iDb->select('liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))");
|
||||
$res=$this->iDb->select('jo.liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$this->iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))", true))
|
||||
if (!$this->iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))", true))
|
||||
$errMaj=1016166;
|
||||
} else {
|
||||
if (!$this->iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$this->iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=1016167;
|
||||
}
|
||||
|
||||
@ -382,19 +382,19 @@ class MLiens {
|
||||
'actif'=> 1,
|
||||
'source'=> 1600,
|
||||
'dateInsert'=> date('YmdHis')));
|
||||
$res=$this->iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$this->iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$this->iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='".addslashes($nom2)."' AND Pays='$pays2'))", true))
|
||||
if (!$this->iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='".addslashes($nom2)."' AND Pays='$pays2'))", true))
|
||||
$errMaj=1016168;
|
||||
} else {
|
||||
if (!$this->iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$this->iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=1016169;
|
||||
}
|
||||
|
||||
/** Insertion du dirigeant pour l'actionnaire en base **/
|
||||
$dirs=$this->iDb->select('rncs_dirigeants','siren', "siren=$siren2", true, MYSQL_ASSOC);
|
||||
$dirs=$this->iDb->select('jo.rncs_dirigeants','siren', "siren=$siren2", true, MYSQL_ASSOC);
|
||||
if (count($dirs)==0) {
|
||||
$this->iDb->insert('rncs_dirigeants', array( 'siren' => $siren2,
|
||||
$this->iDb->insert('jo.rncs_dirigeants', array( 'siren' => $siren2,
|
||||
'raisonSociale' => $nom,
|
||||
'civilite' => $lien['civilite'],
|
||||
'typeDir' => $lien['typeDir'],
|
||||
@ -468,7 +468,7 @@ class MLiens {
|
||||
public function getParticipations($siren=false, $actifsUniquement=true) {
|
||||
if (!$siren) $siren=$this->siren;
|
||||
$tab=$this->iDb->select(
|
||||
'liens l LEFT JOIN tabPays ON codPays3=Pays',
|
||||
'jo.liens l LEFT JOIN jo.tabPays ON codPays3=Pays',
|
||||
'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, libPays, actif, source, dateLien*1 AS dateLien, DATE(l.dateInsert)*1 AS dateInsert, DATE(l.dateUpdate)*1 AS dateUpdate',
|
||||
"Siren1='$siren' AND ActionPart=2 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC); // OR Siren2='$siren
|
||||
$tabRet=array();
|
||||
@ -514,7 +514,7 @@ class MLiens {
|
||||
case 7179: // (Autre) Service déconcentré de l'État à compétence territoriale
|
||||
case 7381: // Organisme consulaire
|
||||
/** Ces établissements sont dans le fichier des tribunaux **/
|
||||
$tmp=$this->iDb->select('tribunaux t1', 't1.triSiret, t1.triNom', "t1.triIdSup=(SELECT t2.triId FROM tribunaux t2 WHERE t2.triSiret LIKE '$siren%' AND t2.triId<>t1.triId LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tribunaux t1', 't1.triSiret, t1.triNom', "t1.triIdSup=(SELECT t2.triId FROM tribunaux t2 WHERE t2.triSiret LIKE '$siren%' AND t2.triId<>t1.triId LIMIT 1)", true, MYSQL_ASSOC);
|
||||
foreach ($tmp as $tabCC) {
|
||||
// $sirenCC=substr($tabCC['triSiret'],0,9);
|
||||
if ($tabCC['triSiret']*1<>0) //$siren*1<>$sirenCC*1)
|
||||
@ -612,7 +612,7 @@ class MLiens {
|
||||
|
||||
public function getEvenements($siren=false) {
|
||||
if (!$siren) $siren=$this->siren;
|
||||
$tab=$this->iDb->select('rncs_even_info', 'siren, dateDepot, codeEven, depot_num, depot_date, acte_num, acte_date, acte_type, acte_lib, acte_pages, acte_nature, acte_decision, collecte, flux, dateInsert',
|
||||
$tab=$this->iDb->select('jo.rncs_even_info', 'siren, dateDepot, codeEven, depot_num, depot_date, acte_num, acte_date, acte_type, acte_lib, acte_pages, acte_nature, acte_decision, collecte, flux, dateInsert',
|
||||
"siren='$siren' AND codeEven IN(2,5,6,7,8,9,10,13,31,32,63)", true, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($tab as $i=>$lien) {
|
||||
@ -879,15 +879,15 @@ class MLiens {
|
||||
**/
|
||||
public function getInfoGroupe($siren) {
|
||||
if ($siren<1000) return false;
|
||||
$tmp=$this->iDb->select('etablissements_act',
|
||||
$tmp=$this->iDb->select('jo.etablissements_act',
|
||||
'raisonSociale, enseigne, sigle, identite_pre, adr_num, adr_btq, adr_typeVoie, adr_libVoie, adr_comp, adr_cp, adr_ville, adr_dep, adr_com, tel, fax, siren, sirenGrp',
|
||||
"siren=(SELECT distinct sirenGrp FROM etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
"siren=(SELECT distinct sirenGrp FROM jo.etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabEnt=$tmp[0];
|
||||
$sirenGrp=$tabEnt['siren'];
|
||||
|
||||
if ($sirenGrp<1000) return false;
|
||||
/** Table des Nafs5 => Secteurs **/
|
||||
$tmp=$this->iDb->select('tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tabNAf2=array();
|
||||
foreach ($tmp as $tmp2) {
|
||||
$tabNAf2[$tmp2['codNaf2']]=$tmp2['codNaf1'];
|
||||
|
@ -420,7 +420,7 @@ class MLiens2
|
||||
*/
|
||||
public function getCAC40()
|
||||
{
|
||||
$sql = "SELECT isin, nom, MAX(`date`) AS dateMAJ FROM sdv1.bourse_listes WHERE lstCode='xcac40p' GROUP BY lstCode, isin HAVING MAX(`date`) ORDER BY dateMAJ DESC;";
|
||||
$sql = "SELECT isin, nom, MAX(`date`) AS dateMAJ FROM sdv1.bourse_listes WHERE lstCode='xcac40p' GROUP BY lstCode, isin HAVING MAX(`date`) ORDER BY dateMAJ DESC;";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$output = array();
|
||||
|
@ -954,7 +954,7 @@ class MMap {
|
||||
$adrNum = str_pad($adrNum, 4, 0, STR_PAD_LEFT);
|
||||
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$ret = $this->iDb->select('zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
$ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
|
||||
|
||||
//Existe dans la base
|
||||
@ -984,7 +984,7 @@ class MMap {
|
||||
'l93_x'=>$this->l93x,
|
||||
'l93_y'=>$this->l93y
|
||||
);
|
||||
$this->iDb->update('zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
$this->iDb->update('jo.zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
}
|
||||
|
||||
$this->latitudeDeg = dec2dms($this->latitudeDec);
|
||||
@ -1061,7 +1061,7 @@ class MMap {
|
||||
if ($this->latitudeDec<>0 && $this->longitudeDec<>0 && $this->precision>0) {
|
||||
// print_r($tabInsert);
|
||||
//echo ($this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
$this->iDb->insert('zonageXY', $tabInsert);
|
||||
$this->iDb->insert('jo.zonageXY', $tabInsert);
|
||||
/*if (mysql_errno()>0) echo mysql_error().die(EOL);*/
|
||||
} else {
|
||||
$this->precision=$this->latitudeDec=$this->longitudeDec=0;
|
||||
|
@ -839,22 +839,6 @@ Une marque figurative
|
||||
if ($this->curPage<>'recherche')
|
||||
$this->partInitRecherche();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
/* $ret=$iDb->select( 'rncs_vitrine',
|
||||
'siren, erreur, rcs, nom, adresse1, cp, ville, fj_lib, naf_code, naf_lib, bilans, dateUpdate',
|
||||
"siren=$this->siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['bilans']=unserialize($tabRet['bilans']);
|
||||
return $tabRet;
|
||||
}
|
||||
}*/
|
||||
|
||||
$tabRet=$tabBilan=array();
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['erreur']='';
|
||||
@ -953,8 +937,8 @@ Une marque figurative
|
||||
fclose($fp);
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['bilans']=serialize($tabRet['bilans']);
|
||||
if (!$iDb->insert( 'rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
if (!$this->iDb->insert( 'jo.rncs_vitrine', $tabInsert))
|
||||
$this->iDb->update( 'jo.rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
/** @todo S'il y a un enregistrement, prévoir son update
|
||||
**/
|
||||
|
||||
@ -1325,8 +1309,7 @@ Une marque figurative
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$ret=$this->iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -1335,7 +1318,7 @@ Une marque figurative
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -1549,7 +1532,7 @@ Une marque figurative
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class MPrivileges
|
||||
$fields = "i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche, i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom , i.debConjoint , i.debUsage , i.debEnseigne , i.debActivite , i.debFj , i.debFjLib , i.debResidence , i.debNumVoie , i.debTypVoie , i.debLibVoie , i.debAdrComp , i.debCP , i.debVille , i.debPays , i.insType , i.insLib , i.insNum , i.insDate , i.insObjet , i.insMontant , i.insDev , i.insDateEch , i.insDateFin , i.insNanTx , i.insNanTitre , i.insNanOppo , i.insProNat , i.insProHui , i.insProRep , i.insNSCA , i.insNSCParts , i.insNSCSigni , i.creNom , i.creNumVoi, i.creTypVoi, i.creLibVoi, i.creAdrComp1, i.creAdrComp2, i.creCP, i.creVille, i.crePays, i.creAutres, i.radDate, i.radMention, i.radPartiel, i.radPartMt, i.radDev, i.radDiv, i.idFichier, i.dateInsert";
|
||||
$where = "i.siren=$siren $strTypes AND ( (i.insType='03' AND DATEDIFF(NOW(),i.insDate)<=900) /** Durée de vie PRIV Sécu **/ OR (i.insType='04' AND DATEDIFF(NOW(),i.insDate)<=1460) /** Durée de vie PRIV Trésor **/ )";
|
||||
$where.= " ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC;";
|
||||
$tables = "greffes_privileges i";
|
||||
$tables = "jo.greffes_privileges i";
|
||||
|
||||
$iRncs = new MRncs($this->iDb);
|
||||
$tabRet = array();
|
||||
|
@ -18,7 +18,7 @@ class MQualibat {
|
||||
|
||||
function __construct($accesDist=true) {// $adresse, $cp, $ville, $pays='France') {
|
||||
$this->accesDist=$accesDist;
|
||||
$this->iDb=new WDb('sdv1');
|
||||
$this->iDb=new WDB();
|
||||
$this->iBodacc=new MBodacc();
|
||||
$this->$iInsee=new MInsee();
|
||||
}
|
||||
@ -112,7 +112,7 @@ Gérer en fonction du code CJ
|
||||
}
|
||||
|
||||
public function getMaxQualibat() {
|
||||
$ret=$this->iDb->select('qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
return $ret[0]['id'];
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Gérer en fonction du code CJ
|
||||
$tabQualibatCalc[]=$i;
|
||||
|
||||
// Liste des Qualibat en base
|
||||
$ret=$this->iDb->select('qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$res)
|
||||
$tabQualibatBase[]=$res['id'];
|
||||
|
||||
@ -138,19 +138,19 @@ Gérer en fonction du code CJ
|
||||
$strWhere="id=$idQualibat";
|
||||
} else return false;
|
||||
|
||||
$ret=$this->iDb->select('qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
$ret=$this->iDb->select('sdv1.qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert', $strWhere, false, MYSQL_ASSOC);
|
||||
if (!$this->force && count($ret)>0) {
|
||||
$this->enCache=true;
|
||||
$tabRet=$ret[0];//array();
|
||||
|
||||
// Ajout des qualifications
|
||||
$ret=$this->iDb->select('qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch', $strWhere, false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['qualifications'][]=$tabTmp;
|
||||
|
||||
// Ajout des dirigeants
|
||||
$ret=$this->iDb->select('qualibatdir','civNomPrenom, civilite, nom, prenom, fonction', $strWhere, false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibatdir','civNomPrenom, civilite, nom, prenom, fonction', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['dirigeants'][]=$tabTmp;
|
||||
} elseif ($this->accesDist==true) {
|
||||
@ -168,7 +168,7 @@ Gérer en fonction du code CJ
|
||||
$this->erreur='Numéro Qualibat inexistant';
|
||||
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
|
||||
if ($idQualibat<$this->getMaxQualibat())
|
||||
$this->iDb->insert('qualibat', $tabInsert);
|
||||
$this->iDb->insert('sdv1.qualibat', $tabInsert);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -306,8 +306,8 @@ Gérer en fonction du code CJ
|
||||
'dateDeb'=>@$tabDateAttrib[0],
|
||||
'dateFin'=>@$tabDateFin[0]));
|
||||
unset($tabInsert['qualifications']);
|
||||
if (!$this->iDb->insert('qualibat', $tabInsert)) {
|
||||
$this->iDb->update('qualibat', $tabInsert, "id=$idQualibat");
|
||||
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
|
||||
}
|
||||
|
||||
|
||||
@ -318,8 +318,8 @@ Gérer en fonction du code CJ
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,8 +330,8 @@ Gérer en fonction du code CJ
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
}
|
||||
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
@ -120,7 +120,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$tabJug=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabJug[$dev['codJugement']*1]=$dev['codEven'];
|
||||
@ -146,7 +146,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$tabPays=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabPays[$dev['codePaysInpi']*1]=$dev['codPays'];
|
||||
@ -158,7 +158,7 @@ class MRncs
|
||||
/** Tableau des mandataires suceptibles d'être tranmis par l'INPI
|
||||
**/
|
||||
private function getTabMandataires() {
|
||||
$tabTmp=$this->iDb->select('tabMandataires', "UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact", "TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabMandataires', "UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact", "TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabMandSD=array();
|
||||
foreach ($tabTmp as $mand) {
|
||||
$tabMandSD[]=array( 'id' => $mand['id'],
|
||||
@ -196,7 +196,7 @@ class MRncs
|
||||
|
||||
//echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
|
||||
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires',
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires',
|
||||
"id, Nom, Prenom, adresse, adresseComp, cp, ville, MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"TYPE IN ('A', 'M') AND (Nom<>'' OR Prenom <>'') AND MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) ORDER BY score DESC LIMIT 0,10",false, MYSQL_ASSOC);
|
||||
$nbRet=count($tabTmp);
|
||||
@ -244,7 +244,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tribunaux', 'triNumGreffe, triNom, triId, triCode', 'triNumGreffe IS NOT NULL', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tribunaux', 'triNumGreffe, triNom, triId, triCode', 'triNumGreffe IS NOT NULL', false, MYSQL_ASSOC);
|
||||
$tabTribunaux=array();
|
||||
foreach($rep as $k=>$dev) {
|
||||
$tabTribunaux[$dev['triNumGreffe']*1]['Id']=$dev['triId'];
|
||||
@ -264,7 +264,7 @@ class MRncs
|
||||
{
|
||||
$fj=$code_forme_juridique*1;
|
||||
if ($fj>0 && $fj<10000) {
|
||||
$tmp=$this->iDb->select('tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
$tmp=$this->iDb->select('jo.tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
return @$tmp[0][0];
|
||||
} else
|
||||
return 'En instance de chiffrement';
|
||||
@ -277,9 +277,9 @@ class MRncs
|
||||
*/
|
||||
private function getLibelleNaf($codeNaf)
|
||||
{
|
||||
$ret=$this->iDb->query("SELECT libNaf700 AS LibNaf FROM tabNaf4 WHERE codNaf700='$codeNaf' UNION
|
||||
SELECT libNaf5 AS LibNaf FROM tabNaf5 WHERE codNaf5='$codeNaf'");
|
||||
$res=$this->iDb->fetch(MYSQL_ASSOC);
|
||||
$ret = $this->iDb->query("SELECT libNaf700 AS LibNaf FROM jo.tabNaf4 WHERE codNaf700='$codeNaf'
|
||||
UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'");
|
||||
$res = $this->iDb->fetch(MYSQL_ASSOC);
|
||||
return $res['LibNaf'];
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ class MRncs
|
||||
if ($nic>0) $strSql=" AND nic=$nic";
|
||||
else $strSql=" AND siege=1 ORDER BY actif DESC, nic DESC";
|
||||
|
||||
$rep=$this->iDb->select('rncs_etab', 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren $strSql", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.rncs_etab', 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren $strSql", false, MYSQL_ASSOC);
|
||||
if ( count($rep)==0 ) {
|
||||
return false;
|
||||
}
|
||||
@ -384,7 +384,7 @@ class MRncs
|
||||
public function getInfosEntrep($siren)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select('rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
|
||||
if (count($rep)>0) {
|
||||
$entrep=$rep[0];
|
||||
@ -443,7 +443,7 @@ class MRncs
|
||||
}
|
||||
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_even e LEFT JOIN tabEvenRncs l ON e.codeEven=l.codeEven',
|
||||
'jo.rncs_even e LEFT JOIN jo.tabEvenRncs l ON e.codeEven=l.codeEven',
|
||||
'e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert',
|
||||
$where, false, MYSQL_ASSOC);
|
||||
|
||||
@ -472,7 +472,7 @@ class MRncs
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_jugements j, tabJugeRncs l, tabEvenements e',
|
||||
'jo.rncs_jugements j, jo.tabJugeRncs l, jo.tabEvenements e',
|
||||
'siren, j.dateEffet, j.codeJugement, j.flux, l.libJugement, e.codEven, e.libEven,
|
||||
adm1id, adm1codeFct, adm1type, adm1nom, adm1adrNum, adm1adrInd, adm1adrType, adm1adrLibVoie, adm1adrVoie, adm1adr1, adm1adr2, adm1adr3, adm1adrCP, adm1adrVille,
|
||||
adm2id, adm2codeFct, adm2type, adm2nom, adm2adrNum, adm2adrInd, adm2adrType, adm2adrLibVoie, adm2adrVoie, adm2adr1, adm2adr2, adm2adr3, adm2adrCP, adm2adrVille',
|
||||
@ -534,7 +534,7 @@ class MRncs
|
||||
if ($dateFin<>'') $strDateFin=" AND flux<='$dateFin' ";
|
||||
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_modifs',
|
||||
'jo.rncs_modifs',
|
||||
'siren, nic, `table`, champs, valeur, flux, dateInsert',
|
||||
"siren=$siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep' ORDER BY flux DESC", false, MYSQL_ASSOC);
|
||||
foreach ($rep as $iModif=>$modif) {
|
||||
@ -639,7 +639,7 @@ class MRncs
|
||||
$strDates='';
|
||||
}
|
||||
|
||||
$tabTmp=$this->iDb->select('annonces', 'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom,
|
||||
$tabTmp=$this->iDb->select('jo.annonces', 'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom,
|
||||
dateSource, dateInsert, source, tribunal, raisonSociale',"siren=$siren $strDates AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes ) AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC", false, MYSQL_ASSOC);
|
||||
if (isset($tabTmp[0])) {
|
||||
$depot=$tabTmp[0];
|
||||
@ -818,7 +818,7 @@ class MRncs
|
||||
$tabInsert['dateDemande']=date('Ymd');
|
||||
if ($origineDemande<>'')
|
||||
$tabInsert['origineDemande']=$origineDemande;
|
||||
$this->iDb->insert('rncs_demandes', $tabInsert, false);
|
||||
$this->iDb->insert('jo.rncs_demandes', $tabInsert, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ class MRncs
|
||||
$tabInsert['dateDemande']=date('Ymd');
|
||||
if ($origineDemande<>'')
|
||||
$tabInsert['origineDemande']=$origineDemande;
|
||||
$this->iDb->insert('rncs_demandes', $tabInsert, false);
|
||||
$this->iDb->insert('jo.rncs_demandes', $tabInsert, false);
|
||||
|
||||
// Une erreur ?
|
||||
if ($this->infoIMR['validation-erreur']<>'')
|
||||
@ -879,7 +879,7 @@ class MRncs
|
||||
$siren=$siren*1;
|
||||
$tabRet=array();
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants',
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
|
||||
"siren=$siren AND actif%10=1 ORDER BY fonction_code DESC", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
@ -917,7 +917,7 @@ class MRncs
|
||||
}
|
||||
if ($numDir==0) {
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_entrep',
|
||||
'jo.rncs_entrep',
|
||||
"siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite, nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu, 1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert",
|
||||
"siren=$siren", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
|
@ -598,24 +598,24 @@ class MRncsFlux {
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
@ -648,7 +648,7 @@ $params=md5(serialize($prod));
|
||||
/*if ($prod['CmdNom']<>'' || $prod['CmdPages']<>'' || $prod['CmdBilan']<>'' || $prod['Millesime']<>'')
|
||||
$strOption=*/
|
||||
//AND params='$params'
|
||||
$res=$this->iDb->select('rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' AND (type<>'QVIT' OR (type='QVIT' AND DATEDIFF(NOW(),dateRequete)<=1)) ORDER BY dateRequete DESC");
|
||||
$res=$this->iDb->select('jo.rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' AND (type<>'QVIT' OR (type='QVIT' AND DATEDIFF(NOW(),dateRequete)<=1)) ORDER BY dateRequete DESC");
|
||||
//type='".$prod['Type']."' AND presta ='".$prod['Presta']."' $strOption ORDER BY dateRequete DESC");
|
||||
if (count($res)>0) {
|
||||
$tabRes=$res[0];
|
||||
@ -658,7 +658,7 @@ if (count($res)>0) {
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
//echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
//die();
|
||||
} else {
|
||||
//echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
@ -712,8 +712,8 @@ if (count($res)>0) {
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
if (!$this->iDb->insert('rncs_requetes', $tabInsert, true))
|
||||
$this->iDb->update('rncs_requetes', $tabInsert, "siren=$siren AND params='$params'");
|
||||
if (!$this->iDb->insert('jo.rncs_requetes', $tabInsert, true))
|
||||
$this->iDb->update('jo.rncs_requetes', $tabInsert, "siren=$siren AND params='$params'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ else {
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
@ -762,7 +762,7 @@ else {
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
|
@ -575,24 +575,24 @@ class MRncsFlux {
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
@ -635,7 +635,7 @@ if (count($res)>0) {
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
//die();
|
||||
} else {
|
||||
echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
@ -680,7 +680,7 @@ if (count($res)>0) {
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
$this->iDb->insert('rncs_requetes', $tabInsert, true);
|
||||
$this->iDb->insert('jo.rncs_requetes', $tabInsert, true);
|
||||
}
|
||||
|
||||
if ($prod['Presta']==12004)
|
||||
@ -708,7 +708,7 @@ else {
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
@ -728,7 +728,7 @@ else {
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
|
@ -19,7 +19,7 @@ class MRnvp
|
||||
*/
|
||||
protected function getTabDevisesInpi()
|
||||
{
|
||||
$rep=$this->iDb->select('tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
|
@ -81,7 +81,7 @@ class classMSigVille
|
||||
$iDb=new WDB();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$iDb->select( 'zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$ret=$iDb->select( 'jo.zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$zones=$ret[0];
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
@ -151,7 +151,7 @@ class classMSigVille
|
||||
'adrLibVoie'=>$adrLibVoie,
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
$iDb->insert('zonage', $tabInsert);
|
||||
$iDb->insert('jo.zonage', $tabInsert);
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
@ -187,7 +187,7 @@ class classMSigVille
|
||||
//return $tabRep;
|
||||
}
|
||||
$codeInsee=substr($codeRivoli,0,5);
|
||||
$ret=$iDb->select( 'zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$ret=$iDb->select( 'jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$tabRep['ZRR']=$tabRep['AFR']='NON';
|
||||
foreach ($ret as $zones)
|
||||
switch ($zones['typeZone']) {
|
||||
|
@ -73,7 +73,7 @@ class MTel
|
||||
elseif($actif==0) $strActif=" AND actif=0 ";
|
||||
|
||||
$ret=$this->iDb->select(
|
||||
'telephonie',
|
||||
'jo.telephonie',
|
||||
'siren,nic,dateProvPartenaire,typeTel,infoTel,LPAD(telephone,10,0) AS telephone,actif,partenaire,idUtilisateur,dateInsert,dateInsert*1 AS dateInsertYmd,dateConfPartenaire,partenaireConf,nbConf,idUpdate,dateUpdate,dateUpdate*1 AS dateUpdateYmd',
|
||||
"siren=$siren $strNic $strActif AND dateSuppr=0 ORDER BY typeTel ASC, nbConf DESC", false, MYSQL_ASSOC);
|
||||
if (count($ret)>0)
|
||||
@ -83,7 +83,7 @@ class MTel
|
||||
{
|
||||
if ($tabTel['typeTel']=='an8' && $tabTel['infoTel']*1>0) {
|
||||
$an8=$tabTel['infoTel']*1;
|
||||
$retTmp=$this->iDb->select('tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
|
||||
$retTmp=$this->iDb->select('jo.tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
|
||||
$infoTel=ucfirst(strtolower($retTmp[0]['libAn8']));
|
||||
} else {
|
||||
$infoTel=$tabTel['infoTel'];
|
||||
@ -167,7 +167,7 @@ class MTel
|
||||
$res['domaines']=trim(preg_replace('/ +/', ' ', preg_replace('/\r+|\n+|\s+/',' ',htm2txt(strip_tags(@getTextInHtml($body, '<div class="puce_domaine">','<strong>','</div>'))))));
|
||||
|
||||
if ($res['urlSite']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -186,7 +186,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['urlLogo']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -205,7 +205,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['domaines']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -224,7 +224,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['urlMail']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -264,7 +264,7 @@ class MTel
|
||||
'telephone'=>$tabT['telNum'],
|
||||
'actif'=>1,
|
||||
);
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
|
@ -113,7 +113,7 @@ class MSitesWeb {
|
||||
|
||||
function __construct(/*$siren, $accesDist=true*/) {
|
||||
$this->iInsee=new MInsee();
|
||||
$this->iDb=new WDB('jo');
|
||||
$this->iDb=new WDB();
|
||||
}
|
||||
|
||||
/** L'adresse IP est elle valide ?
|
||||
@ -332,7 +332,7 @@ Actif (consultez aussi le <b><a href="http://www.decideo.fr" class="ext" target=
|
||||
$domaine=getFileExtension(preg_replace("/\.$ext$/",'','.'.$host));
|
||||
echo "RECHERCHE DE '$nomEntrep' ($siren) : Trouvé $domaine.$ext".EOL;
|
||||
if ($ext=='fr') {
|
||||
$rep=$this->iDb->select('sitesWeb', 'siren, web', "web=$url");
|
||||
$rep=$this->iDb->select('jo.sitesWeb', 'siren, web', "web=$url");
|
||||
if (@$rep[0]['siren']*1==0) {
|
||||
$tabAfnic=$this->getInfosAfnic("$domaine.$ext");
|
||||
$siren=$tabAfnic['siren']*1;
|
||||
@ -340,7 +340,7 @@ Actif (consultez aussi le <b><a href="http://www.decideo.fr" class="ext" target=
|
||||
$tabInsert=array('siren'=>$siren,
|
||||
'web'=>$url,
|
||||
'dateInsert'=>date('YmdHis'));
|
||||
$this->iDb->insert('sitesWeb', $tabInsert);
|
||||
$this->iDb->insert('jo.sitesWeb', $tabInsert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6624
library/Metier/scores/Comment/Score_414_5.php
Normal file
6624
library/Metier/scores/Comment/Score_414_5.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -26,10 +26,10 @@ function getIndiscoreHisto($siren)
|
||||
WHERE siren=$siren
|
||||
GROUP BY indiScoreDate
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB('jo');
|
||||
$ret=$iDb->query($query);
|
||||
$tabRet=array();
|
||||
while($ret=$iDb->fetch(MYSQL_ASSOC)) {
|
||||
$iDb = new WDB();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
$tabRet[]=array(
|
||||
'siren' => $ret['siren'],
|
||||
'actif' => $ret['actif'],
|
||||
@ -80,10 +80,10 @@ function getIndiscoreCache($siren)
|
||||
FROM jo.scores_surveillance
|
||||
WHERE siren=$siren
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB('jo');
|
||||
$ret=$iDb->query($query);
|
||||
$tabRet=array();
|
||||
while($ret=$iDb->fetch(MYSQL_ASSOC))
|
||||
$iDb = new WDB();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) )
|
||||
{
|
||||
$tabRet[] = array (
|
||||
'siren' => $ret['siren'],
|
||||
@ -132,7 +132,7 @@ function getIndiscoreCache($siren)
|
||||
function getScoreSecteur($naf5)
|
||||
{
|
||||
if (len($naf)<>5) return false;
|
||||
$tabTmp=$iDb->select( 'scores_surveillance',
|
||||
$tabTmp=$iDb->select( 'jo.scores_surveillance',
|
||||
'naf, AVG(indiScore) AS score100moy, AVG(indiScore20) AS score20moy, AVG(encours) AS encoursMoy, MAX(indiScoreDate) AS lastScore, COUNT(siren) AS nbSiren',
|
||||
"naf='$naf5' AND actif=1", false, MYSQL_ASSOC);
|
||||
if ( count($tabTmp)>0 ) {
|
||||
@ -1144,7 +1144,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
elseif (count($tabAnnees)>1) $strAnnees='AND annee BETWEEN '.$tabAnnees[1].' AND '.$tabAnnees[0];
|
||||
else $strAnnees='AND annee='.$tabAnnees[0];
|
||||
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, montant, nombre',
|
||||
"1 $strNaf $strAnnees ORDER BY annee DESC, id ASC",
|
||||
INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
@ -2447,7 +2447,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
*
|
||||
**/
|
||||
$ENQUETE='';
|
||||
$tabTmp=$iDb->select('scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp=$iDb->select('jo.scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$timer['scores_cutoff'] = microtime(true);
|
||||
if (isset($tabTmp[0]['encours'])) {
|
||||
if($tabTmp[0]['dateUpdate']>$tabTmp[0]['dateInsert']) {
|
||||
@ -2739,7 +2739,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** CA Moyen par salarié pour un secteur donné
|
||||
**/
|
||||
/*$tabTmp=$iDb->select('ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
/*$tabTmp=$iDb->select('jo.ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
$caSecteur=round($tabTmp[0]['moyenne']*1000);
|
||||
// Encours moyen secteur * nb salariés
|
||||
if ($EFFECTIF>0) $CAESTIME=$caSecteur*$EFFECTIF;
|
||||
@ -3015,19 +3015,19 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** N° d'ordre de l'entreprise dans le classement des CA pour le marché de l'entreprise **/
|
||||
$caTmp = round($CABIOUES,0);
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHEPLACE = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHEPLACE_DEP = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHENBENT_VILLE = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHENBENT_DEP = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
@ -3273,10 +3273,10 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//if ($codeCommuneInsee>=75000 && $codeCommuneInsee<76000)
|
||||
$VILLE=$tabIdentite['Ville']; // Ville ou ville + arrondissement de l'entreprise
|
||||
$ya2ans=$ANNEEp2.'-'.date('m-d');
|
||||
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
$ret = $iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
FROM (
|
||||
SELECT v.id, v.VenteMt
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.codeCommune LIKE '$codeCommuneInsee'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
@ -3296,7 +3296,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
FROM (
|
||||
SELECT v.id, v.VenteMt
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.codeCommune LIKE '".$tabIdentite['Dept']."%'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
@ -3312,7 +3312,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
FROM (
|
||||
SELECT v.id, v.VenteMt
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
AND v.VenteMt>1 AND v.VenteDev='EUR' $filtreCAEff
|
||||
@ -3801,7 +3801,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** Historisation du score **/
|
||||
$tabTmp = $iDb->select(
|
||||
'scores_surveillance s',
|
||||
'jo.scores_surveillance s',
|
||||
"s.siren, s.actif, s.procol, s.indiScore, s.indiScore20, s.encours, s.indiScoreDate, scoreSolv, scoreConf, scoreDir, scoreZ, scoreCH, scoreAfdcc1, scoreAfdcc2, scoreAfdcc2note, scoreAltman, scoreAltmanCote, scoreCCF, situFi, infoNote, noteStruct, noteFin, tendance, nbModifs, s.dateUpdate, s.cs, s.csMoisMaj, s.csMoisFin",
|
||||
"s.siren=$siren",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3931,13 +3931,13 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//Sauvegarde et Historisation du score
|
||||
if ( $actionHisto == 'insert' )
|
||||
{
|
||||
if (!$iDb->insert('scores_surveillance', $tabUpdate, false, true)) {
|
||||
if (!$iDb->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$iDb->update('scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
if (!$iDb->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$codePaysIso2='FR';
|
||||
if ($entrep['Dept']>98) {
|
||||
$codePaysInsee=$entrep['codeCommune'];
|
||||
$iDb=new WDB('jo');
|
||||
$iDb=new WDB();
|
||||
$tabTmp=$iDb->select(
|
||||
'jo.tabPays j, insee.insee_tabPays i',
|
||||
'j.codPays, j.numPays, j.codPays3, j.codePaysInpi, j.libPays, i.LIBCOG, i.ACTUAL',
|
||||
|
@ -145,7 +145,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$codePaysIso2='FR';
|
||||
if ($entrep['Dept']>98) {
|
||||
$codePaysInsee=$entrep['codeCommune'];
|
||||
$iDb=new WDB('jo');
|
||||
$iDb=new WDB();
|
||||
$tabTmp=$iDb->select(
|
||||
'jo.tabPays j, insee.insee_tabPays i',
|
||||
'j.codPays, j.numPays, j.codPays3, j.codePaysInpi, j.libPays, i.LIBCOG, i.ACTUAL',
|
||||
|
@ -119,8 +119,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($nbPrivileges>0) {
|
||||
$identite->Privileges = true;
|
||||
} else {
|
||||
$iDb = new WDB('sdv1');
|
||||
$sql = "SELECT count(*) AS nbPriv FROM ge_cs2 WHERE cs = 'P' AND dateFin >= NOW() AND dateSuppr=0 AND siren=$siren;";
|
||||
$iDb = new WDB();
|
||||
$sql = "SELECT count(*) AS nbPriv FROM sdv1.ge_cs2 WHERE cs = 'P' AND dateFin >= NOW() AND dateSuppr=0 AND siren=$siren;";
|
||||
$ret = $iDb->query($sql);
|
||||
if ($ret[0]['nbPriv']>0) {
|
||||
$identite->Privileges = true;
|
||||
@ -690,7 +690,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants', array(
|
||||
$iDb->insert('jo.siren_inexistants', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
|
@ -119,8 +119,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($nbPrivileges>0) {
|
||||
$identite->Privileges = true;
|
||||
} else {
|
||||
$iDb = new WDB('sdv1');
|
||||
$sql = "SELECT count(*) AS nbPriv FROM ge_cs2 WHERE cs = 'P' AND dateFin >= NOW() AND dateSuppr=0 AND siren=$siren;";
|
||||
$iDb = new WDB();
|
||||
$sql = "SELECT count(*) AS nbPriv FROM sdv1.ge_cs2 WHERE cs = 'P' AND dateFin >= NOW() AND dateSuppr=0 AND siren=$siren;";
|
||||
$ret = $iDb->query($sql);
|
||||
if ($ret[0]['nbPriv']>0) {
|
||||
$identite->Privileges = true;
|
||||
@ -690,7 +690,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants', array(
|
||||
$iDb->insert('jo.siren_inexistants', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
|
@ -2691,7 +2691,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants',
|
||||
$iDb->insert('jo.siren_inexistants',
|
||||
array( 'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
@ -2991,7 +2991,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($delete) {
|
||||
|
||||
$tabUpdate = array('dateSuppr'=>date('Y-m-d'));
|
||||
$result = $iDb->update('surveillances_site',
|
||||
$result = $iDb->update('jo.surveillances_site',
|
||||
$tabUpdate,
|
||||
"source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'"
|
||||
);
|
||||
@ -3001,13 +3001,13 @@ class Entreprise extends Scores_Ws_Server
|
||||
$where = "source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'";
|
||||
|
||||
//Si la donnée existe déjà alors il faut mettre à jour l'encours client
|
||||
$detect = $iDb->select('surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
$detect = $iDb->select('jo.surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
if ( count($detect)>0 ) {
|
||||
|
||||
$data = array(
|
||||
'encoursClient' => $encoursClient,
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where);
|
||||
|
||||
} else {
|
||||
|
||||
@ -3028,7 +3028,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$result = $iDb->insert('surveillances_site', $data);
|
||||
$result = $iDb->insert('jo.surveillances_site', $data);
|
||||
}
|
||||
}
|
||||
$output = new SetSurveillanceReturn();
|
||||
@ -3101,7 +3101,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'count(*) as nb', "login='$login' AND dateSuppr=0 $strSiren $strSource",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3109,7 +3109,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Récupération des résultats
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 $strSiren $strSource $orderBy LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3118,7 +3118,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3127,7 +3127,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
// Récupération des résultats
|
||||
if ($nbRepTot>0){
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren ORDER BY siren LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3136,7 +3136,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$listeSiren[] = $v['siren'];
|
||||
}
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 AND siren IN (".join(',',$listeSiren).") $strSiren ORDER BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3163,7 +3163,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$rs = $tabIdentite['Nom'];
|
||||
$cp = $tabIdentite['CP'];
|
||||
$ville = $tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site', array(
|
||||
$iDb->update('jo.surveillances_site', array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -3239,21 +3239,21 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$where = "u.idClient='$idClient' AND u.actif=1 AND s.dateSuppr=0 AND ( s.siren='$search' OR s.ref='$search' OR s.rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$where = "login='$login' AND dateSuppr=0 AND ( siren='$search' OR ref='$search' OR rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
}
|
||||
@ -3464,7 +3464,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if (strlen($dateAnnee)==4) $annee = $dateAnnee;
|
||||
else $annee = substr($dateAnnee,0,4);
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
switch (strtoupper($source))
|
||||
{
|
||||
@ -3482,18 +3482,18 @@ class Entreprise extends Scores_Ws_Server
|
||||
"$annee AS Annee_Parution, e.NOBOD AS Num_Parution, e.NOANN AS Num_Annonce, e.NOPAGE AS Num_Page, e.`DATE` AS Date_Parution, e.DEPT AS Departement, e.CODTRI AS Tribunal_Code, 'I' AS typeAnnonce, CONCAT(e.NOANN,' - ',t.annonceTxt) AS annonce",
|
||||
"e.JAL=$numJAL AND e.NOBOD=$numParution AND e.`DATE` BETWEEN $anneeDeb AND $anneeFin AND e.NOANN=$numAnnonce AND e.ANBASE=t.annonceNum", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$res = $iDb->select('bodacc',
|
||||
$res = $iDb->select('jo.bodacc',
|
||||
'Bodacc_Annee_Parution AS Annee_Parution, Bodacc_Num AS Num_Parution, Num_Annonce, Bodacc_Page AS Num_Page, Bodacc_Date_Parution AS Date_Parution, Tribunal_Dept AS Departement, Tribunal_Code, typeAnnonce, annonce',
|
||||
"Bodacc_Code='$lettre' AND Bodacc_Annee_Parution=$annee AND Bodacc_Num=$numParution AND Num_Annonce=$numAnnonce", false, MYSQL_ASSOC);
|
||||
}
|
||||
break;
|
||||
case 'ASSO':
|
||||
$res = $iDb->select('asso',
|
||||
$res = $iDb->select('jo.asso',
|
||||
'YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Annonce, pageDeb AS Num_Page, Date_Parution, Departement, codTribunal AS Tribunal_Code, typeAnnonce, Annonce_Html AS annonce', "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$annee".sprintf('%04d', $numParution)." AND Num_Annonce=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
case 'BALO':
|
||||
$res = $iDb->select('balo',
|
||||
$res = $iDb->select('jo.balo',
|
||||
"YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Affaire AS Num_Annonce, '' AS Num_Page, Date_Parution, '' AS Departement, '' AS Tribunal_Code, 'Insertion' AS typeAnnonce, Annonce_Html AS annonce", "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$numParution AND Num_Affaire=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
@ -3676,8 +3676,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ( count($tabAnnees)>0 )
|
||||
{
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3811,7 +3811,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->authenticate();
|
||||
|
||||
//Initialisation
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
$tabRet = array();
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",
|
||||
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
@ -3820,8 +3820,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=$iDb->select('sdv1.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('sdv1.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque){
|
||||
$dateSource=$tabBanque['dateSource'];
|
||||
@ -3912,14 +3912,11 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ($type=='pre'){
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp2 = $iDb->select('villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$iDb = new WDB();
|
||||
$tabTmp2 = $iDb->select('jo.villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$arrond = $tabTmp2[0]['AR'];
|
||||
unset($iDb);
|
||||
$iDb = new WDB('insee');
|
||||
$tabTmp2 = $iDb->select('insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
$tabTmp2 = $iDb->select('insee.insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
$nomSousPref = trim(strtr($tabTmp2[0]['ARTMAJ'],array('('=>'',')'=>'',' '=>'', "'"=>'')).' '.$tabTmp2[0]['NCC']);
|
||||
unset($iDb);
|
||||
$tabTmp = $iBodacc->getTribunauxParDep($dep);
|
||||
foreach ($tabTmp as $i=>$tribunal)
|
||||
{
|
||||
@ -4208,7 +4205,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
$db = new WDB('jo');
|
||||
$db = new WDB();
|
||||
if (!$db) {
|
||||
$error->statusCode = 9000;
|
||||
$error->statusMsg = $this->listError['9000'];
|
||||
|
@ -2691,7 +2691,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants',
|
||||
$iDb->insert('jo.siren_inexistants',
|
||||
array( 'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
@ -2991,7 +2991,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($delete) {
|
||||
|
||||
$tabUpdate = array('dateSuppr'=>date('Y-m-d'));
|
||||
$result = $iDb->update('surveillances_site',
|
||||
$result = $iDb->update('jo.surveillances_site',
|
||||
$tabUpdate,
|
||||
"source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'"
|
||||
);
|
||||
@ -3001,13 +3001,13 @@ class Entreprise extends Scores_Ws_Server
|
||||
$where = "source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'";
|
||||
|
||||
//Si la donnée existe déjà alors il faut mettre à jour l'encours client
|
||||
$detect = $iDb->select('surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
$detect = $iDb->select('jo.surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
if ( count($detect)>0 ) {
|
||||
|
||||
$data = array(
|
||||
'encoursClient' => $encoursClient,
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where);
|
||||
|
||||
} else {
|
||||
|
||||
@ -3028,7 +3028,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$result = $iDb->insert('surveillances_site', $data);
|
||||
$result = $iDb->insert('jo.surveillances_site', $data);
|
||||
}
|
||||
}
|
||||
$output = new SetSurveillanceReturn();
|
||||
@ -3101,7 +3101,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'count(*) as nb', "login='$login' AND dateSuppr=0 $strSiren $strSource",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3109,7 +3109,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Récupération des résultats
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 $strSiren $strSource $orderBy LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3118,7 +3118,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3127,7 +3127,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
// Récupération des résultats
|
||||
if ($nbRepTot>0){
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren ORDER BY siren LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3136,7 +3136,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$listeSiren[] = $v['siren'];
|
||||
}
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 AND siren IN (".join(',',$listeSiren).") $strSiren ORDER BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -3163,7 +3163,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$rs = $tabIdentite['Nom'];
|
||||
$cp = $tabIdentite['CP'];
|
||||
$ville = $tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site', array(
|
||||
$iDb->update('jo.surveillances_site', array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -3239,21 +3239,21 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$where = "u.idClient='$idClient' AND u.actif=1 AND s.dateSuppr=0 AND ( s.siren='$search' OR s.ref='$search' OR s.rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$where = "login='$login' AND dateSuppr=0 AND ( siren='$search' OR ref='$search' OR rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
}
|
||||
@ -3464,7 +3464,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if (strlen($dateAnnee)==4) $annee = $dateAnnee;
|
||||
else $annee = substr($dateAnnee,0,4);
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
switch (strtoupper($source))
|
||||
{
|
||||
@ -3482,18 +3482,18 @@ class Entreprise extends Scores_Ws_Server
|
||||
"$annee AS Annee_Parution, e.NOBOD AS Num_Parution, e.NOANN AS Num_Annonce, e.NOPAGE AS Num_Page, e.`DATE` AS Date_Parution, e.DEPT AS Departement, e.CODTRI AS Tribunal_Code, 'I' AS typeAnnonce, CONCAT(e.NOANN,' - ',t.annonceTxt) AS annonce",
|
||||
"e.JAL=$numJAL AND e.NOBOD=$numParution AND e.`DATE` BETWEEN $anneeDeb AND $anneeFin AND e.NOANN=$numAnnonce AND e.ANBASE=t.annonceNum", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$res = $iDb->select('bodacc',
|
||||
$res = $iDb->select('jo.bodacc',
|
||||
'Bodacc_Annee_Parution AS Annee_Parution, Bodacc_Num AS Num_Parution, Num_Annonce, Bodacc_Page AS Num_Page, Bodacc_Date_Parution AS Date_Parution, Tribunal_Dept AS Departement, Tribunal_Code, typeAnnonce, annonce',
|
||||
"Bodacc_Code='$lettre' AND Bodacc_Annee_Parution=$annee AND Bodacc_Num=$numParution AND Num_Annonce=$numAnnonce", false, MYSQL_ASSOC);
|
||||
}
|
||||
break;
|
||||
case 'ASSO':
|
||||
$res = $iDb->select('asso',
|
||||
$res = $iDb->select('jo.asso',
|
||||
'YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Annonce, pageDeb AS Num_Page, Date_Parution, Departement, codTribunal AS Tribunal_Code, typeAnnonce, Annonce_Html AS annonce', "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$annee".sprintf('%04d', $numParution)." AND Num_Annonce=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
case 'BALO':
|
||||
$res = $iDb->select('balo',
|
||||
$res = $iDb->select('jo.balo',
|
||||
"YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Affaire AS Num_Annonce, '' AS Num_Page, Date_Parution, '' AS Departement, '' AS Tribunal_Code, 'Insertion' AS typeAnnonce, Annonce_Html AS annonce", "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$numParution AND Num_Affaire=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
@ -3676,8 +3676,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ( count($tabAnnees)>0 )
|
||||
{
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3811,7 +3811,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->authenticate();
|
||||
|
||||
//Initialisation
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
$tabRet = array();
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",
|
||||
__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
@ -3820,8 +3820,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=$iDb->select('sdv1.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('sdv1.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque){
|
||||
$dateSource=$tabBanque['dateSource'];
|
||||
@ -3912,14 +3912,11 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ($type=='pre'){
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp2 = $iDb->select('villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$iDb = new WDB();
|
||||
$tabTmp2 = $iDb->select('jo.villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$arrond = $tabTmp2[0]['AR'];
|
||||
unset($iDb);
|
||||
$iDb = new WDB('insee');
|
||||
$tabTmp2 = $iDb->select('insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
$tabTmp2 = $iDb->select('insee.insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
$nomSousPref = trim(strtr($tabTmp2[0]['ARTMAJ'],array('('=>'',')'=>'',' '=>'', "'"=>'')).' '.$tabTmp2[0]['NCC']);
|
||||
unset($iDb);
|
||||
$tabTmp = $iBodacc->getTribunauxParDep($dep);
|
||||
foreach ($tabTmp as $i=>$tribunal)
|
||||
{
|
||||
@ -4208,7 +4205,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
$db = new WDB('jo');
|
||||
$db = new WDB();
|
||||
if (!$db) {
|
||||
$error->statusCode = 9000;
|
||||
$error->statusMsg = $this->listError['9000'];
|
||||
|
@ -2848,8 +2848,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$tabAnnees = array_unique($tabAnnees);
|
||||
|
||||
if ( count($tabAnnees)>0 ) {
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3293,7 +3293,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
|
||||
@ -3559,7 +3559,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants',
|
||||
$iDb->insert('jo.siren_inexistants',
|
||||
array( 'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
@ -3863,7 +3863,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($delete) {
|
||||
|
||||
$tabUpdate = array('dateSuppr'=>date('Y-m-d'));
|
||||
$result = $iDb->update('surveillances_site',
|
||||
$result = $iDb->update('jo.surveillances_site',
|
||||
$tabUpdate,
|
||||
"source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'"
|
||||
);
|
||||
@ -3883,7 +3883,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
$where = "source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'";
|
||||
$detect = $iDb->select('surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
$detect = $iDb->select('jo.surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
|
||||
if ( count($detect)>0 ) {
|
||||
|
||||
@ -3893,7 +3893,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$data = array (
|
||||
'encoursClient' => $encoursClient,
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where, false, 0, true);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where, false, 0, true);
|
||||
|
||||
} elseif ( $detect[0]['dateSuppr']!='0000-00-00 00:00:00') {
|
||||
|
||||
@ -3901,7 +3901,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout' => date('Y-m-d'),
|
||||
'dateSuppr' => '0000-00-00 00:00:00',
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where, false, 0, true);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where, false, 0, true);
|
||||
|
||||
}
|
||||
|
||||
@ -3924,7 +3924,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$result = $iDb->insert('surveillances_site', $data, false, true);
|
||||
$result = $iDb->insert('jo.surveillances_site', $data, false, true);
|
||||
}
|
||||
}
|
||||
$output = new SetSurveillanceReturn();
|
||||
@ -4003,7 +4003,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'count(*) as nb', "login='$login' AND dateSuppr=0 $strSiren $strSource",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4011,7 +4011,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Récupération des résultats
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 $strSiren $strSource $orderBy LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4020,7 +4020,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4029,7 +4029,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
// Récupération des résultats
|
||||
if ($nbRepTot>0){
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren ORDER BY siren LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4038,7 +4038,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$listeSiren[] = $v['siren'];
|
||||
}
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 AND siren IN (".join(',',$listeSiren).") $strSiren ORDER BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4067,7 +4067,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$rs = $tabIdentite['Nom'];
|
||||
$cp = $tabIdentite['CP'];
|
||||
$ville = $tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site', array(
|
||||
$iDb->update('jo.surveillances_site', array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -4144,21 +4144,21 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$where = "u.idClient='$idClient' AND u.actif=1 AND s.dateSuppr=0 AND ( s.siren='$search' OR s.ref='$search' OR s.rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$where = "login='$login' AND dateSuppr=0 AND ( siren='$search' OR ref='$search' OR rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
}
|
||||
@ -4471,7 +4471,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if (strlen($dateAnnee)==4) $annee = $dateAnnee;
|
||||
else $annee = substr($dateAnnee,0,4);
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
switch (strtoupper($source))
|
||||
{
|
||||
@ -4489,18 +4489,18 @@ class Entreprise extends Scores_Ws_Server
|
||||
"$annee AS Annee_Parution, e.NOBOD AS Num_Parution, e.NOANN AS Num_Annonce, e.NOPAGE AS Num_Page, e.`DATE` AS Date_Parution, e.DEPT AS Departement, e.CODTRI AS Tribunal_Code, 'I' AS typeAnnonce, CONCAT(e.NOANN,' - ',t.annonceTxt) AS annonce",
|
||||
"e.JAL=$numJAL AND e.NOBOD=$numParution AND e.`DATE` BETWEEN $anneeDeb AND $anneeFin AND e.NOANN=$numAnnonce AND e.ANBASE=t.annonceNum", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$res = $iDb->select('bodacc',
|
||||
$res = $iDb->select('jo.bodacc',
|
||||
'Bodacc_Annee_Parution AS Annee_Parution, Bodacc_Num AS Num_Parution, Num_Annonce, Bodacc_Page AS Num_Page, Bodacc_Date_Parution AS Date_Parution, Tribunal_Dept AS Departement, Tribunal_Code, typeAnnonce, annonce',
|
||||
"Bodacc_Code='$lettre' AND Bodacc_Annee_Parution=$annee AND Bodacc_Num=$numParution AND Num_Annonce=$numAnnonce", false, MYSQL_ASSOC);
|
||||
}
|
||||
break;
|
||||
case 'ASSO':
|
||||
$res = $iDb->select('asso',
|
||||
$res = $iDb->select('jo.asso',
|
||||
'YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Annonce, pageDeb AS Num_Page, Date_Parution, Departement, codTribunal AS Tribunal_Code, typeAnnonce, Annonce_Html AS annonce', "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$annee".sprintf('%04d', $numParution)." AND Num_Annonce=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
case 'BALO':
|
||||
$res = $iDb->select('balo',
|
||||
$res = $iDb->select('jo.balo',
|
||||
"YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Affaire AS Num_Annonce, '' AS Num_Page, Date_Parution, '' AS Departement, '' AS Tribunal_Code, 'Insertion' AS typeAnnonce, Annonce_Html AS annonce", "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$numParution AND Num_Affaire=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
@ -4712,8 +4712,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$tabAnnees = array_unique($tabAnnees);
|
||||
|
||||
if ( count($tabAnnees)>0 ) {
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -4845,7 +4845,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->permission('banque');
|
||||
|
||||
//Initialisation
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
$tabRet = array();
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
@ -4853,8 +4853,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", true, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", true, MYSQL_ASSOC);
|
||||
$res=$iDb->select('sdv1.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", true, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('sdv1.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", true, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque)
|
||||
{
|
||||
@ -4943,8 +4943,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ($type=='pre') {
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp2 = $iDb->select('villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$iDb = new WDB();
|
||||
$tabTmp2 = $iDb->select('jo.villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$arrond = $tabTmp2[0]['AR'];
|
||||
|
||||
$tabTmp2 = $iDb->select('insee.insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
@ -5377,7 +5377,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
$db = new WDB('jo');
|
||||
$db = new WDB();
|
||||
if (!$db) {
|
||||
$error->statusCode = 9000;
|
||||
$error->statusMsg = $this->listError['9000'];
|
||||
|
@ -2848,8 +2848,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$tabAnnees = array_unique($tabAnnees);
|
||||
|
||||
if ( count($tabAnnees)>0 ) {
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3293,7 +3293,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
|
||||
@ -3559,7 +3559,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
} else {
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('siren_inexistants',
|
||||
$iDb->insert('jo.siren_inexistants',
|
||||
array( 'siren'=>$siren,
|
||||
'nic'=>$nic,
|
||||
'dep'=>$dep,
|
||||
@ -3863,7 +3863,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if ($delete) {
|
||||
|
||||
$tabUpdate = array('dateSuppr'=>date('Y-m-d'));
|
||||
$result = $iDb->update('surveillances_site',
|
||||
$result = $iDb->update('jo.surveillances_site',
|
||||
$tabUpdate,
|
||||
"source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'"
|
||||
);
|
||||
@ -3883,7 +3883,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
$where = "source='$source' AND login='$login' AND email='$email' AND siren=$siren AND nic=$nic AND ref='$ref'";
|
||||
$detect = $iDb->select('surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
$detect = $iDb->select('jo.surveillances_site', 'siren', $where, false, MYSQL_ASSOC);
|
||||
|
||||
if ( count($detect)>0 ) {
|
||||
|
||||
@ -3893,7 +3893,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$data = array (
|
||||
'encoursClient' => $encoursClient,
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where, false, 0, true);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where, false, 0, true);
|
||||
|
||||
} elseif ( $detect[0]['dateSuppr']!='0000-00-00 00:00:00') {
|
||||
|
||||
@ -3901,7 +3901,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout' => date('Y-m-d'),
|
||||
'dateSuppr' => '0000-00-00 00:00:00',
|
||||
);
|
||||
$result = $iDb->update('surveillances_site', $data, $where, false, 0, true);
|
||||
$result = $iDb->update('jo.surveillances_site', $data, $where, false, 0, true);
|
||||
|
||||
}
|
||||
|
||||
@ -3924,7 +3924,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$result = $iDb->insert('surveillances_site', $data, false, true);
|
||||
$result = $iDb->insert('jo.surveillances_site', $data, false, true);
|
||||
}
|
||||
}
|
||||
$output = new SetSurveillanceReturn();
|
||||
@ -4003,7 +4003,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'count(*) as nb', "login='$login' AND dateSuppr=0 $strSiren $strSource",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4011,7 +4011,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Récupération des résultats
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 $strSiren $strSource $orderBy LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4020,7 +4020,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4029,7 +4029,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
// Récupération des résultats
|
||||
if ($nbRepTot>0){
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site',
|
||||
'jo.surveillances_site',
|
||||
'siren', "login='$login' AND dateSuppr=0 $strSiren GROUP BY siren ORDER BY siren LIMIT $position,$nbRep",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4038,7 +4038,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$listeSiren[] = $v['siren'];
|
||||
}
|
||||
$tabTmp = $iDb->select(
|
||||
'surveillances_site', $strSelect,
|
||||
'jo.surveillances_site', $strSelect,
|
||||
"login='$login' AND dateSuppr=0 AND siren IN (".join(',',$listeSiren).") $strSiren ORDER BY siren",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -4067,7 +4067,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$rs = $tabIdentite['Nom'];
|
||||
$cp = $tabIdentite['CP'];
|
||||
$ville = $tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site', array(
|
||||
$iDb->update('jo.surveillances_site', array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -4144,21 +4144,21 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$where = "u.idClient='$idClient' AND u.actif=1 AND s.dateSuppr=0 AND ( s.siren='$search' OR s.ref='$search' OR s.rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site s, utilisateurs u',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, sdv1.utilisateurs u',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$where = "login='$login' AND dateSuppr=0 AND ( siren='$search' OR ref='$search' OR rs='$search' )";
|
||||
// Il faut compter le nombre au total
|
||||
$tabTmp = $iDb->select('surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site', 'count(*) as nb', $where.$orderBy, false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
// Execution de la requete
|
||||
$tabTmp = $iDb->select('surveillances_site',
|
||||
$tabTmp = $iDb->select('jo.surveillances_site',
|
||||
"siren, nic, ref, source, login, email, DATE_FORMAT(dateAjout, '%Y-%m-%d') as dateAjout, DATE_FORMAT(dateDerEnvoi, '%Y-%m-%d') as dateEnvoi",
|
||||
$where.$orderBy." LIMIT $position,$nbRep", false, MYSQL_ASSOC);
|
||||
}
|
||||
@ -4471,7 +4471,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
if (strlen($dateAnnee)==4) $annee = $dateAnnee;
|
||||
else $annee = substr($dateAnnee,0,4);
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
switch (strtoupper($source))
|
||||
{
|
||||
@ -4489,18 +4489,18 @@ class Entreprise extends Scores_Ws_Server
|
||||
"$annee AS Annee_Parution, e.NOBOD AS Num_Parution, e.NOANN AS Num_Annonce, e.NOPAGE AS Num_Page, e.`DATE` AS Date_Parution, e.DEPT AS Departement, e.CODTRI AS Tribunal_Code, 'I' AS typeAnnonce, CONCAT(e.NOANN,' - ',t.annonceTxt) AS annonce",
|
||||
"e.JAL=$numJAL AND e.NOBOD=$numParution AND e.`DATE` BETWEEN $anneeDeb AND $anneeFin AND e.NOANN=$numAnnonce AND e.ANBASE=t.annonceNum", false, MYSQL_ASSOC);
|
||||
} else {
|
||||
$res = $iDb->select('bodacc',
|
||||
$res = $iDb->select('jo.bodacc',
|
||||
'Bodacc_Annee_Parution AS Annee_Parution, Bodacc_Num AS Num_Parution, Num_Annonce, Bodacc_Page AS Num_Page, Bodacc_Date_Parution AS Date_Parution, Tribunal_Dept AS Departement, Tribunal_Code, typeAnnonce, annonce',
|
||||
"Bodacc_Code='$lettre' AND Bodacc_Annee_Parution=$annee AND Bodacc_Num=$numParution AND Num_Annonce=$numAnnonce", false, MYSQL_ASSOC);
|
||||
}
|
||||
break;
|
||||
case 'ASSO':
|
||||
$res = $iDb->select('asso',
|
||||
$res = $iDb->select('jo.asso',
|
||||
'YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Annonce, pageDeb AS Num_Page, Date_Parution, Departement, codTribunal AS Tribunal_Code, typeAnnonce, Annonce_Html AS annonce', "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$annee".sprintf('%04d', $numParution)." AND Num_Annonce=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
case 'BALO':
|
||||
$res = $iDb->select('balo',
|
||||
$res = $iDb->select('jo.balo',
|
||||
"YEAR(Date_Parution) AS Annee_Parution, Num_Parution, Num_Affaire AS Num_Annonce, '' AS Num_Page, Date_Parution, '' AS Departement, '' AS Tribunal_Code, 'Insertion' AS typeAnnonce, Annonce_Html AS annonce", "Date_Parution BETWEEN '$annee-01-01' AND '$annee-12-31' AND Num_Parution=$numParution AND Num_Affaire=$numAnnonce",
|
||||
false, MYSQL_ASSOC);
|
||||
break;
|
||||
@ -4712,8 +4712,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$tabAnnees = array_unique($tabAnnees);
|
||||
|
||||
if ( count($tabAnnees)>0 ) {
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$iDb = new WDB();
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, nombre',
|
||||
"1 $strNaf AND annee IN ($strAnnees) ORDER BY annee DESC, id ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -4845,7 +4845,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->permission('banque');
|
||||
|
||||
//Initialisation
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
$tabRet = array();
|
||||
debugLog('I',"Liste des banques demandée pour siren $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
@ -4853,8 +4853,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$res=$iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", true, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", true, MYSQL_ASSOC);
|
||||
$res=$iDb->select('sdv1.banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", true, MYSQL_ASSOC);
|
||||
$tmp=$iDb->select('sdv1.fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", true, MYSQL_ASSOC);
|
||||
$res=array_merge($res, $tmp);
|
||||
foreach ($res as $tabBanque)
|
||||
{
|
||||
@ -4943,8 +4943,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
if ($type=='pre') {
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tabTmp2 = $iDb->select('villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$iDb = new WDB();
|
||||
$tabTmp2 = $iDb->select('jo.villes', 'DEP, COM, AR, CT', 'codeInsee='.$codeInsee, false, MYSQL_ASSOC);
|
||||
$arrond = $tabTmp2[0]['AR'];
|
||||
|
||||
$tabTmp2 = $iDb->select('insee.insee_tabArrond', 'CHEFLIEU, ARTMAJ, NCC', "DEP='$dep' AND AR='$arrond'", false, MYSQL_ASSOC);
|
||||
@ -5377,7 +5377,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
|
||||
$error = new StatusReturn();
|
||||
//Test connexion à la base de données
|
||||
$db = new WDB('jo');
|
||||
$db = new WDB();
|
||||
if (!$db) {
|
||||
$error->statusCode = 9000;
|
||||
$error->statusMsg = $this->listError['9000'];
|
||||
|
@ -19,8 +19,8 @@ class Entreprise extends Scores_Ws_Server
|
||||
{
|
||||
/**
|
||||
* Retourne les informations identitaires de l'entreprise ou de l'établissement demandé
|
||||
* @param string $siret Siren de l'entreprise ou siret de l'établissement
|
||||
* @param int $id Identifiant interne
|
||||
* @param string $siret Siren de l'entreprise ou siret de l'établissement
|
||||
* @param int $id Identifiant interne
|
||||
* @return Identite
|
||||
*/
|
||||
public function getIdentite($siret, $id = 0)
|
||||
|
@ -933,7 +933,7 @@ class Gestion extends Scores_Ws_Server
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if (isset($tabInfos['droits'])){
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -943,7 +943,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$update = array();
|
||||
if ( count($droitsDiff)>0 ){
|
||||
foreach($droitsDiff as $droit){
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$iDbCrm->query($query, true);
|
||||
}
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ class Gestion extends Scores_Ws_Server
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if (isset($tabInfos['droits'])){
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -943,7 +943,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$update = array();
|
||||
if ( count($droitsDiff)>0 ){
|
||||
foreach($droitsDiff as $droit){
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$iDbCrm->query($query, true);
|
||||
}
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ class Gestion extends Scores_Ws_Server
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if (isset($tabInfos['droits'])){
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -977,7 +977,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$update = array();
|
||||
if ( count($droitsDiff)>0 ){
|
||||
foreach($droitsDiff as $droit){
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$iDbCrm->query($query, true);
|
||||
}
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ class Gestion extends Scores_Ws_Server
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if (isset($tabInfos['droits'])){
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -977,7 +977,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$update = array();
|
||||
if ( count($droitsDiff)>0 ){
|
||||
foreach($droitsDiff as $droit){
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, '$droit', '')) WHERE idClient='$idClient'";
|
||||
$iDbCrm->query($query, true);
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ class Gestion extends Scores_Ws_Server
|
||||
if ($this->User->login!=$login && in_array($this->User->profil, array('Administrateur', 'SuperAdministrateur')))
|
||||
{
|
||||
/** Un administrateur veut il des infos sur un login ? **/
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select(
|
||||
'utilisateurs u, clients c',
|
||||
'sdv1.utilisateurs u, sdv1.clients c',
|
||||
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.civilite, u.nom, u.prenom, u.tel, u.fax, u.mobile, u.profil, u.raisonSociale, u.siret, u.adrNum, u.adrIndRep, u.adrTypeVoie, u.adrLibVoie, u.adrCp, u.adrVille, u.adrComp, u.pref, u.profil, u.dateInscription, u.dateValidation, u.nombreConnexions, u.dateDerniereConnexion, u.droits, u.referenceParDefaut, u.nbReponses, u.lang, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.maxFicheId, c.droits AS droitsClients, c.test AS clientTest, c.timeout, c.typeScore AS typeScore',
|
||||
"u.login='$login' AND u.idClient=c.id AND u.deleted=0",
|
||||
false, MYSQL_ASSOC
|
||||
@ -108,7 +108,7 @@ class Gestion extends Scores_Ws_Server
|
||||
'params' => 'Erreur Login/Password',
|
||||
'ipClient' => $ipUtilisateur
|
||||
);
|
||||
$iDbCrm->insert('logs', $tabInsert);
|
||||
$iDbCrm->insert('sdv1.logs', $tabInsert);
|
||||
}
|
||||
}
|
||||
//Authentification de l'utilisateur
|
||||
@ -182,11 +182,11 @@ class Gestion extends Scores_Ws_Server
|
||||
'test' => $test,
|
||||
'ipClient' => $ipUtilisateur
|
||||
);
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm->insert('logs', $tabInsert);
|
||||
$iDbCrm = new WDB();
|
||||
$iDbCrm->insert('sdv1.logs', $tabInsert);
|
||||
|
||||
//Date de dernière connexion
|
||||
$iDbCrm->update('utilisateurs',
|
||||
$iDbCrm->update('sdv1.utilisateurs',
|
||||
array('dateDerniereConnexion'=> date('Y-m-d H:i:s')),
|
||||
"idClient=".$this->User->idClient." AND login='".$this->User->login."'"
|
||||
);
|
||||
@ -262,8 +262,8 @@ class Gestion extends Scores_Ws_Server
|
||||
if ($this->User->profil=='Administrateur'
|
||||
|| $this->User->profil=='SuperAdministrateur') {
|
||||
$tabUpdate = array( 'deleted' => 1, 'dateUpdate' => date('Y-m-d H:i:s') );
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -278,8 +278,8 @@ class Gestion extends Scores_Ws_Server
|
||||
$actif = 0;
|
||||
}
|
||||
$tabUpdate = array( 'actif' => $actif, 'dateUpdate' => date('YmdHis') );
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -292,8 +292,8 @@ class Gestion extends Scores_Ws_Server
|
||||
'password' => stripslashes($infos['password']),
|
||||
'dateUpdate' => date('Y-m-d H:i:s')
|
||||
);
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$result = true;
|
||||
}
|
||||
|
||||
@ -304,8 +304,8 @@ class Gestion extends Scores_Ws_Server
|
||||
if ( $this->User->profil=='Administrateur'
|
||||
|| $this->User->profil=='SuperAdministrateur') {
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$existLogin = $iDbCrm->select('utilisateurs', 'deleted', 'login="'.$login.'"', false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$existLogin = $iDbCrm->select('sdv1.utilisateurs', 'deleted', 'login="'.$login.'"', false, MYSQL_ASSOC);
|
||||
if (count($existLogin)>0) {
|
||||
$message = "Utilisateur existant dans le référentiel";
|
||||
if ($existLogin[0]['deleted']==1) {
|
||||
@ -388,8 +388,8 @@ class Gestion extends Scores_Ws_Server
|
||||
$tabUpdate['dateInsert'] = date('YmdHis');
|
||||
//dateUpdate => MySql automatic update
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->insert('utilisateurs', $tabUpdate)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->insert('sdv1.utilisateurs', $tabUpdate)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -470,8 +470,8 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
$tabUpdate['dateUpdate'] = date('YmdHis');
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$result = true;
|
||||
}
|
||||
|
||||
@ -498,11 +498,11 @@ class Gestion extends Scores_Ws_Server
|
||||
|| $this->User->profil=='SuperAdministrateur')
|
||||
{
|
||||
/** Un administrateur veut créer un nouveau login **/
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients c', 'c.racineLogin, c.droits', "c.id='$idClient'");
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients c', 'c.racineLogin, c.droits', "c.id='$idClient'");
|
||||
$racine = $rep[0]['racineLogin'];
|
||||
$droitsClients = $rep[0]['droits'];
|
||||
$rep = $iDbCrm->select('utilisateurs', 'login', "idClient='$idClient'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'login', "idClient='$idClient'");
|
||||
if (count($rep)==0) {
|
||||
$racine.='1';
|
||||
} else {
|
||||
@ -510,7 +510,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$cpt = 1;
|
||||
while (true) {
|
||||
$racine.= $last_i+$cpt;
|
||||
$rep = $iDbCrm->select('utilisateurs', 'login', "idClient='$idClient' AND login='$racine'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'login', "idClient='$idClient' AND login='$racine'");
|
||||
if (count($rep)==0) break;
|
||||
$cpt++;
|
||||
}
|
||||
@ -566,8 +566,8 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
if (is_numeric($idClient)) $strClient.=" AND id='$idClient' ";
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients',
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients',
|
||||
'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, timeout, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore',
|
||||
"1 $strClient",
|
||||
false,
|
||||
@ -723,9 +723,9 @@ class Gestion extends Scores_Ws_Server
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Profil non administrateur';
|
||||
} else {
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if (!isset($idClient)){
|
||||
$rep = $iDbCrm->select('utilisateurs', 'idClient', "login='$login'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'idClient', "login='$login'");
|
||||
$idClient = $rep[0][0];
|
||||
}
|
||||
if ($idClient==-1) {
|
||||
@ -733,7 +733,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$error->errmsg = 'idClient=0';
|
||||
} else {
|
||||
$rep = $iDbCrm->select(
|
||||
'utilisateurs',
|
||||
'sdv1.utilisateurs',
|
||||
'id, idClient, login, email, actif, nom, prenom, referenceParDefaut',
|
||||
"idClient='$idClient' AND deleted=0 ORDER BY login ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -1069,15 +1069,15 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
}
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if (empty($idClient)){
|
||||
//Ajout
|
||||
$tabInfos['dateInsert'] = date('Y-m-d H:i:s');
|
||||
$result = $iDbCrm->insert('clients', $tabInfos, true);
|
||||
$result = $iDbCrm->insert('sdv1.clients', $tabInfos, true);
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if ( isset($tabInfos['droits']) ) {
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -1091,7 +1091,7 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
//Modification
|
||||
$tabInfos['dateUpdate'] = date('Y-m-d H:i:s');
|
||||
if ($iDbCrm->update('clients', $tabInfos, "id='$idClient'", true)){
|
||||
if ($iDbCrm->update('sdv1.clients', $tabInfos, "id='$idClient'", true)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -2056,7 +2056,7 @@ class Gestion extends Scores_Ws_Server
|
||||
*/
|
||||
protected function _deleteAccess($toDelete, $idClient, $service=null)
|
||||
{
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
$strLogin = '';
|
||||
|
||||
//Modification sur les droits des services
|
||||
@ -2078,7 +2078,7 @@ class Gestion extends Scores_Ws_Server
|
||||
//Modification sur les droits utilisateurs
|
||||
if ( count(toDelete)>0 ) {
|
||||
foreach ($toDelete as $droit) {
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, ' $droit ', ' ')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, ' $droit ', ' ')) WHERE idClient='$idClient'";
|
||||
$query.= $strLogin;
|
||||
$iDbCrm->query($query);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class Gestion extends Scores_Ws_Server
|
||||
/** Un administrateur veut il des infos sur un login ? **/
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select(
|
||||
'utilisateurs u, clients c',
|
||||
'sdv1.utilisateurs u, sdv1.clients c',
|
||||
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.civilite, u.nom, u.prenom, u.tel, u.fax, u.mobile, u.profil, u.raisonSociale, u.siret, u.adrNum, u.adrIndRep, u.adrTypeVoie, u.adrLibVoie, u.adrCp, u.adrVille, u.adrComp, u.pref, u.profil, u.dateInscription, u.dateValidation, u.nombreConnexions, u.dateDerniereConnexion, u.droits, u.referenceParDefaut, u.nbReponses, u.lang, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.maxFicheId, c.droits AS droitsClients, c.test AS clientTest, c.timeout, c.typeScore AS typeScore',
|
||||
"u.login='$login' AND u.idClient=c.id AND u.deleted=0",
|
||||
false, MYSQL_ASSOC
|
||||
@ -108,7 +108,7 @@ class Gestion extends Scores_Ws_Server
|
||||
'params' => 'Erreur Login/Password',
|
||||
'ipClient' => $ipUtilisateur
|
||||
);
|
||||
$iDbCrm->insert('logs', $tabInsert);
|
||||
$iDbCrm->insert('sdv1.logs', $tabInsert);
|
||||
}
|
||||
}
|
||||
//Authentification de l'utilisateur
|
||||
@ -182,11 +182,11 @@ class Gestion extends Scores_Ws_Server
|
||||
'test' => $test,
|
||||
'ipClient' => $ipUtilisateur
|
||||
);
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm->insert('logs', $tabInsert);
|
||||
$iDbCrm = new WDB();
|
||||
$iDbCrm->insert('sdv1.logs', $tabInsert);
|
||||
|
||||
//Date de dernière connexion
|
||||
$iDbCrm->update('utilisateurs',
|
||||
$iDbCrm->update('sdv1.utilisateurs',
|
||||
array('dateDerniereConnexion'=> date('Y-m-d H:i:s')),
|
||||
"idClient=".$this->User->idClient." AND login='".$this->User->login."'"
|
||||
);
|
||||
@ -262,8 +262,8 @@ class Gestion extends Scores_Ws_Server
|
||||
if ($this->User->profil=='Administrateur'
|
||||
|| $this->User->profil=='SuperAdministrateur') {
|
||||
$tabUpdate = array( 'deleted' => 1, 'dateUpdate' => date('Y-m-d H:i:s') );
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -278,8 +278,8 @@ class Gestion extends Scores_Ws_Server
|
||||
$actif = 0;
|
||||
}
|
||||
$tabUpdate = array( 'actif' => $actif, 'dateUpdate' => date('YmdHis') );
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'")){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -292,8 +292,8 @@ class Gestion extends Scores_Ws_Server
|
||||
'password' => stripslashes($infos['password']),
|
||||
'dateUpdate' => date('Y-m-d H:i:s')
|
||||
);
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$result = true;
|
||||
}
|
||||
|
||||
@ -304,8 +304,8 @@ class Gestion extends Scores_Ws_Server
|
||||
if ( $this->User->profil=='Administrateur'
|
||||
|| $this->User->profil=='SuperAdministrateur') {
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$existLogin = $iDbCrm->select('utilisateurs', 'deleted', 'login="'.$login.'"', false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$existLogin = $iDbCrm->select('sdv1.utilisateurs', 'deleted', 'login="'.$login.'"', false, MYSQL_ASSOC);
|
||||
if (count($existLogin)>0) {
|
||||
$message = "Utilisateur existant dans le référentiel";
|
||||
if ($existLogin[0]['deleted']==1) {
|
||||
@ -388,8 +388,8 @@ class Gestion extends Scores_Ws_Server
|
||||
$tabUpdate['dateInsert'] = date('YmdHis');
|
||||
//dateUpdate => MySql automatic update
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->insert('utilisateurs', $tabUpdate)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->insert('sdv1.utilisateurs', $tabUpdate)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -470,8 +470,8 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
$tabUpdate['dateUpdate'] = date('YmdHis');
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$iDbCrm = new WDB();
|
||||
if ($iDbCrm->update('sdv1.utilisateurs', $tabUpdate, "login='$login'", true)){
|
||||
$result = true;
|
||||
}
|
||||
|
||||
@ -498,11 +498,11 @@ class Gestion extends Scores_Ws_Server
|
||||
|| $this->User->profil=='SuperAdministrateur')
|
||||
{
|
||||
/** Un administrateur veut créer un nouveau login **/
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients c', 'c.racineLogin, c.droits', "c.id='$idClient'");
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients c', 'c.racineLogin, c.droits', "c.id='$idClient'");
|
||||
$racine = $rep[0]['racineLogin'];
|
||||
$droitsClients = $rep[0]['droits'];
|
||||
$rep = $iDbCrm->select('utilisateurs', 'login', "idClient='$idClient'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'login', "idClient='$idClient'");
|
||||
if (count($rep)==0) {
|
||||
$racine.='1';
|
||||
} else {
|
||||
@ -510,7 +510,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$cpt = 1;
|
||||
while (true) {
|
||||
$racine.= $last_i+$cpt;
|
||||
$rep = $iDbCrm->select('utilisateurs', 'login', "idClient='$idClient' AND login='$racine'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'login', "idClient='$idClient' AND login='$racine'");
|
||||
if (count($rep)==0) break;
|
||||
$cpt++;
|
||||
}
|
||||
@ -566,8 +566,8 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
if (is_numeric($idClient)) $strClient.=" AND id='$idClient' ";
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients',
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients',
|
||||
'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, timeout, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore',
|
||||
"1 $strClient",
|
||||
false,
|
||||
@ -723,9 +723,9 @@ class Gestion extends Scores_Ws_Server
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Profil non administrateur';
|
||||
} else {
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if (!isset($idClient)){
|
||||
$rep = $iDbCrm->select('utilisateurs', 'idClient', "login='$login'");
|
||||
$rep = $iDbCrm->select('sdv1.utilisateurs', 'idClient', "login='$login'");
|
||||
$idClient = $rep[0][0];
|
||||
}
|
||||
if ($idClient==-1) {
|
||||
@ -733,7 +733,7 @@ class Gestion extends Scores_Ws_Server
|
||||
$error->errmsg = 'idClient=0';
|
||||
} else {
|
||||
$rep = $iDbCrm->select(
|
||||
'utilisateurs',
|
||||
'sdv1.utilisateurs',
|
||||
'id, idClient, login, email, actif, nom, prenom, referenceParDefaut',
|
||||
"idClient='$idClient' AND deleted=0 ORDER BY login ASC",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -1069,15 +1069,15 @@ class Gestion extends Scores_Ws_Server
|
||||
|
||||
}
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if (empty($idClient)){
|
||||
//Ajout
|
||||
$tabInfos['dateInsert'] = date('Y-m-d H:i:s');
|
||||
$result = $iDbCrm->insert('clients', $tabInfos, true);
|
||||
$result = $iDbCrm->insert('sdv1.clients', $tabInfos, true);
|
||||
} else {
|
||||
//Droits client actuel avant modification
|
||||
if ( isset($tabInfos['droits']) ) {
|
||||
$rep = $iDbCrm->select('clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$rep = $iDbCrm->select('sdv1.clients', 'droits', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$droitsPre = explode(' ', $rep[0]['droits']);
|
||||
$droitsSui = explode(' ', $tabInfos['droits']);
|
||||
//Détection suppression d'un droit client
|
||||
@ -1091,7 +1091,7 @@ class Gestion extends Scores_Ws_Server
|
||||
}
|
||||
//Modification
|
||||
$tabInfos['dateUpdate'] = date('Y-m-d H:i:s');
|
||||
if ($iDbCrm->update('clients', $tabInfos, "id='$idClient'", true)){
|
||||
if ($iDbCrm->update('sdv1.clients', $tabInfos, "id='$idClient'", true)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
@ -2056,7 +2056,7 @@ class Gestion extends Scores_Ws_Server
|
||||
*/
|
||||
protected function _deleteAccess($toDelete, $idClient, $service=null)
|
||||
{
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
$strLogin = '';
|
||||
|
||||
//Modification sur les droits des services
|
||||
@ -2078,7 +2078,7 @@ class Gestion extends Scores_Ws_Server
|
||||
//Modification sur les droits utilisateurs
|
||||
if ( count(toDelete)>0 ) {
|
||||
foreach ($toDelete as $droit) {
|
||||
$query = "UPDATE utilisateurs set droits=TRIM(REPLACE(droits, ' $droit ', ' ')) WHERE idClient='$idClient'";
|
||||
$query = "UPDATE sdv1.utilisateurs set droits=TRIM(REPLACE(droits, ' $droit ', ' ')) WHERE idClient='$idClient'";
|
||||
$query.= $strLogin;
|
||||
$iDbCrm->query($query);
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ class Interne extends Scores_Ws_Server
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn) * 1;
|
||||
if ($idAnn>0)
|
||||
{
|
||||
$res = $iDb->select('annonces',
|
||||
$res = $iDb->select('jo.annonces',
|
||||
'id, siren, sirenValide, typeEven, strEven, raisonSociale, adresse, codePostal, ville, dateJugement, dateCessationPaiement, dateEffetFinP, numero, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, tribunal, montant, actionsNb, complement, infosBrutes, nouvActivite, nouvDir, nouvAdr, nouvFJ, annonce, source, parutionIdJal, parutionNum, dateSource, idSaisie, idAnnonce, dateInsert',
|
||||
"id=$idAnn", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -537,13 +537,13 @@ class Interne extends Scores_Ws_Server
|
||||
//Initialisation
|
||||
$error = new ErrorType();
|
||||
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
if ($devise) $strDevise=" AND c.devise='$devise' ";
|
||||
else $strDevise='';
|
||||
|
||||
$tabRet = array();
|
||||
|
||||
$res = $iDb->select('devise_cours c, devise_liste l', 'c.devise, l.devNom, max(c.date) as dateChange, c.valeur', "c.devise=l.devIso $strDevise GROUP BY c.devise ORDER BY c.devise ASC", false, MYSQL_ASSOC);
|
||||
$res = $iDb->select('sdv1.devise_cours c, sdv1.devise_liste l', 'c.devise, l.devNom, max(c.date) as dateChange, c.valeur', "c.devise=l.devIso $strDevise GROUP BY c.devise ORDER BY c.devise ASC", false, MYSQL_ASSOC);
|
||||
foreach ($res as $tabDev)
|
||||
{
|
||||
$devise = new DevisesCours();
|
||||
@ -728,8 +728,8 @@ class Interne extends Scores_Ws_Server
|
||||
'dateCommande' => DATETIME,
|
||||
);
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$iDbCrm = new WDB();
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
|
||||
if ( $ret!=0 ) {
|
||||
|
||||
@ -797,8 +797,8 @@ class Interne extends Scores_Ws_Server
|
||||
$messageInfo=print_r($infosCommande, 1).EOL.print_r($infosDemandeur,1).EOL;
|
||||
|
||||
$idClient = $this->User->idClient;
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$login = trim($rep[0]['InterSudLogin']);
|
||||
$pass = trim($rep[0]['InterSudPass']);
|
||||
$nomClient = trim(strtoupper($rep[0]['nom']));
|
||||
@ -877,7 +877,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Insertion de la commande en base
|
||||
**/
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
$comment = "Référence de la commande chez Scores et Décisions : i$ret - ".
|
||||
DATETIME."\n".
|
||||
"Date et heure de la commande : ".date('d/m/Y - H:i')."\n".
|
||||
@ -912,7 +912,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Ajout du RIB si communiqué **/
|
||||
if (@trim(implode(' ', $infosCommande->RIB))<>'')
|
||||
$iDbCrm->insert('banques', array(
|
||||
$iDbCrm->insert('sdv1.banques', array(
|
||||
'siren'=>$siren,
|
||||
'libBanqueGuichet'=>'',
|
||||
'precis'=>1,
|
||||
@ -986,7 +986,7 @@ class Interne extends Scores_Ws_Server
|
||||
$tfin=microtime(true);
|
||||
$duree+=$tfin-$tdeb;
|
||||
|
||||
$ret = $iDbCrm->update('commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
$ret = $iDbCrm->update('sdv1.commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
|
||||
$output = new CmdEnqueteReturn();
|
||||
$output->error = $error;
|
||||
@ -1014,14 +1014,14 @@ class Interne extends Scores_Ws_Server
|
||||
else {
|
||||
$strPayant='';
|
||||
}
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if ($type=='jour') {
|
||||
$rep = $iDbCrm->select('logs',
|
||||
$rep = $iDbCrm->select('sdv1.logs',
|
||||
'date(dateHeure) as jours, count(*) as nb',
|
||||
"1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY jours",
|
||||
false, MYSQL_ASSOC);
|
||||
} elseif ($type=='heure') {
|
||||
$rep = $iDbCrm->select('logs',
|
||||
$rep = $iDbCrm->select('sdv1.logs',
|
||||
'HOUR(dateHeure) as heures, count(*) as nb',
|
||||
"1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY heures",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -1087,10 +1087,10 @@ class Interne extends Scores_Ws_Server
|
||||
if (!empty($filtre->rs)) $strFiltre.= " AND s.rs LIKE '%$filtre->rs%'";
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select('surveillances_site s', 'count(*) as nb', "s.login='$login' AND s.source='score' AND s.dateSuppr=0 $strFiltre", false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s', 'count(*) as nb', "s.login='$login' AND s.source='score' AND s.dateSuppr=0 $strFiltre", false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
$tabTmp = $iDb->select('surveillances_site s, scores_surveillance c', $strSelect, "s.login='$login' AND s.source='score' AND s.dateSuppr=0 AND s.siren=c.siren $strFiltre $orderBy LIMIT $deb,$nbRet", false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, jo.scores_surveillance c', $strSelect, "s.login='$login' AND s.source='score' AND s.dateSuppr=0 AND s.siren=c.siren $strFiltre $orderBy LIMIT $deb,$nbRet", false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabSurv) {
|
||||
if (trim($tabSurv['rs'])<>'') {
|
||||
$rs=$tabSurv['rs'];
|
||||
@ -1102,7 +1102,7 @@ class Interne extends Scores_Ws_Server
|
||||
$rs=$tabIdentite['Nom'];
|
||||
$cp=$tabIdentite['CP'];
|
||||
$ville=$tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site',array(
|
||||
$iDb->update('jo.surveillances_site',array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -1710,7 +1710,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
if (!empty($pays)){
|
||||
$wdb = new WDB('jo');
|
||||
$result = $wdb->select('tabPays', 'codPays3', "libPays LIKE '".$pays);
|
||||
$result = $wdb->select('jo.tabPays', 'codPays3', "libPays LIKE '".$pays);
|
||||
if (count($result>0)){
|
||||
$pays = $result[0]['codPays3'];
|
||||
} else {
|
||||
@ -1866,8 +1866,8 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
$idClient = $this->User->idClient;
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$login = trim($rep[0]['InterSudLogin']);
|
||||
$pass = trim($rep[0]['InterSudPass']);
|
||||
$nomClient = trim(strtoupper($rep[0]['nom']));
|
||||
@ -1963,7 +1963,7 @@ class Interne extends Scores_Ws_Server
|
||||
@fclose($fp);
|
||||
|
||||
/** Insertion de la commande en base **/
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
$comment = "Référence de la commande chez Scores et Décisions : i$ret - ".DATETIME."
|
||||
Date et heure de la commande : ".date('d/m/Y - H:i')."
|
||||
Origine de la commande : $nomClient
|
||||
@ -1997,7 +1997,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Ajout du RIB si communiqué **/
|
||||
if (@trim(implode(' ', $infoEnq['Entrep']['Rib']))<>''){
|
||||
$iDbCrm->insert('banques', array(
|
||||
$iDbCrm->insert('sdv1.banques', array(
|
||||
'siren' => $siren,
|
||||
'libBanqueGuichet' => '',
|
||||
'precis' => 1,
|
||||
@ -2072,7 +2072,7 @@ class Interne extends Scores_Ws_Server
|
||||
$tfin = microtime(true);
|
||||
$duree+= $tfin-$tdeb;
|
||||
|
||||
$ret = $iDbCrm->update('commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
$ret = $iDbCrm->update('sdv1.commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
|
||||
return $output;
|
||||
}
|
||||
@ -2294,8 +2294,8 @@ class Interne extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tmp = $iDb->select('etablissements_act',
|
||||
$iDb = new WDB();
|
||||
$tmp = $iDb->select('jo.etablissements_act',
|
||||
'raisonSociale, enseigne, sigle, identite_pre, adr_num, adr_btq, adr_typeVoie, adr_libVoie, adr_comp, LPAD(adr_cp,5,0) AS adr_cp, adr_ville, adr_dep, adr_com, tel, fax, siren, sirenGrp',
|
||||
"siren=(SELECT distinct sirenGrp FROM etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabEnt = $tmp[0];
|
||||
@ -2307,7 +2307,7 @@ class Interne extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
/** Table des Nafs5 => Secteurs **/
|
||||
$tmp = $iDb->select('tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tmp = $iDb->select('jo.tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tabNAf2 = array();
|
||||
foreach ($tmp as $tmp2) {
|
||||
$tabNAf2[$tmp2['codNaf2']]=$tmp2['codNaf1'];
|
||||
|
@ -420,7 +420,7 @@ class Interne extends Scores_Ws_Server
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn) * 1;
|
||||
if ($idAnn>0)
|
||||
{
|
||||
$res = $iDb->select('annonces',
|
||||
$res = $iDb->select('jo.annonces',
|
||||
'id, siren, sirenValide, typeEven, strEven, raisonSociale, adresse, codePostal, ville, dateJugement, dateCessationPaiement, dateEffetFinP, numero, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, tribunal, montant, actionsNb, complement, infosBrutes, nouvActivite, nouvDir, nouvAdr, nouvFJ, annonce, source, parutionIdJal, parutionNum, dateSource, idSaisie, idAnnonce, dateInsert',
|
||||
"id=$idAnn", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -537,13 +537,13 @@ class Interne extends Scores_Ws_Server
|
||||
//Initialisation
|
||||
$error = new ErrorType();
|
||||
|
||||
$iDb = new WDB('sdv1');
|
||||
$iDb = new WDB();
|
||||
if ($devise) $strDevise=" AND c.devise='$devise' ";
|
||||
else $strDevise='';
|
||||
|
||||
$tabRet = array();
|
||||
|
||||
$res = $iDb->select('devise_cours c, devise_liste l', 'c.devise, l.devNom, max(c.date) as dateChange, c.valeur', "c.devise=l.devIso $strDevise GROUP BY c.devise ORDER BY c.devise ASC", false, MYSQL_ASSOC);
|
||||
$res = $iDb->select('sdv1.devise_cours c, sdv1.devise_liste l', 'c.devise, l.devNom, max(c.date) as dateChange, c.valeur', "c.devise=l.devIso $strDevise GROUP BY c.devise ORDER BY c.devise ASC", false, MYSQL_ASSOC);
|
||||
foreach ($res as $tabDev)
|
||||
{
|
||||
$devise = new DevisesCours();
|
||||
@ -728,8 +728,8 @@ class Interne extends Scores_Ws_Server
|
||||
'dateCommande' => DATETIME,
|
||||
);
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$iDbCrm = new WDB();
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
|
||||
if ( $ret!=0 ) {
|
||||
|
||||
@ -797,8 +797,8 @@ class Interne extends Scores_Ws_Server
|
||||
$messageInfo=print_r($infosCommande, 1).EOL.print_r($infosDemandeur,1).EOL;
|
||||
|
||||
$idClient = $this->User->idClient;
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$login = trim($rep[0]['InterSudLogin']);
|
||||
$pass = trim($rep[0]['InterSudPass']);
|
||||
$nomClient = trim(strtoupper($rep[0]['nom']));
|
||||
@ -877,7 +877,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Insertion de la commande en base
|
||||
**/
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
$comment = "Référence de la commande chez Scores et Décisions : i$ret - ".
|
||||
DATETIME."\n".
|
||||
"Date et heure de la commande : ".date('d/m/Y - H:i')."\n".
|
||||
@ -912,7 +912,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Ajout du RIB si communiqué **/
|
||||
if (@trim(implode(' ', $infosCommande->RIB))<>'')
|
||||
$iDbCrm->insert('banques', array(
|
||||
$iDbCrm->insert('sdv1.banques', array(
|
||||
'siren'=>$siren,
|
||||
'libBanqueGuichet'=>'',
|
||||
'precis'=>1,
|
||||
@ -986,7 +986,7 @@ class Interne extends Scores_Ws_Server
|
||||
$tfin=microtime(true);
|
||||
$duree+=$tfin-$tdeb;
|
||||
|
||||
$ret = $iDbCrm->update('commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
$ret = $iDbCrm->update('sdv1.commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
|
||||
$output = new CmdEnqueteReturn();
|
||||
$output->error = $error;
|
||||
@ -1014,14 +1014,14 @@ class Interne extends Scores_Ws_Server
|
||||
else {
|
||||
$strPayant='';
|
||||
}
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$iDbCrm = new WDB();
|
||||
if ($type=='jour') {
|
||||
$rep = $iDbCrm->select('logs',
|
||||
$rep = $iDbCrm->select('sdv1.logs',
|
||||
'date(dateHeure) as jours, count(*) as nb',
|
||||
"1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY jours",
|
||||
false, MYSQL_ASSOC);
|
||||
} elseif ($type=='heure') {
|
||||
$rep = $iDbCrm->select('logs',
|
||||
$rep = $iDbCrm->select('sdv1.logs',
|
||||
'HOUR(dateHeure) as heures, count(*) as nb',
|
||||
"1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY heures",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -1087,10 +1087,10 @@ class Interne extends Scores_Ws_Server
|
||||
if (!empty($filtre->rs)) $strFiltre.= " AND s.rs LIKE '%$filtre->rs%'";
|
||||
|
||||
// Il faut compter le nombre de siren au total
|
||||
$tabTmp = $iDb->select('surveillances_site s', 'count(*) as nb', "s.login='$login' AND s.source='score' AND s.dateSuppr=0 $strFiltre", false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s', 'count(*) as nb', "s.login='$login' AND s.source='score' AND s.dateSuppr=0 $strFiltre", false, MYSQL_ASSOC);
|
||||
$nbRepTot = $tabTmp[0]['nb'];
|
||||
|
||||
$tabTmp = $iDb->select('surveillances_site s, scores_surveillance c', $strSelect, "s.login='$login' AND s.source='score' AND s.dateSuppr=0 AND s.siren=c.siren $strFiltre $orderBy LIMIT $deb,$nbRet", false, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.surveillances_site s, jo.scores_surveillance c', $strSelect, "s.login='$login' AND s.source='score' AND s.dateSuppr=0 AND s.siren=c.siren $strFiltre $orderBy LIMIT $deb,$nbRet", false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabSurv) {
|
||||
if (trim($tabSurv['rs'])<>'') {
|
||||
$rs=$tabSurv['rs'];
|
||||
@ -1102,7 +1102,7 @@ class Interne extends Scores_Ws_Server
|
||||
$rs=$tabIdentite['Nom'];
|
||||
$cp=$tabIdentite['CP'];
|
||||
$ville=$tabIdentite['Ville'];
|
||||
$iDb->update('surveillances_site',array(
|
||||
$iDb->update('jo.surveillances_site',array(
|
||||
'rs' => $rs,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville),
|
||||
@ -1710,7 +1710,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
if (!empty($pays)){
|
||||
$wdb = new WDB('jo');
|
||||
$result = $wdb->select('tabPays', 'codPays3', "libPays LIKE '".$pays);
|
||||
$result = $wdb->select('jo.tabPays', 'codPays3', "libPays LIKE '".$pays);
|
||||
if (count($result>0)){
|
||||
$pays = $result[0]['codPays3'];
|
||||
} else {
|
||||
@ -1866,8 +1866,8 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
$idClient = $this->User->idClient;
|
||||
|
||||
$iDbCrm = new WDB('sdv1');
|
||||
$rep = $iDbCrm->select('clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$iDbCrm = new WDB();
|
||||
$rep = $iDbCrm->select('sdv1.clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
|
||||
$login = trim($rep[0]['InterSudLogin']);
|
||||
$pass = trim($rep[0]['InterSudPass']);
|
||||
$nomClient = trim(strtoupper($rep[0]['nom']));
|
||||
@ -1963,7 +1963,7 @@ class Interne extends Scores_Ws_Server
|
||||
@fclose($fp);
|
||||
|
||||
/** Insertion de la commande en base **/
|
||||
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
|
||||
$ret = $iDbCrm->insert('sdv1.commandes', $tabInsert, true);
|
||||
$comment = "Référence de la commande chez Scores et Décisions : i$ret - ".DATETIME."
|
||||
Date et heure de la commande : ".date('d/m/Y - H:i')."
|
||||
Origine de la commande : $nomClient
|
||||
@ -1997,7 +1997,7 @@ class Interne extends Scores_Ws_Server
|
||||
|
||||
/** Ajout du RIB si communiqué **/
|
||||
if (@trim(implode(' ', $infoEnq['Entrep']['Rib']))<>''){
|
||||
$iDbCrm->insert('banques', array(
|
||||
$iDbCrm->insert('sdv1.banques', array(
|
||||
'siren' => $siren,
|
||||
'libBanqueGuichet' => '',
|
||||
'precis' => 1,
|
||||
@ -2072,7 +2072,7 @@ class Interne extends Scores_Ws_Server
|
||||
$tfin = microtime(true);
|
||||
$duree+= $tfin-$tdeb;
|
||||
|
||||
$ret = $iDbCrm->update('commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
$ret = $iDbCrm->update('sdv1.commandes', array('dureeCommande'=>round($duree,3)), "idCommande=$ret");
|
||||
|
||||
return $output;
|
||||
}
|
||||
@ -2294,8 +2294,8 @@ class Interne extends Scores_Ws_Server
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$tmp = $iDb->select('etablissements_act',
|
||||
$iDb = new WDB();
|
||||
$tmp = $iDb->select('jo.etablissements_act',
|
||||
'raisonSociale, enseigne, sigle, identite_pre, adr_num, adr_btq, adr_typeVoie, adr_libVoie, adr_comp, LPAD(adr_cp,5,0) AS adr_cp, adr_ville, adr_dep, adr_com, tel, fax, siren, sirenGrp',
|
||||
"siren=(SELECT distinct sirenGrp FROM etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabEnt = $tmp[0];
|
||||
@ -2307,7 +2307,7 @@ class Interne extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
/** Table des Nafs5 => Secteurs **/
|
||||
$tmp = $iDb->select('tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tmp = $iDb->select('jo.tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tabNAf2 = array();
|
||||
foreach ($tmp as $tmp2) {
|
||||
$tabNAf2[$tmp2['codNaf2']]=$tmp2['codNaf1'];
|
||||
|
@ -137,8 +137,8 @@ class Saisie extends Scores_Ws_Server
|
||||
if ( $tabIdentite['moisOppositionInsee']>0 &&
|
||||
$tabIdentite['moisOppositionInsee']<=(date('Ym')*1) ){
|
||||
|
||||
$iDb2 = new WDB('insee');
|
||||
if ( !$iDb2->insert('insee_nondiff', array('siren'=>$siren, 'insEVE'=>795, 'mois'=>$tabIdentite['moisOppositionInsee'])) ){
|
||||
$iDb2 = new WDB();
|
||||
if ( !$iDb2->insert('insee.insee_nondiff', array('siren'=>$siren, 'insEVE'=>795, 'mois'=>$tabIdentite['moisOppositionInsee'])) ){
|
||||
if ( $iDb2->getLastErrorNum()<>1062 )
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des oppositions de la sphère commerciale INSEE pour $siren au mois de ".$tabIdentite['moisOppositionInsee']." : ".EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
}
|
||||
@ -153,7 +153,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$entrep = $iInsee->getIdentiteLight($siren);
|
||||
if ($nic<10) $nic=$entrep['Nic'];
|
||||
$cj1=substr($entrep['FJ'],0,1);
|
||||
$iDb2 = new WDB('insee');
|
||||
$iDb2 = new WDB();
|
||||
/** Insertion dans la tables des exclusions **/
|
||||
$tabInsert = array(
|
||||
'siren' => $siren,
|
||||
@ -163,7 +163,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'insEVE' => 'RCS',
|
||||
'mois' => $tabIdentite['moisRefusRCS'],
|
||||
);
|
||||
if (!$iDb2->insert('insee_nondiff', $tabInsert))
|
||||
if (!$iDb2->insert('insee.insee_nondiff', $tabInsert))
|
||||
if ($iDb2->getLastErrorNum()<>1062)
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des refus d'enregistrement A au RCS pour $siren au mois de ".$tabIdentite['moisRefusRCS']." : ".EOL.print_r($tabInsert, true).EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
|
||||
@ -176,7 +176,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'insDATEVE' => $tabIdentite['moisRefusRCS'].'28',
|
||||
'insDATEMAJ' => date('YmdHis'),
|
||||
'idFlux' => date('Ymd'));
|
||||
if (!$iDb2->insert('insee_even', $tabInsert))
|
||||
if (!$iDb2->insert('insee.insee_even', $tabInsert))
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des refus d'enregistrement B au RCS pour $siren au mois de ".$tabIdentite['moisOppositionInsee']." : ".EOL.print_r($tabInsert, true).EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
}
|
||||
// Fin refus d'inscription au RCS
|
||||
@ -192,8 +192,7 @@ class Saisie extends Scores_Ws_Server
|
||||
// Si demande de suppression, on force l'indicateur ""
|
||||
if ($tabIdentite['domiciliataire']=='non') {
|
||||
$tabUpdate=array('pasEntrepDom'=>1);
|
||||
if (!$iDb->update('tabAdrDom', $tabUpdate, "siren=$siren"))
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de la suppression du marqueur de domiciliation pour $siren :".EOL.print_r($tabUpdate, true).EOL.$iDb->getLastError());
|
||||
$iDb->update('jo.tabAdrDom', $tabUpdate, "siren=$siren");
|
||||
}
|
||||
}
|
||||
// Fin domiciliataire
|
||||
@ -219,8 +218,8 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
if ( $setScore ){
|
||||
// Mise à jour des Cute Offs
|
||||
if ( !$iDb->update('scores_cutoff', $tabUpdate, "siren=$siren") ){
|
||||
if ( !$iDb->insert('scores_cutoff', array_merge(array(
|
||||
if ( !$iDb->update('jo.scores_cutoff', $tabUpdate, "siren=$siren") ){
|
||||
if ( !$iDb->insert('jo.scores_cutoff', array_merge(array(
|
||||
'siren' => $siren,
|
||||
'dateInsert' => date('Ymd') ), $tabUpdate)) ){
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", print_r($tabScores, true).EOL.$iDb->getLastError());
|
||||
@ -328,8 +327,8 @@ class Saisie extends Scores_Ws_Server
|
||||
'typeEven' => $tabEven[0],
|
||||
'dateSource' => $dateSource,
|
||||
));
|
||||
if ( !$iDb->insert('annonces', array_merge($tabInsert,array('dateInsert'=>date('YmdHis'))), true) ){
|
||||
if ( !$iDb->update('annonces', $tabUpdate, "siren=$siren AND dateJugement='$dateJuge' AND typeEven=".$tabEven[0], true)){
|
||||
if ( !$iDb->insert('jo.annonces', array_merge($tabInsert,array('dateInsert'=>date('YmdHis'))), true) ){
|
||||
if ( !$iDb->update('jo.annonces', $tabUpdate, "siren=$siren AND dateJugement='$dateJuge' AND typeEven=".$tabEven[0], true)){
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Mise a jour impossible';
|
||||
$output = new SetInfosEntrepReturn();
|
||||
@ -388,13 +387,13 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res = $iDb->select('liens', 'count(*)',
|
||||
$res = $iDb->select('jo.liens', 'count(*)',
|
||||
"Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
$errMaj=1016166;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=1016167;
|
||||
}
|
||||
|
||||
@ -407,12 +406,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
$errMaj=1016168;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=1016169;
|
||||
}
|
||||
}
|
||||
@ -461,12 +460,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
$errMaj=10168;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=10169;
|
||||
}
|
||||
|
||||
@ -479,12 +478,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
$errMaj=10170;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=10171;
|
||||
}
|
||||
}
|
||||
@ -597,7 +596,7 @@ class Saisie extends Scores_Ws_Server
|
||||
|
||||
if ($idAnn>0)
|
||||
{
|
||||
if ($iDb->update('annonces',array(
|
||||
if ($iDb->update('jo.annonces',array(
|
||||
'dateSuppr'=>date('YmdHis'),
|
||||
'idSuppr'=>$this->User->id),
|
||||
"id=$idAnn", false))
|
||||
@ -717,7 +716,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$iDb = new WDB();
|
||||
$idAnn = intval(preg_replace('/^0\./','', ''.$idAnn));
|
||||
if ($idAnn>0 && $siren>1000){
|
||||
$res = $iDb->select('annonces', '*', "id=$idAnn", false, MYSQL_ASSOC);
|
||||
$res = $iDb->select('jo.annonces', '*', "id=$idAnn", false, MYSQL_ASSOC);
|
||||
if (count($res)==0) {
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Annonce inexistante';
|
||||
@ -728,7 +727,7 @@ class Saisie extends Scores_Ws_Server
|
||||
unset($annonce['nic']);//=$nic;
|
||||
$annonce['siren'] = $siren;
|
||||
$annonce['nic'] = $nic;
|
||||
if ($iDb->insert('annonces', $annonce, false)) {
|
||||
if ($iDb->insert('jo.annonces', $annonce, false)) {
|
||||
debugLog('I',"Duplication de l'annonce collectée n°$idAnn sur $siret",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$result = 1;
|
||||
} else {
|
||||
@ -770,7 +769,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn) * 1;
|
||||
if ($idAnn>0)
|
||||
{
|
||||
$res = $iDb->select('annonces',
|
||||
$res = $iDb->select('jo.annonces',
|
||||
'id, LPAD(siren,9,0) AS siren, sirenValide, typeEven, strEven, raisonSociale, adresse, codePostal, ville, dateJugement, dateCessationPaiement, dateEffetFinP, numero, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, tribunal, montant, actionsNb, complement, infosBrutes, nouvActivite, nouvDir, nouvAdr, nouvFJ, annonce, source, parutionIdJal, parutionNum, dateSource, idSaisie, idAnnonce, dateInsert',
|
||||
"id=$idAnn", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -944,7 +943,7 @@ class Saisie extends Scores_Ws_Server
|
||||
{
|
||||
case 0:
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn)*1;
|
||||
$table = 'annonces';
|
||||
$table = 'jo.annonces';
|
||||
break;
|
||||
case 1:
|
||||
if (intval($idAnn)<0){
|
||||
@ -952,7 +951,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$error->errmsg = 'Code annonce Incorrect';
|
||||
} else {
|
||||
$strSql = "AND siren=$siren";
|
||||
$table = 'bodacc_detail';
|
||||
$table = 'jo.bodacc_detail';
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@ -1024,7 +1023,7 @@ class Saisie extends Scores_Ws_Server
|
||||
//
|
||||
case 0:
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn)*1;
|
||||
$table = 'annonces';
|
||||
$table = 'jo.annonces';
|
||||
break;
|
||||
|
||||
//Bodacc
|
||||
@ -1035,13 +1034,13 @@ class Saisie extends Scores_Ws_Server
|
||||
$error->errmsg = 'Code annonce Incorrect';
|
||||
} else {
|
||||
if (intval($sirenIn)>0) $strSql.="AND siren=$sirenIn";
|
||||
$table = 'bodacc_detail';
|
||||
$table = 'jo.bodacc_detail';
|
||||
}
|
||||
break;
|
||||
|
||||
//Association
|
||||
case 3:
|
||||
$table = 'asso';
|
||||
$table = 'jo.asso';
|
||||
break;
|
||||
//
|
||||
case 2:
|
||||
@ -1064,7 +1063,7 @@ class Saisie extends Scores_Ws_Server
|
||||
} else {
|
||||
|
||||
/* Si table = asso => UPDATE de la ligne */
|
||||
if ($table == 'asso'){
|
||||
if ($table == 'jo.asso'){
|
||||
//$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1087,7 +1086,7 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
/* Si sirenIn = 0 et table = bodacc_detail => INSERT + UPDATE */
|
||||
elseif (intval($sirenIn) == 0 && $table == 'bodacc_detail' ) {
|
||||
elseif (intval($sirenIn) == 0 && $table == 'jo.bodacc_detail' ) {
|
||||
$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1110,7 +1109,7 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
/* si sirenIn != 0 et table = bodacc_detail => insert */
|
||||
elseif (intval($sirenIn) != 0 && $table == 'bodacc_detail') {
|
||||
elseif (intval($sirenIn) != 0 && $table == 'jo.bodacc_detail') {
|
||||
$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1129,7 +1128,7 @@ class Saisie extends Scores_Ws_Server
|
||||
|
||||
}
|
||||
/* Si table = annonces => INSERT */
|
||||
elseif ($table == 'annonces'){
|
||||
elseif ($table == 'jo.annonces'){
|
||||
$annonce = $res[0];
|
||||
// Suppression des zones inexistantes dans la table ou devant être vides
|
||||
unset($annonce['id']);
|
||||
@ -1167,7 +1166,7 @@ class Saisie extends Scores_Ws_Server
|
||||
public function setAnnonceEven($siren, $id, $codeEven)
|
||||
{
|
||||
$this->authenticate();
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
$list = array();
|
||||
if (is_object($codeEven)){
|
||||
@ -1187,7 +1186,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'Rubrique' => $row->Rubrique,
|
||||
'idSirenage' => $this->User->id,
|
||||
);
|
||||
if ($iDb->update('bodacc_detail', $tabUpdate, "siren='$siren' AND id='$id'")){
|
||||
if ($iDb->update('jo.bodacc_detail', $tabUpdate, "siren='$siren' AND id='$id'")){
|
||||
debugLog('I',"setAnnonceEven (siren=$siren, list=$list)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return true;
|
||||
}
|
||||
@ -2482,7 +2481,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('surveillances_site', $data);
|
||||
}
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ class Saisie extends Scores_Ws_Server
|
||||
if ( $tabIdentite['moisOppositionInsee']>0 &&
|
||||
$tabIdentite['moisOppositionInsee']<=(date('Ym')*1) ){
|
||||
|
||||
$iDb2 = new WDB('insee');
|
||||
if ( !$iDb2->insert('insee_nondiff', array('siren'=>$siren, 'insEVE'=>795, 'mois'=>$tabIdentite['moisOppositionInsee'])) ){
|
||||
$iDb2 = new WDB();
|
||||
if ( !$iDb2->insert('insee.insee_nondiff', array('siren'=>$siren, 'insEVE'=>795, 'mois'=>$tabIdentite['moisOppositionInsee'])) ){
|
||||
if ( $iDb2->getLastErrorNum()<>1062 )
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des oppositions de la sphère commerciale INSEE pour $siren au mois de ".$tabIdentite['moisOppositionInsee']." : ".EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
}
|
||||
@ -153,7 +153,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$entrep = $iInsee->getIdentiteLight($siren);
|
||||
if ($nic<10) $nic=$entrep['Nic'];
|
||||
$cj1=substr($entrep['FJ'],0,1);
|
||||
$iDb2 = new WDB('insee');
|
||||
$iDb2 = new WDB();
|
||||
/** Insertion dans la tables des exclusions **/
|
||||
$tabInsert = array(
|
||||
'siren' => $siren,
|
||||
@ -163,7 +163,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'insEVE' => 'RCS',
|
||||
'mois' => $tabIdentite['moisRefusRCS'],
|
||||
);
|
||||
if (!$iDb2->insert('insee_nondiff', $tabInsert))
|
||||
if (!$iDb2->insert('insee.insee_nondiff', $tabInsert))
|
||||
if ($iDb2->getLastErrorNum()<>1062)
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des refus d'enregistrement A au RCS pour $siren au mois de ".$tabIdentite['moisRefusRCS']." : ".EOL.print_r($tabInsert, true).EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
|
||||
@ -176,7 +176,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'insDATEVE' => $tabIdentite['moisRefusRCS'].'28',
|
||||
'insDATEMAJ' => date('YmdHis'),
|
||||
'idFlux' => date('Ymd'));
|
||||
if (!$iDb2->insert('insee_even', $tabInsert))
|
||||
if (!$iDb2->insert('insee.insee_even', $tabInsert))
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de l'inscription à la liste des refus d'enregistrement B au RCS pour $siren au mois de ".$tabIdentite['moisOppositionInsee']." : ".EOL.print_r($tabInsert, true).EOL.print_r($tabIdentite, true).EOL.$iDb2->getLastError());
|
||||
}
|
||||
// Fin refus d'inscription au RCS
|
||||
@ -192,8 +192,7 @@ class Saisie extends Scores_Ws_Server
|
||||
// Si demande de suppression, on force l'indicateur ""
|
||||
if ($tabIdentite['domiciliataire']=='non') {
|
||||
$tabUpdate=array('pasEntrepDom'=>1);
|
||||
if (!$iDb->update('tabAdrDom', $tabUpdate, "siren=$siren"))
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", "Erreur lors de la suppression du marqueur de domiciliation pour $siren :".EOL.print_r($tabUpdate, true).EOL.$iDb->getLastError());
|
||||
$iDb->update('jo.tabAdrDom', $tabUpdate, "siren=$siren");
|
||||
}
|
||||
}
|
||||
// Fin domiciliataire
|
||||
@ -219,8 +218,8 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
if ( $setScore ){
|
||||
// Mise à jour des Cute Offs
|
||||
if ( !$iDb->update('scores_cutoff', $tabUpdate, "siren=$siren") ){
|
||||
if ( !$iDb->insert('scores_cutoff', array_merge(array(
|
||||
if ( !$iDb->update('jo.scores_cutoff', $tabUpdate, "siren=$siren") ){
|
||||
if ( !$iDb->insert('jo.scores_cutoff', array_merge(array(
|
||||
'siren' => $siren,
|
||||
'dateInsert' => date('Ymd') ), $tabUpdate)) ){
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "ERREUR setInfosEntrep pour $siren", print_r($tabScores, true).EOL.$iDb->getLastError());
|
||||
@ -328,8 +327,8 @@ class Saisie extends Scores_Ws_Server
|
||||
'typeEven' => $tabEven[0],
|
||||
'dateSource' => $dateSource,
|
||||
));
|
||||
if ( !$iDb->insert('annonces', array_merge($tabInsert,array('dateInsert'=>date('YmdHis'))), true) ){
|
||||
if ( !$iDb->update('annonces', $tabUpdate, "siren=$siren AND dateJugement='$dateJuge' AND typeEven=".$tabEven[0], true)){
|
||||
if ( !$iDb->insert('jo.annonces', array_merge($tabInsert,array('dateInsert'=>date('YmdHis'))), true) ){
|
||||
if ( !$iDb->update('jo.annonces', $tabUpdate, "siren=$siren AND dateJugement='$dateJuge' AND typeEven=".$tabEven[0], true)){
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Mise a jour impossible';
|
||||
$output = new SetInfosEntrepReturn();
|
||||
@ -388,13 +387,13 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res = $iDb->select('liens', 'count(*)',
|
||||
$res = $iDb->select('jo.liens', 'count(*)',
|
||||
"Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
$errMaj=1016166;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=1016167;
|
||||
}
|
||||
|
||||
@ -407,12 +406,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
$errMaj=1016168;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=1016169;
|
||||
}
|
||||
}
|
||||
@ -461,12 +460,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='$nom' AND Pays='$pays'))", true))
|
||||
$errMaj=10168;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=10169;
|
||||
}
|
||||
|
||||
@ -479,12 +478,12 @@ class Saisie extends Scores_Ws_Server
|
||||
'source'=> 1900,
|
||||
'dateInsert'=> date('YmdHis'))
|
||||
);
|
||||
$res=$iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
if (!$iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))", true))
|
||||
$errMaj=10170;
|
||||
} else {
|
||||
if (!$iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=10171;
|
||||
}
|
||||
}
|
||||
@ -597,7 +596,7 @@ class Saisie extends Scores_Ws_Server
|
||||
|
||||
if ($idAnn>0)
|
||||
{
|
||||
if ($iDb->update('annonces',array(
|
||||
if ($iDb->update('jo.annonces',array(
|
||||
'dateSuppr'=>date('YmdHis'),
|
||||
'idSuppr'=>$this->User->id),
|
||||
"id=$idAnn", false))
|
||||
@ -717,7 +716,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$iDb = new WDB();
|
||||
$idAnn = intval(preg_replace('/^0\./','', ''.$idAnn));
|
||||
if ($idAnn>0 && $siren>1000){
|
||||
$res = $iDb->select('annonces', '*', "id=$idAnn", false, MYSQL_ASSOC);
|
||||
$res = $iDb->select('jo.annonces', '*', "id=$idAnn", false, MYSQL_ASSOC);
|
||||
if (count($res)==0) {
|
||||
$error->errnum = 1;
|
||||
$error->errmsg = 'Annonce inexistante';
|
||||
@ -728,7 +727,7 @@ class Saisie extends Scores_Ws_Server
|
||||
unset($annonce['nic']);//=$nic;
|
||||
$annonce['siren'] = $siren;
|
||||
$annonce['nic'] = $nic;
|
||||
if ($iDb->insert('annonces', $annonce, false)) {
|
||||
if ($iDb->insert('jo.annonces', $annonce, false)) {
|
||||
debugLog('I',"Duplication de l'annonce collectée n°$idAnn sur $siret",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
$result = 1;
|
||||
} else {
|
||||
@ -770,7 +769,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn) * 1;
|
||||
if ($idAnn>0)
|
||||
{
|
||||
$res = $iDb->select('annonces',
|
||||
$res = $iDb->select('jo.annonces',
|
||||
'id, LPAD(siren,9,0) AS siren, sirenValide, typeEven, strEven, raisonSociale, adresse, codePostal, ville, dateJugement, dateCessationPaiement, dateEffetFinP, numero, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom, tribunal, montant, actionsNb, complement, infosBrutes, nouvActivite, nouvDir, nouvAdr, nouvFJ, annonce, source, parutionIdJal, parutionNum, dateSource, idSaisie, idAnnonce, dateInsert',
|
||||
"id=$idAnn", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -944,7 +943,7 @@ class Saisie extends Scores_Ws_Server
|
||||
{
|
||||
case 0:
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn)*1;
|
||||
$table = 'annonces';
|
||||
$table = 'jo.annonces';
|
||||
break;
|
||||
case 1:
|
||||
if (intval($idAnn)<0){
|
||||
@ -952,7 +951,7 @@ class Saisie extends Scores_Ws_Server
|
||||
$error->errmsg = 'Code annonce Incorrect';
|
||||
} else {
|
||||
$strSql = "AND siren=$siren";
|
||||
$table = 'bodacc_detail';
|
||||
$table = 'jo.bodacc_detail';
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@ -1024,7 +1023,7 @@ class Saisie extends Scores_Ws_Server
|
||||
//
|
||||
case 0:
|
||||
$idAnn = preg_replace('/^0\./','', ''.$idAnn)*1;
|
||||
$table = 'annonces';
|
||||
$table = 'jo.annonces';
|
||||
break;
|
||||
|
||||
//Bodacc
|
||||
@ -1035,13 +1034,13 @@ class Saisie extends Scores_Ws_Server
|
||||
$error->errmsg = 'Code annonce Incorrect';
|
||||
} else {
|
||||
if (intval($sirenIn)>0) $strSql.="AND siren=$sirenIn";
|
||||
$table = 'bodacc_detail';
|
||||
$table = 'jo.bodacc_detail';
|
||||
}
|
||||
break;
|
||||
|
||||
//Association
|
||||
case 3:
|
||||
$table = 'asso';
|
||||
$table = 'jo.asso';
|
||||
break;
|
||||
//
|
||||
case 2:
|
||||
@ -1064,7 +1063,7 @@ class Saisie extends Scores_Ws_Server
|
||||
} else {
|
||||
|
||||
/* Si table = asso => UPDATE de la ligne */
|
||||
if ($table == 'asso'){
|
||||
if ($table == 'jo.asso'){
|
||||
//$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1087,7 +1086,7 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
/* Si sirenIn = 0 et table = bodacc_detail => INSERT + UPDATE */
|
||||
elseif (intval($sirenIn) == 0 && $table == 'bodacc_detail' ) {
|
||||
elseif (intval($sirenIn) == 0 && $table == 'jo.bodacc_detail' ) {
|
||||
$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1110,7 +1109,7 @@ class Saisie extends Scores_Ws_Server
|
||||
}
|
||||
}
|
||||
/* si sirenIn != 0 et table = bodacc_detail => insert */
|
||||
elseif (intval($sirenIn) != 0 && $table == 'bodacc_detail') {
|
||||
elseif (intval($sirenIn) != 0 && $table == 'jo.bodacc_detail') {
|
||||
$annonce = $res[0];
|
||||
$annonce['siren'] = $sirenOut;
|
||||
$annonce['sirenValide'] = 2;
|
||||
@ -1129,7 +1128,7 @@ class Saisie extends Scores_Ws_Server
|
||||
|
||||
}
|
||||
/* Si table = annonces => INSERT */
|
||||
elseif ($table == 'annonces'){
|
||||
elseif ($table == 'jo.annonces'){
|
||||
$annonce = $res[0];
|
||||
// Suppression des zones inexistantes dans la table ou devant être vides
|
||||
unset($annonce['id']);
|
||||
@ -1167,7 +1166,7 @@ class Saisie extends Scores_Ws_Server
|
||||
public function setAnnonceEven($siren, $id, $codeEven)
|
||||
{
|
||||
$this->authenticate();
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
|
||||
$list = array();
|
||||
if (is_object($codeEven)){
|
||||
@ -1187,7 +1186,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'Rubrique' => $row->Rubrique,
|
||||
'idSirenage' => $this->User->id,
|
||||
);
|
||||
if ($iDb->update('bodacc_detail', $tabUpdate, "siren='$siren' AND id='$id'")){
|
||||
if ($iDb->update('jo.bodacc_detail', $tabUpdate, "siren='$siren' AND id='$id'")){
|
||||
debugLog('I',"setAnnonceEven (siren=$siren, list=$list)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
return true;
|
||||
}
|
||||
@ -2482,7 +2481,7 @@ class Saisie extends Scores_Ws_Server
|
||||
'dateAjout'=>date('Y-m-d'),
|
||||
'dateSuppr'=>0,
|
||||
);
|
||||
$iDb = new WDB('jo');
|
||||
$iDb = new WDB();
|
||||
$iDb->insert('surveillances_site', $data);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
<?php
|
||||
return array(
|
||||
'catalog' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.1' => array( 'actif' => true, 'defaut' => true ),
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.9' => array( 'actif' => true, 'defaut' => 'beta' ),
|
||||
'0.8' => array( 'actif' => true, 'defaut' => true, 'start' => '2014-04-01' ),
|
||||
'0.7' => array( 'actif' => true, 'defaut' => false, 'start' => '2012-01-01', 'end' => '2014-03-31'),
|
||||
'0.6' => array( 'actif' => false, 'defaut' => false ),
|
||||
@ -12,6 +20,16 @@ return array(
|
||||
'0.2' => array( 'actif' => false, 'defaut' => false ),
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.4' => array( 'actif' => true, 'defaut' => 'beta' ),
|
||||
'0.3' => array( 'actif' => true, 'defaut' => true ),
|
||||
'0.2' => array( 'actif' => false, 'defaut' => false ),
|
||||
'0.1' => array( 'actif' => false, 'defaut' => false ),
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'interne' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
@ -22,16 +40,6 @@ return array(
|
||||
'0.2' => array( 'actif' => false, 'defaut' => false ),
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'gestion' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.4' => array( 'actif' => true, 'defaut' => 'beta' ),
|
||||
'0.3' => array( 'actif' => true, 'defaut' => true ),
|
||||
'0.2' => array( 'actif' => false, 'defaut' => false ),
|
||||
'0.1' => array( 'actif' => false, 'defaut' => false ),
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'order' => array(
|
||||
'actif' => true,
|
||||
@ -40,7 +48,7 @@ return array(
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'catalog' => array(
|
||||
'pieces' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.1' => array( 'actif' => true, 'defaut' => true ),
|
||||
@ -55,11 +63,12 @@ return array(
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
'pieces' => array(
|
||||
'source' => array(
|
||||
'actif' => true,
|
||||
'versions' => array(
|
||||
'0.1' => array( 'actif' => true, 'defaut' => true ),
|
||||
'0.1' => array( 'actif' => true, 'defaut' => true),
|
||||
),
|
||||
'idClient' => array(1),
|
||||
),
|
||||
|
||||
);
|
@ -16,48 +16,11 @@ class WDB
|
||||
|
||||
protected $errorMsg = '';
|
||||
|
||||
public function __construct( $database = null, $host = null, $user = null, $password = null )
|
||||
public function __construct( $db = null )
|
||||
{
|
||||
if ( $database === null ) {
|
||||
$database = 'jo';
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
|
||||
if ( $host === null ) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => $c->profil->db->metier->adapter,
|
||||
'params' => array(
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'username'=> $c->profil->db->metier->params->username,
|
||||
'password'=> $c->profil->db->metier->params->password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
} else {
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => 'mysqli',
|
||||
'params' => array(
|
||||
'host' => $host,
|
||||
'username'=> $user,
|
||||
'password'=> $password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
$this->db = Zend_Db::factory($config);
|
||||
} catch ( Exception $e ) {
|
||||
file_put_contents(LOG_PATH . '/mysql.log', date('Y-m-d H:i:s') . ' - Erreur : ' . $e->getMessage()."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,11 +42,11 @@ class WDB
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority)
|
||||
if ($low_priority) {
|
||||
$query = 'INSERT DELAYED INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
else
|
||||
} else {
|
||||
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
|
||||
}
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
@ -119,17 +82,18 @@ class WDB
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
if ($low_priority)
|
||||
if ($low_priority) {
|
||||
$query='UPDATE LOW_PRIORITY '.$table.' SET ';
|
||||
else
|
||||
} else {
|
||||
$query='UPDATE '.$table.' SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' '.$fields[$i]."=".$this->db->quote($values[$i]);
|
||||
$i++;
|
||||
}
|
||||
$i=0;
|
||||
foreach ($update as $field => $value) {
|
||||
$query.= ' '.$field."=".$this->db->quote($value);
|
||||
$i++;
|
||||
if ($i<count($update)) {
|
||||
$query.= ',';
|
||||
}
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where;
|
||||
@ -139,10 +103,10 @@ class WDB
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
$res = $stmt->rowCount();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
@ -16,48 +16,11 @@ class WDB
|
||||
|
||||
protected $errorMsg = '';
|
||||
|
||||
public function __construct( $database = null, $host = null, $user = null, $password = null )
|
||||
public function __construct( $db = null )
|
||||
{
|
||||
if ( $database === null ) {
|
||||
$database = 'jo';
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
|
||||
if ( $host === null ) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => $c->profil->db->metier->adapter,
|
||||
'params' => array(
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'username'=> $c->profil->db->metier->params->username,
|
||||
'password'=> $c->profil->db->metier->params->password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
} else {
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => 'mysqli',
|
||||
'params' => array(
|
||||
'host' => $host,
|
||||
'username'=> $user,
|
||||
'password'=> $password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
$this->db = Zend_Db::factory($config);
|
||||
} catch ( Exception $e ) {
|
||||
file_put_contents(LOG_PATH . '/mysql.log', date('Y-m-d H:i:s') . ' - Erreur : ' . $e->getMessage()."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,11 +42,11 @@ class WDB
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority)
|
||||
if ($low_priority) {
|
||||
$query = 'INSERT DELAYED INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
else
|
||||
} else {
|
||||
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
|
||||
}
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
@ -119,17 +82,18 @@ class WDB
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
if ($low_priority)
|
||||
if ($low_priority) {
|
||||
$query='UPDATE LOW_PRIORITY '.$table.' SET ';
|
||||
else
|
||||
} else {
|
||||
$query='UPDATE '.$table.' SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' '.$fields[$i]."=".$this->db->quote($values[$i]);
|
||||
$i++;
|
||||
}
|
||||
$i=0;
|
||||
foreach ($update as $field => $value) {
|
||||
$query.= ' '.$field."=".$this->db->quote($value);
|
||||
$i++;
|
||||
if ($i<count($update)) {
|
||||
$query.= ',';
|
||||
}
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where;
|
||||
@ -139,10 +103,10 @@ class WDB
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
$res = $stmt->rowCount();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
@ -74,6 +74,12 @@ if( count($opts->getOptions())==0 || isset($opts->help))
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
Zend_Registry::set('config', $c);
|
||||
|
||||
/**
|
||||
* Connexion à la base de données
|
||||
*/
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
require_once 'WsScore/Configure.php';
|
||||
$oldconfig = new Configure();
|
||||
|
||||
@ -394,8 +400,8 @@ if ( $opts->tabcache) {
|
||||
*/
|
||||
function genereCacheRatios()
|
||||
{
|
||||
$tabMoy=array();
|
||||
$iDb = new WDB("jo");
|
||||
$tabMoy = array();
|
||||
$iDb = new WDB();
|
||||
|
||||
$configFile = APPLICATION_PATH.'/../library/Metier/scores/classMRatios.php';
|
||||
|
||||
@ -471,7 +477,7 @@ function genereCacheRatios()
|
||||
fwrite($fp, "\t\t\t" . "\$R=array();" ."\n");
|
||||
|
||||
$tabFormules = $iDb->select(
|
||||
'ratios_formules',
|
||||
'jo.ratios_formules',
|
||||
'id, libelle, formule, unite, commentaires, borneMin, borneMax, calcul, deleted',
|
||||
'deleted=0');
|
||||
|
||||
@ -592,20 +598,20 @@ function generateFormule($version, $type = 'scores')
|
||||
// Chargement des formules de commentaires
|
||||
$tabFormulesScore=array();
|
||||
|
||||
$iDb = new WDB("jo");
|
||||
$iDb = new WDB();
|
||||
|
||||
// Select the right table in database in function of type
|
||||
switch ($type) {
|
||||
case 'scores':
|
||||
$file = APPLICATION_PATH.'/../library/Metier/scores/Formule/Score_'.$version.'.php';
|
||||
$tableFormu = 'scores_formules_'.$version;
|
||||
$tableComment = 'scores_commentaires_'.$version;
|
||||
$tableFormu = 'jo.scores_formules_'.$version;
|
||||
$tableComment = 'jo.scores_commentaires_'.$version;
|
||||
break;
|
||||
|
||||
case 'valo':
|
||||
$file = APPLICATION_PATH.'/../library/Metier/scores/Formule/Valo_'.$version.'.php';
|
||||
$tableFormu = 'valo_formules_'.$version;
|
||||
$tableComment = 'valo_commentaires_'.$version;
|
||||
$tableFormu = 'jo.valo_formules_'.$version;
|
||||
$tableComment = 'jo.valo_commentaires_'.$version;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -933,20 +939,20 @@ function generateFormule($version, $type = 'scores')
|
||||
*/
|
||||
function generateComment($version, $type = 'scores', $cycle = 2)
|
||||
{
|
||||
$iDb = new WDB("jo");
|
||||
$iDb = new WDB();
|
||||
|
||||
// Select the right table in database in function of type
|
||||
switch ($type) {
|
||||
case 'scores':
|
||||
$name = 'Score_'.$version.'_'.$cycle;
|
||||
$file = APPLICATION_PATH.'/../library/Metier/scores/Comment/Score_'.$version.'_'.$cycle.'.php';
|
||||
$tableComment = 'scores_commentaires_'.$version;
|
||||
$tableComment = 'jo.scores_commentaires_'.$version;
|
||||
break;
|
||||
|
||||
case 'valo':
|
||||
$name = 'Valo_'.$version.'_'.$cycle;
|
||||
$file = APPLICATION_PATH.'/../library/Metier/scores/Comment/Valo_'.$version.'_'.$cycle.'.php';
|
||||
$tableComment = 'valo_commentaires_'.$version;
|
||||
$tableComment = 'jo.valo_commentaires_'.$version;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,12 @@ $application = new Zend_Application(
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
Zend_Registry::set('config', $c);
|
||||
|
||||
/**
|
||||
* Connexion à la base de données
|
||||
*/
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
require_once 'WsScore/Configure.php';
|
||||
$oldconfig = new Configure();
|
||||
@ -97,10 +103,8 @@ for ($i=1; isset($argv[$i]); $i++) {
|
||||
}
|
||||
}
|
||||
|
||||
//$iDbI=new WDB('insee');
|
||||
$iDb=new WDB('jo');
|
||||
$iDb2=new WDB('jo');
|
||||
$iInsee=new MInsee();
|
||||
$iDb = new WDB();
|
||||
$iInsee = new MInsee($db);
|
||||
|
||||
if ($updateCache) {
|
||||
include_once 'Metier/scores/classMRatios.php';
|
||||
@ -113,7 +117,7 @@ for ($i=1; isset($argv[$i]); $i++) {
|
||||
|
||||
echo date('Y/m/d - H:i:s') ." - DEBUT du programme de calcul des ratios...".EOL;
|
||||
|
||||
$tabLast=$iDb->select( 'ratios_formules',
|
||||
$tabLast=$iDb->select( 'jo.ratios_formules',
|
||||
'max(dateUpdate) AS lastUpdate, max(dateInsert) AS lastInsert',
|
||||
'1');
|
||||
$lastUpdate=$tabLast[0]['lastInsert'];
|
||||
@ -137,7 +141,7 @@ for ($i=1; isset($argv[$i]); $i++) {
|
||||
echo date('Y/m/d - H:i:s') ." - Formules de calcul des ratios déjà en cache.".EOL;
|
||||
|
||||
/** Recherche de la dernière mise à jour des ratios secteurs **/
|
||||
$tabLast=$iDb->select( 'ratios_secteurs',
|
||||
$tabLast=$iDb->select( 'jo.ratios_secteurs',
|
||||
'max(dateUpdate) AS lastUpdate, max(dateInsert) AS lastInsert',
|
||||
'1');
|
||||
$lastUpdate=$tabLast[0]['lastInsert'];
|
||||
@ -146,7 +150,7 @@ for ($i=1; isset($argv[$i]); $i++) {
|
||||
|
||||
echo(date('Y/m/d - H:i:s') ." - La dernière mise à jour des ratios secteurs date du $lastUpdate...".EOL);
|
||||
|
||||
$nbRows=$iDb->select( 'ratios_tmp', 'siren, lastUpdate', "1", false, MYSQL_ASSOC, true);
|
||||
$nbRows=$iDb->select( 'jo.ratios_tmp', 'siren, lastUpdate', "1", false, MYSQL_ASSOC, true);
|
||||
if ($nbRows>0) {
|
||||
$modeSuite=true;
|
||||
echo date('Y/m/d - H:i:s') ." - Il reste $nbRows entreprises pour lesquels il faut mettre à jour les ratios secteurs...".EOL;
|
||||
@ -155,26 +159,26 @@ for ($i=1; isset($argv[$i]); $i++) {
|
||||
$modeSuite=false;
|
||||
|
||||
// Date du dernier bilan inseré
|
||||
$tabLast=$iDb->select( 'bilans',
|
||||
$tabLast=$iDb->select( 'jo.bilans',
|
||||
'MAX(dateInsert) AS lastDateInsert',
|
||||
"siren>100 AND dateInsert>='$lastUpdate' AND typeBilan IN ('N','',' ','A','B') ORDER BY dateInsert DESC");
|
||||
$lastDateBilan=strtr($tabLast[0]['lastDateInsert'],array(' '=>'',':'=>'','-'=>''));
|
||||
echo(date('Y/m/d - H:i:s') ." - Le dernier bilan inséré en base date du $lastDateBilan...".EOL);
|
||||
|
||||
// Liste des derniers Bilans insérés depuis le dernier calcul des ratios
|
||||
$nbRows=$iDb->select( 'bilans', 'DISTINCT siren', "siren>100 AND dateInsert>='$lastUpdate' AND typeBilan IN ('N','',' ','A','B') ORDER BY dateInsert DESC", false, MYSQL_ASSOC, true);
|
||||
$nbRows=$iDb->select( 'jo.bilans', 'DISTINCT siren', "siren>100 AND dateInsert>='$lastUpdate' AND typeBilan IN ('N','',' ','A','B') ORDER BY dateInsert DESC", false, MYSQL_ASSOC, true);
|
||||
$lastDate=strtr($lastUpdate,array(' '=>'',':'=>'','-'=>''));
|
||||
echo date('Y/m/d - H:i:s') ." - Il y a $nbRows entreprises avec nouveaux bilans pour calcul des ratios secteurs...".EOL;
|
||||
$iDb2->query('DROP TABLE IF EXISTS ratios_tmp;');
|
||||
$iDb->query('DROP TABLE IF EXISTS jo.ratios_tmp;');
|
||||
if (mysql_errno()>0) echo date('Y/m/d - H:i:s') .' - ERREUR SQL lors de la création de la table temporaires, n°'.mysql_errno().' : '.mysql_error().EOL;
|
||||
$strSQL="CREATE TABLE IF NOT EXISTS ratios_tmp ( siren int(9) unsigned zerofill NOT NULL, lastUpdate bigint(14) unsigned zerofill NOT NULL, lastBilan bigint(14) unsigned zerofill NOT NULL, PRIMARY KEY(siren) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
|
||||
$iDb2->query($strSQL);
|
||||
$strSQL="CREATE TABLE IF NOT EXISTS jo.ratios_tmp ( siren int(9) unsigned zerofill NOT NULL, lastUpdate bigint(14) unsigned zerofill NOT NULL, lastBilan bigint(14) unsigned zerofill NOT NULL, PRIMARY KEY(siren) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
|
||||
$iDb->query($strSQL);
|
||||
if (mysql_errno()>0) echo date('Y/m/d - H:i:s') .' - ERREUR SQL lors de la création de la table temporaires, n°'.mysql_errno().' : '.mysql_error().EOL;
|
||||
while($entrep=$iDb->fetch(MYSQL_ASSOC)) {
|
||||
$iDb2->insert('ratios_tmp', array('siren'=>$entrep['siren'], 'lastUpdate'=>$lastDate, 'lastBilan'=>$lastDateBilan));
|
||||
$iDb->insert('jo.ratios_tmp', array('siren'=>$entrep['siren'], 'lastUpdate'=>$lastDate, 'lastBilan'=>$lastDateBilan));
|
||||
}
|
||||
echo date('Y/m/d - H:i:s') ." - Les éléments ont été mis en table temporaire en cas de reprise sur erreur !".EOL;
|
||||
$nbRows=$iDb->select( 'ratios_tmp', 'siren, lastUpdate, lastBilan', "1", false, MYSQL_ASSOC, true);
|
||||
$nbRows=$iDb->select( 'jo.ratios_tmp', 'siren, lastUpdate, lastBilan', "1", false, MYSQL_ASSOC, true);
|
||||
}
|
||||
|
||||
$k=0; // Compteur d'entreprises
|
||||
|
Loading…
Reference in New Issue
Block a user