Library update
This commit is contained in:
parent
08742cddfb
commit
55a21524b0
@ -493,6 +493,12 @@ class Metier_Bodacc_MBodacc
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Bodacc
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
@ -505,6 +511,10 @@ class Metier_Bodacc_MBodacc
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
/* Charge toute la table des tribunaux pour ne pas lancer systématiquement des
|
||||
* requètes sur le serveur MySQL lors des intégrations de Bodacc
|
||||
*/
|
||||
@ -545,11 +555,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$tribunaux = array();
|
||||
|
||||
$sql = "SELECT triCode, triNom, triCP, triSiret FROM jo.tribunaux WHERE triCode IS NOT NULL";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($t = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$dep = intval(substr($t->triCP, 0, 2));
|
||||
if ($dep == 97 || $dep == 98) {
|
||||
@ -578,11 +595,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT codeFct, libelle FROM jo.bodacc_fonctions";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[intval($row->codeFct)] = $row->libelle;
|
||||
}
|
||||
@ -619,10 +643,18 @@ class Metier_Bodacc_MBodacc
|
||||
FROM jo.tribunaux t, jo.tribunauxInsee i
|
||||
WHERE i.CodeInsee= :inseeCode AND i.triId=t.triId
|
||||
ORDER BY t.triNumGreffe DESC, t.triId ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('inseeCode', $codeInseeCommune);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('inseeCode', $codeInseeCommune);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -643,16 +675,24 @@ class Metier_Bodacc_MBodacc
|
||||
t.triSiret, t.triAdrNum, t.triAdrIndRep, t.triAdrTypeVoie, t.triAdrVoie, t.triAdrComp,
|
||||
t.triVille, t.triStatut, t.triDateCessation, t.triCommentaire, t.triNumGreffe
|
||||
FROM jo.tribunaux t WHERE t.triCP BETWEEN :dep1 AND :dep2 ORDER BY t.triType ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
if ($dep < 96) {
|
||||
$stmt->bindValue('dep1', $dep.'000');
|
||||
$stmt->bindValue('dep2', $dep.'999');
|
||||
} else {
|
||||
$stmt->bindValue('dep1', $dep.'00');
|
||||
$stmt->bindValue('dep2', $dep.'99');
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
if ($dep < 96) {
|
||||
$stmt->bindValue('dep1', $dep.'000');
|
||||
$stmt->bindValue('dep2', $dep.'999');
|
||||
} else {
|
||||
$stmt->bindValue('dep1', $dep.'00');
|
||||
$stmt->bindValue('dep2', $dep.'99');
|
||||
}
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -666,10 +706,18 @@ class Metier_Bodacc_MBodacc
|
||||
public function getTribunalIdCA($codeTribunal)
|
||||
{
|
||||
$sql = "SELECT triIdSup FROM jo.tribunaux WHERE triCode = :code";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeTribunal);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeTribunal);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
return $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -695,11 +743,18 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT codEven, libEven, Bodacc_Code, Rubrique, version, lienEtab FROM jo.tabEvenements";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[$row->codEven] = array(
|
||||
'libEven' => $row->libEven,
|
||||
@ -726,11 +781,17 @@ class Metier_Bodacc_MBodacc
|
||||
return include $cache;
|
||||
} else {
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT libDeviseBodacc, devIso FROM jo.bodacc_devises";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[$row->libDeviseBodacc] = $row->devIso;
|
||||
}
|
||||
@ -1170,7 +1231,7 @@ class Metier_Bodacc_MBodacc
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
continue;
|
||||
}
|
||||
if ($stmt->rowCount()) {
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$tabPrenom = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
// C'est plutôt le nom de famille au début de la chaîne
|
||||
if ($i == 0) {
|
||||
@ -1209,12 +1270,20 @@ class Metier_Bodacc_MBodacc
|
||||
|
||||
$sql = "SELECT Bodacc_Code, Bodacc_Annee_Parution, Bodacc_Num, Num_Annonce, Tribunal_Dept, Tribunal_Code, Rubrique_Bodacc, length(annonce) as Long
|
||||
FROM jo.bodacc WHERE Bodacc_Code=:code AND Bodacc_Annee_Parution=:annee AND Bodacc_Num=:num";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $bodaccCode);
|
||||
$stmt->bindValue('annee', $annee);
|
||||
$stmt->bindValue('num', $num);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $bodaccCode);
|
||||
$stmt->bindValue('annee', $annee);
|
||||
$stmt->bindValue('num', $num);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result[] = array(
|
||||
'BodaccCode' => $ann->Bodacc_Code,
|
||||
@ -1301,10 +1370,18 @@ class Metier_Bodacc_MBodacc
|
||||
|
||||
$sql = "SELECT id, dep, nomJal, siteWeb, email, adresse, cp, ville, tel, fax, parution, aboAnnuel, infos
|
||||
FROM jo.tabJAL WHERE dep = :dep";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
@ -1316,10 +1393,18 @@ class Metier_Bodacc_MBodacc
|
||||
$result = array();
|
||||
|
||||
$sql = "SELECT id, nomJal FROM jo.tabJAL WHERE sedDateAbo!=0 GROUP BY nomJal ORDER BY nomJal ASC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('dep', $dep);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$result['_'.$row->id] = $row->nomJal;
|
||||
}
|
||||
@ -1338,37 +1423,69 @@ class Metier_Bodacc_MBodacc
|
||||
{
|
||||
$strEvenVtLg = " AND Rubrique!='ventes' AND typeEven NOT LIKE '%2700%' AND typeEven NOT LIKE '%2701%' AND typeEven NOT LIKE '%2702%' AND typeEven NOT LIKE '%2703%' AND typeEven NOT LIKE '%2710%' AND typeEven NOT LIKE '%2720%' AND typeEven NOT LIKE '%2721%' AND typeEven NOT LIKE '%2725%' AND typeEven NOT LIKE '%2730%' AND typeEven NOT LIKE '%2740%' AND typeEven NOT LIKE '%2750%' AND typeEven NOT LIKE '%2800%' AND typeEven NOT LIKE '%2840%' AND typeEven NOT LIKE '%2850%' AND typeEven NOT LIKE '%2851%' AND typeEven NOT LIKE '%2860%' AND typeEven NOT LIKE '%2870%' AND typeEven NOT LIKE '%2875%' AND typeEven NOT LIKE '%2880%' AND typeEven NOT LIKE '%2881%' AND typeEven NOT LIKE '%2885%' AND typeEven NOT LIKE '%2890%' AND typeEven NOT LIKE '%2891%' AND typeEven NOT LIKE '%2892%' ";
|
||||
$sql = "SELECT Activite FROM jo.bodacc_detail WHERE siren=:siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($fj < 7000 || $fj > 7999) {
|
||||
$activite = trim($annCap['Activite']);
|
||||
}
|
||||
|
||||
if ($activite == '' && ($fj > 90 && $fj < 94 || $fj > 9000 && $fj < 9400)) {
|
||||
$sql = "SELECT Assoc_Objet, Assoc_NObjet FROM jo.asso WHERE siren=:siren AND (Assoc_Objet!='' OR Assoc_NObjet!='') ORDER BY Date_Parution DESC LIMIT 0,1";
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$activite = trim($annCap['Assoc_NObjet']);
|
||||
if ($activite == '') {
|
||||
$activite = trim($annCap['Assoc_Objet']);
|
||||
if ($fj < 7000 || $fj > 7999) {
|
||||
$activite = trim($annCap['Activite']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($activite == '' && ($fj > 90 && $fj < 94 || $fj > 9000 && $fj < 9400)) {
|
||||
$sql = "SELECT Assoc_Objet, Assoc_NObjet FROM jo.asso
|
||||
WHERE siren=:siren AND (Assoc_Objet!='' OR Assoc_NObjet!='')
|
||||
ORDER BY Date_Parution DESC LIMIT 0,1";
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$annCap = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$activite = trim($annCap['Assoc_NObjet']);
|
||||
if ($activite == '') {
|
||||
$activite = trim($annCap['Assoc_Objet']);
|
||||
}
|
||||
}
|
||||
} elseif ($activite == '' && ($fj < 7000 || $fj > 7999)) {
|
||||
$sql = "SELECT e.ANBASE, e.NOBOD, e.CODTRI, e.JAL, e.DATE, e.CODEVE, e.SSCODE, e.DEPT, e.NOANN, e.ROLE, e.SIREN, e.E1GSIR, e.E1GNIC, x.annonceNum, x.annonceTxt
|
||||
FROM historiques.entrep e, historiques.texte x
|
||||
WHERE e.E1GSIR=:siren AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20041231 AND x.annonceTxt LIKE '%ctivit%'
|
||||
GROUP BY e.ANBASE ORDER BY e.DATE DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount()) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($ann = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (($ann['CODEVE'] < 20) || ($ann['CODEVE'] >= 30 && $ann['CODEVE'] < 42) || ($ann['CODEVE'] >= 51 && $ann['CODEVE'] < 80)) {
|
||||
if (($ann['CODEVE'] < 20) || ($ann['CODEVE'] >= 30 && $ann['CODEVE'] < 42)
|
||||
|| ($ann['CODEVE'] >= 51 && $ann['CODEVE'] < 80)) {
|
||||
if (preg_match('/(.*)Activit(?:e|é)(?:.|)\:(.*)(?:Adresse(?:.*|)|Commentaires?|Administration|Etablissement principal|Date d\'effet|Date.de.d.but d.activit.|Capital|Nom commercial)(?:.|)\:/Uisu', $ann['annonceTxt'], $matches)) {
|
||||
if (strpos(substr($matches[1], -20), 'cess') === false && strpos(substr($matches[1], -20), 'date') === false) {
|
||||
if (strpos(substr($matches[1], -20), 'cess') === false
|
||||
&& strpos(substr($matches[1], -20), 'date') === false) {
|
||||
$activite = $matches[2];
|
||||
break;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,10 +12,20 @@ class Metier_Partenaires_MAmabis
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->client = new SoapClient(null, array(
|
||||
'location' => 'http://sw2.amabis.com:5100/',
|
||||
'uri' => 'http://www.amabis.com/ns.xsd',
|
||||
@ -51,16 +61,23 @@ class Metier_Partenaires_MAmabis
|
||||
$adresse = addslashes(trim(preg_replace('/ +/', ' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$majForcee = false;
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$sql = "SELECT zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6,
|
||||
adr7, numVoieA, indRepA, typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD,
|
||||
libVoieSec, adr4n32, adr4n38, clePostaleVoie, secteur, cleRoutage, cpx, cleAd,
|
||||
codPaysIso2, codPaysIso3, libPays, codeInsee
|
||||
FROM jo.zonage WHERE address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT zus, zru, zfu, cucs, rnvpStatut, rnvpCorr, rnvpTrt, adr3, adr4, adr5, adr6,
|
||||
adr7, numVoieA, indRepA, typeVoieAlong, typeVoieAcourt, corpVoie, motDir, motDirD,
|
||||
libVoieSec, adr4n32, adr4n38, clePostaleVoie, secteur, cleRoutage, cpx, cleAd,
|
||||
codPaysIso2, codPaysIso3, libPays, codeInsee
|
||||
FROM jo.zonage WHERE address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
$zones = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
if ($zones['rnvpStatut'] === null && $rnvp) {
|
||||
$majForcee = true;
|
||||
@ -113,7 +130,7 @@ class Metier_Partenaires_MAmabis
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt->rowCount() == 0 || $majForcee) {
|
||||
if ($stmtNb == 0 || $majForcee) {
|
||||
try {
|
||||
// Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
if (trim($raisonSociale) == '') {
|
||||
@ -128,7 +145,6 @@ class Metier_Partenaires_MAmabis
|
||||
new SoapParam('type=M', 'options')
|
||||
);
|
||||
|
||||
|
||||
/** Découpage des ZFU, CUCS etcs... **/
|
||||
$fp = fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
|
||||
@ -225,25 +241,45 @@ class Metier_Partenaires_MAmabis
|
||||
$villeL = addslashes($ville);
|
||||
$sql = "SELECT dateInsert*1 as dateInsert FROM jo.zonage
|
||||
WHERE address='$adresseL' AND adr_cp='$cp' AND adr_ville='$villeL'";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$majNb = 0;
|
||||
try {
|
||||
$majStmt = $this->conn->prepare($sql);
|
||||
$majStmt->execute();
|
||||
$majNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($majNb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$dateInsert = $result->dateInsert;
|
||||
if ($dateInsert != 0) {
|
||||
$this->conn->update('jo.zonage', array_merge($tabUpdate,
|
||||
array('dateInsert' => $dateInsert)),
|
||||
array(
|
||||
'address' => $adresseL,
|
||||
'adr_cp' => $cp,
|
||||
'adr_ville' => $villeL,
|
||||
));
|
||||
try {
|
||||
$this->conn->update('jo.zonage', array_merge($tabUpdate,
|
||||
array('dateInsert' => $dateInsert)),
|
||||
array(
|
||||
'address' => $adresseL,
|
||||
'adr_cp' => $cp,
|
||||
'adr_ville' => $villeL,
|
||||
));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($dateInsert == 0) {
|
||||
$this->conn->insert('jo.zonage', array_merge($tabInsert, $tabUpdate));
|
||||
try {
|
||||
$this->conn->insert('jo.zonage', array_merge($tabInsert, $tabUpdate));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tabTmp[0] = explode(',', $tabZones['LOCREFCLEP']);
|
||||
@ -264,7 +300,13 @@ class Metier_Partenaires_MAmabis
|
||||
'source' => 'Amabis',
|
||||
'dateInsert' => date('YmdHis'),
|
||||
);
|
||||
$this->conn->insert('jo.villesCP', $tabInsert);
|
||||
try {
|
||||
$this->conn->insert('jo.villesCP', $tabInsert);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Autres Informations de la RNVP **/
|
||||
@ -286,11 +328,19 @@ class Metier_Partenaires_MAmabis
|
||||
$codeInsee = substr($codeRivoli, 0, 5);
|
||||
$sql = "SELECT typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin
|
||||
FROM jo.zonageInsee WHERE codeInsee=:code";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeInsee);
|
||||
$stmt->execute();
|
||||
$zonageNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('code', $codeInsee);
|
||||
$stmt->execute();
|
||||
$zonageNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$tabRep['ZRR'] = $tabRep['AFR'] = 'NON';
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($zonageNb > 0) {
|
||||
while ($zones = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
switch ($zones['typeZone']) {
|
||||
case 'ZRR':
|
||||
|
@ -16,6 +16,12 @@ D. 067 200 329 I 2010-06-30 La CS est valide jusq'au 30/06/2010... Quid
|
||||
*/
|
||||
class Metier_Partenaires_MFacto
|
||||
{
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public $risqueImpaye = false; // Y a t'il un risque d'impayé ?
|
||||
public $risqueImpayeMois = 0;
|
||||
public $profilPayeur = 0; // 0:N/D, 1:Excellent, 2=Bon, 3=Normal, 4=Lent, 5=Mauvais ou Défaut
|
||||
@ -93,6 +99,10 @@ class Metier_Partenaires_MFacto
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
public function setTypeFic($typeFic)
|
||||
@ -150,11 +160,19 @@ class Metier_Partenaires_MFacto
|
||||
WHERE siren=:siren AND (dateSuppr=0 OR dateConf>dateSuppr)
|
||||
AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34)
|
||||
ORDER BY dateConf DESC, dateInsert DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$tabRet = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$dateEven = $tabCS['dateConf'];
|
||||
if ($dateEven == '0000-00-00') {
|
||||
@ -179,15 +197,23 @@ class Metier_Partenaires_MFacto
|
||||
|
||||
public function getCoteSpecialeOld($siren)
|
||||
{
|
||||
$sql = "SELECT DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE
|
||||
$sql = "SELECT DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE
|
||||
FROM sdv1.ge_cs c LEFT JOIN sdv1.ge_acheteurs a ON a.NUMACH=c.NUMGFH
|
||||
WHERE a.SIRENE=:siren ORDER BY a.SIRENE ASC, c.DATMAJ1 DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet = array();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$tabRet[] = array(
|
||||
'DateEven' => $tabCS['DATMAJ1'],
|
||||
@ -228,10 +254,18 @@ class Metier_Partenaires_MFacto
|
||||
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE
|
||||
FROM sdv1.ge_paiements p LEFT JOIN sdv1.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";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabPai = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$nbJoursMoyen = $tabPai['nbJourRetard'] - $tabPai['nbJourPaiement'];
|
||||
if ($nbJoursMoyen < 6) {
|
||||
@ -387,10 +421,18 @@ class Metier_Partenaires_MFacto
|
||||
WHERE idClient='SURBODPRDFTSRECOCASH' AND siren=:siren AND dateSuppr=0
|
||||
AND ABS(DATEDIFF(dateAjout, NOW()))<365
|
||||
ORDER BY dateConf DESC, dateAjout DESC";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
while ($tabCS = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$dateMAJ = Metier_Util_Date::dateT('Y-m-d', 'M Y', $tabCS['dateAjout']);
|
||||
$libProfil = "En date du $dateMAJ : Contentieux importants.";
|
||||
|
@ -4,6 +4,12 @@ require_once __DIR__ . '/MMapFunctions.php';
|
||||
|
||||
class Metier_Partenaires_MMap
|
||||
{
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
private $referer ='';
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
|
@ -27,6 +27,12 @@ class Metier_Partenaires_MTva
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Remote Flag
|
||||
* @var boolean
|
||||
@ -40,6 +46,10 @@ class Metier_Partenaires_MTva
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,10 +84,18 @@ class Metier_Partenaires_MTva
|
||||
|
||||
$sql = "SELECT LPAD(cle,2,0) AS cle, DATE_FORMAT(dateMod,'%Y%m%d') as DateMAJ
|
||||
FROM sdv1.siren_tva WHERE siren=:siren";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $this->siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$stmtNb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $this->siren);
|
||||
$stmt->execute();
|
||||
$stmtNb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($stmtNb > 0) {
|
||||
$exist = true;
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$cle = $result->cle;
|
||||
@ -104,7 +122,7 @@ class Metier_Partenaires_MTva
|
||||
return true;
|
||||
}
|
||||
|
||||
Metier_Util_Log::write('W', "Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s. Cas impossible !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->logger->error("Erreur impossible (car l'algo ne devrait pas passer par ici) sur le Siren $siren, numéro de TVA = FR $cle $siren. Cas impossible !");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -160,11 +178,23 @@ class Metier_Partenaires_MTva
|
||||
if (preg_match('/Yes, valid VAT number/i', $body)
|
||||
|| preg_match('/Oui, numéro de TVA valide/i', $body)) {
|
||||
if ($exist) {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
|
||||
try {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
|
||||
'duree' => $time), array('siren' => $this->siren));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => intval($this->cle), 'duree' => $time));
|
||||
try {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => intval($this->cle), 'duree' => $time));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
$this->vatDefined = true;
|
||||
@ -172,16 +202,28 @@ class Metier_Partenaires_MTva
|
||||
}
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
Metier_Util_Log::write('I', "TVA ".$e->getMessage(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
|
||||
// Non disponible
|
||||
if ($exist) {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => 'NULL', 'duree' => $time),
|
||||
array('siren' => $this->siren));
|
||||
try {
|
||||
$this->conn->update('sdv1.siren_tva', array('cle' => 'NULL', 'duree' => $time),
|
||||
array('siren' => $this->siren));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => 'NULL', 'duree' => $time));
|
||||
try {
|
||||
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
|
||||
'cle' => 'NULL', 'duree' => $time));
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->vatNumber = "FR".$this->cle.$this->siren;
|
||||
|
@ -6,6 +6,12 @@ class Metier_Util_Db
|
||||
*/
|
||||
protected $db = null;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
@ -21,6 +27,10 @@ class Metier_Util_Db
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,11 +275,14 @@ class Metier_Util_Db
|
||||
$duree = 'N/D';
|
||||
}
|
||||
if ($this->errorCode == 0) {
|
||||
$msg = date('Y-m-d H:i:s') ." - DEBUG - ".$this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree;
|
||||
if ($this->logger != null) {
|
||||
$this->logger->debug($this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree);
|
||||
}
|
||||
} else {
|
||||
$msg = date('Y-m-d H:i:s') ." - ERROR - ".$this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree;
|
||||
if ($this->logger != null) {
|
||||
$this->logger->error($this->errorCode.":".$this->errorMsg." - ".$query." - ".$duree);
|
||||
}
|
||||
}
|
||||
file_put_contents(LOG_PATH . '/mysql.log', $msg . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,6 +240,12 @@ class Scores_Ws_Server
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Server SOAP
|
||||
* Document/Literal Wrapped - WS-I Compliant
|
||||
@ -247,6 +253,11 @@ class Scores_Ws_Server
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
|
||||
$this->listeDroits = include APPLICATION_PATH . '/../library/Scores/Account/Access.php';
|
||||
$this->listeCategory = include APPLICATION_PATH . '/../library/Scores/Account/Category.php';
|
||||
}
|
||||
@ -568,9 +579,9 @@ class Scores_Ws_Server
|
||||
try {
|
||||
$result = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
$c = Zend_Registry::get('config');
|
||||
file_put_contents($c->profil->path->shared.'/log/application.log',
|
||||
date('Y-m-d H:i:s').'- AUTH : '.$e->getMessage()."\n", FILE_APPEND);
|
||||
if ($this->logger != null) {
|
||||
$this->logger->error("AUTH : ".$e->getMessage());
|
||||
}
|
||||
return '0000';
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ class SphinxClient
|
||||
/// set matching mode
|
||||
function SetMatchMode ( $mode )
|
||||
{
|
||||
trigger_error ( 'DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API', E_USER_DEPRECATED );
|
||||
//trigger_error ( 'DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API', E_USER_DEPRECATED );
|
||||
assert ( $mode==SPH_MATCH_ALL
|
||||
|| $mode==SPH_MATCH_ANY
|
||||
|| $mode==SPH_MATCH_PHRASE
|
||||
|
@ -760,7 +760,7 @@ class SphinxClient
|
||||
/// set matching mode
|
||||
function SetMatchMode ( $mode )
|
||||
{
|
||||
trigger_error ( 'DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API', E_USER_DEPRECATED );
|
||||
//trigger_error ( 'DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API', E_USER_DEPRECATED );
|
||||
assert ( $mode==SPH_MATCH_ALL
|
||||
|| $mode==SPH_MATCH_ANY
|
||||
|| $mode==SPH_MATCH_PHRASE
|
||||
|
Loading…
Reference in New Issue
Block a user