Remove Application_Model_*
This commit is contained in:
parent
f2ed829a9e
commit
02d03a2ae9
124
bin/greffe.php
124
bin/greffe.php
@ -165,6 +165,9 @@ if ($opts->control) {
|
||||
$type = $matches[2];
|
||||
$date = $matches[3];
|
||||
$num = $matches[4];
|
||||
|
||||
$sql = "SELECT FROM WHERE ";
|
||||
|
||||
$actesM = new Application_Model_ActesFiles();
|
||||
$sql = $actesM->select()
|
||||
->where('siren=?', $siren)
|
||||
@ -203,29 +206,29 @@ if ($opts->control) {
|
||||
/**
|
||||
* Liste des commandes non traités depuis la base de données
|
||||
*/
|
||||
$acM = new Application_Model_Sdv1GreffeCommandesAc();
|
||||
$biM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$tabCommandes = array();
|
||||
if (in_array('ac', $types)) {
|
||||
$sql = $acM->select()
|
||||
->where('mode=?','C')
|
||||
->where('dateCommande!=?', '0000-00-00 00:00:00')
|
||||
->where('dateEnvoi=?', '0000-00-00 00:00:00');
|
||||
$rows = $acM->fetchAll($sql);
|
||||
if (count($rows)>0) {
|
||||
foreach ($rows as $row) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_ac WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-AC-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array('bi', $types)) {
|
||||
$sql = $biM->select()
|
||||
->where('mode=?','C')
|
||||
->where('dateCommande!=?', '0000-00-00 00:00:00')
|
||||
->where('dateEnvoi=?', '0000-00-00 00:00:00');
|
||||
$rows = $biM->fetchAll($sql);
|
||||
if (count($rows)>0) {
|
||||
foreach ($rows as $row) {
|
||||
$sql = "SELECT * FROM sdv1.greffe_commandes_bi WHERE mode=:mode AND dateCommande!=:commande AND dateEnvoi=:envoi";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('mode', 'C');
|
||||
$stmt->bindValue('commande', '0000-00-00 00:00:00');
|
||||
$stmt->bindValue('envoi', '0000-00-00 00:00:00');
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_OBJ)) {
|
||||
$tabCommandes['G-BI-'.$row->id] = $row;
|
||||
}
|
||||
}
|
||||
@ -269,9 +272,9 @@ foreach ($contents as $filename){
|
||||
$indice = substr($part, $p+1);
|
||||
}
|
||||
$tabFichiersFtp[strtoupper($ref).'-'.$indice] = $filename;
|
||||
|
||||
}
|
||||
// Fichiers en anomalies
|
||||
} else {
|
||||
else {
|
||||
if ($test){
|
||||
echo "Erreur : Anomalie fichier numérisé $filename\n";
|
||||
} else {
|
||||
@ -361,11 +364,11 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
|
||||
$isFileOnStorage = false;
|
||||
|
||||
if ( file_exists($fileOut) ) {
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if ( copy(ACTES_IGNUM_LOCAL_DIR.$fichier, $fileOut) ) {
|
||||
if (copy(ACTES_IGNUM_LOCAL_DIR.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
@ -374,19 +377,19 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
}
|
||||
|
||||
// --- Lecture présence référence bilan
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilanM->select()
|
||||
->where('siren=?',$commande->siren)
|
||||
->where('date_cloture=?', $dateCloture);
|
||||
if ($commande->bilanType=='sociaux') {
|
||||
$sql->where('type_comptes="" OR type_comptes="sociaux"');
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='' OR type_comptes='sociaux'";
|
||||
} else {
|
||||
$sql->where('type_comptes="consolides"');
|
||||
$sql = "SELECT * FROM jo.greffes_bilans WHERE siren=:siren AND date_cloture=:cloture AND type_comptes='consolides'";
|
||||
}
|
||||
$item = $bilanM->fetchRow($sql);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('cloture', $dateCloture);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
// --- Enregistrement
|
||||
if ( $isFileOnStorage && $item->pdfDate == '0000-00-00' ) {
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if (false !== $infos) {
|
||||
$data = array(
|
||||
@ -397,10 +400,8 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$result = $bilanM->update($data, 'id='.$item->id);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$conn->update('jo.greffes_bilans', $data, array('id' => $item->id));
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
@ -408,39 +409,23 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
break;
|
||||
|
||||
case 'AC':
|
||||
|
||||
$acteM = new Application_Model_JoGreffesActes();
|
||||
$sql = $acteM->select()
|
||||
->from($acteM, array(
|
||||
'id',
|
||||
'siren',
|
||||
'numRC',
|
||||
'LPAD(numGreffe,4,0) AS numGreffe',
|
||||
'pdfLink',
|
||||
'pdfSize',
|
||||
'pdfPage',
|
||||
'pdfDate',
|
||||
'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=?', $commande->siren)
|
||||
->where('num_depot=?', $commande->depotNum)
|
||||
->where('num_acte=?', $commande->acteNum)
|
||||
->where('type_acte=?',$commande->acteType);
|
||||
$item = $acteM->fetchRow($sql);
|
||||
$sql = "SELECT id, siren, numRC, LPAD(numGreffe,4,0) AS numGreffe, pdfLink,
|
||||
pdfSize, pdfPage, pdfDate, 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 FROM jo.greffes_actes
|
||||
WHERE siren=:siren AND num_depot=:depot AND num_acte=:acte AND type_acte=:type";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $commande->siren);
|
||||
$stmt->bindValue('depot', $commande->depotNum);
|
||||
$stmt->bindValue('acte', $commande->acteNum);
|
||||
$stmt->bindValue('type', $commande->acteType);
|
||||
$stmt->execute();
|
||||
$item = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
$infogreffe = new Metier_Infogreffe_DocAC();
|
||||
$infogreffe->setSiren($commande->siren);
|
||||
$date = $commande->acteDate;
|
||||
if ( $date == '0000-00-00' ) {
|
||||
if ($date == '0000-00-00') {
|
||||
$date = $commande->depotDate;
|
||||
}
|
||||
|
||||
@ -453,11 +438,11 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
|
||||
$isFileOnStorage = false;
|
||||
|
||||
if ( file_exists($fileOut) ) {
|
||||
if (file_exists($fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if ( copy(ACTES_IGNUM_LOCAL_DIR.$fichier, $fileOut) ) {
|
||||
if (copy(ACTES_IGNUM_LOCAL_DIR.$fichier, $fileOut)) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
@ -465,7 +450,7 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $isFileOnStorage && $item->pdfDate == '0000-00-00' ) {
|
||||
if ($isFileOnStorage && $item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if ( false !== $infos ) {
|
||||
$data = array(
|
||||
@ -476,11 +461,9 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$result = $acteM->update($data, 'id='.$item->id);
|
||||
$conn->update('jo.greffes_actes', $data, array('id' => $item->id));
|
||||
echo " = enregistrement.\n";
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
} catch(\Doctrine\DBAL\DBALException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
@ -505,13 +488,12 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
$data = array( 'dateEnvoi' => date('YmdHis'));
|
||||
switch ( substr($ref,2,2) ) {
|
||||
case 'BI':
|
||||
$commandesM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$conn->update('sdv1.greffe_commandes_bi', $data, array('id' => $commande->id));
|
||||
break;
|
||||
case 'AC':
|
||||
$commandesM = new Application_Model_Sdv1GreffeCommandesAc();
|
||||
$conn->update('sdv1.greffe_commandes_ac', $data, array('id' => $commande->id));
|
||||
break;
|
||||
}
|
||||
$commandesM->update($data, 'id='.$commande->id);
|
||||
echo date ('Y/m/d - H:i:s')." - Commande $ref mise à jour\n";
|
||||
$report_txt.= ' - Email envoyé à '.$commande->email;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user